• Having trouble receiving email verification when signing up? Contact a staff member via our Discord server!
  • Consider joining our Discord server if you haven't already! Discord is a free voice and text chat platform that's more or less a combination of Skype and Teamspeak. Using Discord, you can chat with other Relic Castle members in real-time! Wowza! Click here for the details!
Resource icon

Resource Push Rocks Confined on Set Terrain Tag

Vendily

Trainer
Member
Posts
94
#1
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.



You need to set up RoughFloor in PBTerrain.

Code:
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
Posts
29
#2
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

Trainer
Member
Posts
94
#3
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:
        # Can't walk onto ice
        elsif PBTerrain.isIce?(@terrain_tags[tile_id])
          return false
and change it to
Ruby:
# 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:
  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
Posts
29
#4
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!
 
Top