• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
Resource icon

Resource Push Rocks Confined on Set Terrain Tag 2020-01-13

Vendily

Elite Trainer
Member
Vendily submitted a new resource:

Push Rocks Confined on Set Terrain Tag - So you don't have to line the boundaries with events.

Here's some code for a pushing puzzle where the rocks are confined to a small area.

sokoban.gif


You need to set up RoughFloor in PBTerrain.

Code:
Expand Collapse Copy
module InterpreterFieldMixin
  def pbPushThisSokoban
    case $game_player.direction
    when 2 # down
       tag=$game_map.terrain_tag($game_player.x,$game_player.y+2)
    when 4 # left
      tag=$game_map.terrain_tag($game_player.x-2,$game_player.y)...

Read more about this resource...
 

silentgamer64

Novice
Member
Joined
Jul 5, 2017
Posts
35
Great resource! Do you think you could make one for boulders that slide along multiple ice tiles when pushed? Combined with this, it could make for some interesting puzzles.
 

Vendily

Elite Trainer
Member
Great resource! Do you think you could make one for boulders that slide along multiple ice tiles when pushed? Combined with this, it could make for some interesting puzzles.

Well, I messed with it some, and while possible, it does require editing the default map passability checks, as by default, only the player is allowed to step on ice. modifying the default check to make it similar to the allow events already on water move provided the tile infront of them is also water is possible though.

We need to find this bit in Game_Map
Ruby:
Expand Collapse Copy
        # Can't walk onto ice
        elsif PBTerrain.isIce?(@terrain_tags[tile_id])
          return false
and change it to
Ruby:
Expand Collapse Copy
# Can't walk onto ice #edit
        elsif self_event!=nil &&
           PBTerrain.isIce?(@terrain_tags[tile_id])
          for j in [2, 1, 0]
            facing_tile_id=data[newx, newy, j]
            return false if facing_tile_id==nil
            if @terrain_tags[facing_tile_id]!=0 &&
               @terrain_tags[facing_tile_id]!=PBTerrain::Neutral
              return PBTerrain.isIce?(@terrain_tags[facing_tile_id])
            end
          end
          return false
This goes in module InterpreterFieldMixin like before.
Ruby:
Expand Collapse Copy
  def pbPushThisSlide
    event = get_character(0)
    return if !event
    return if !PBTerrain.isIce?(pbGetTerrainTag(event))
    case $game_player.direction
    when 2; event.turn_down  # down
    when 4; event.turn_left  # left
    when 6; event.turn_right # right
    when 8; event.turn_up    # up
    end
    oldwalkanime = event.walk_anime
    event.straighten
    event.walk_anime = false
    loop do
      break if !event.passable?(event.x,event.y,event.direction)
      break if !PBTerrain.isIce?(pbGetTerrainTag(event))
      event.move_forward
      while event.moving?
        Graphics.update
        Input.update
        pbUpdateSceneMap
      end
    end
    event.straighten
    event.walk_anime = oldwalkanime
  end

this does have the side effect of trapping events on the ice exclusively, but it does slide. If you slide into a slide boulder, it stops the player, and you have to walk into it again to shove it. These two factors might not be ideal for an ice puzzle.
 
Last edited:

silentgamer64

Novice
Member
Joined
Jul 5, 2017
Posts
35
this does have the side effect of trapping events on the ice exclusively, but it does slide. If you slide into a slide boulder, it stops the player, and you have to walk into it again to shove it. These two factors might not be ideal for an ice puzzle.

Not to worry, that's exactly what I was looking to do. I got the idea from this Zelda puzzle:

Thanks!
 
Back
Top