Advertiser Content

rekman

Italy
Seen 9 Hours Ago
Posted 1 Week Ago
39 posts
1.5 Years
Hello everyone!
I am trying to develop a Wall sliding event that works mainly based on Ice sliding.
The concept is the following: If you are facing Down the wall (and if the rock wall permits it) you will slide down the wall till you touch the "grass". Here an image to show it. I will also Attach them at the bottom of the post.


The Event code used is:


The code underlying that I wrote in PField_Field is:
Spoiler:
def Kernel.pbSlideOnRock(event=nil)
  if $game_player.direction==2
  event = $game_player if !event
  return if !event
  $PokemonGlobal.sliding = true
  direction    = event.direction
  oldwalkanime = event.walk_anime
  event.straighten
  event.walk_anime = false
  loop do
    pbSEPlay("eb_ground2")
    $scene.spriteset.addUserAnimation(DUSTBROWN_ANIMATION_ID,event.x,event.y,true,1)
    break if !PBTerrain.isRock?(pbGetTerrainTag(event))
      event.move_forward
    while event.moving?
      Graphics.update
      Input.update
      pbUpdateSceneMap
    end
  end
  event.center(event.x,event.y)
  event.straighten
  event.walk_anime = oldwalkanime
  $PokemonGlobal.sliding = false
  end
end


The problem is that the code is based on PBTerrain.isRock?, that I created simply by:
Spoiler:
  def PBTerrain.isRock?(tag)
    return tag==PBTerrain::Rock
  end


That condition is limiting. I would improve the script by changing it and setting a different IF statement that I can't find a way to define:

IF the tile the player is standing on while sliding is Passable
OR
IF the player is standing in a tile where there is an event, that has as Image a Tileset Tile that is itself Passable and with Priority==0

THEN the player stops sliding
The problem for the First Condition is that while the player is sliding, since I wrote the Event of Sliding in this way , the player has THROUGH ON to slide on Rocks that are normally Non-Passable. Therefore, I can't find a easy way to reconize something Passable or not when the player is Through On.

The problem with the second condition is similar and I also don't know how to recall the properties of the Tileset's Tile that the Stop Event has.

Would someone be that kind and gentle to give me a hand?
Thank you in advance for your attention :)
Pokemon Desiderium ~ DEMO COMING SOON

WolfPP

Discord: Wolf#1235

Male
Brazil
Seen 4 Hours Ago
Posted 15 Hours Ago
619 posts
328 Days
You need to add a new code inside 'PField_Field' script, into this code (make another 'elsif' below 'elsif PBTerrain.isIce?(currentTag) && !$PokemonGlobal.sliding'):
Spoiler:

# Show grass rustle animation, and auto-move the player over waterfalls and ice
Events.onStepTakenFieldMovement+=proc {|sender,e|
  event = e[0] # Get the event affected by field movement
  if $scene.is_a?(Scene_Map)
    currentTag = pbGetTerrainTag(event)
    facingTag=Kernel.pbFacingTerrainTag
    if PBTerrain.isJustGrass?(pbGetTerrainTag(event,true)) && event.character_name != "nil"
      $scene.spriteset.addUserAnimation(GRASS_ANIMATION_ID,event.x,event.y,true,1)
    elsif event==$game_player
      if currentTag==PBTerrain::WaterfallCrest
        # Descend waterfall, but only if this event is the player
        Kernel.pbDescendWaterfall(event)
      elsif PBTerrain.isIce?(currentTag) && !$PokemonGlobal.sliding
        Kernel.pbSlideOnIce(event)
      elsif PBTerrain.isRock?(currentTag) && !$PokemonGlobal.sliding
        Kernel.pbSlideOnRock(event)
      end
    end
  end
}


If you are using Following Pokemon Script and want the pokemon be static (no animation) if you are sliding on the rock, find 'def update_stepping' inside Following Pokemon Script and add the lines:
  def update_stepping
    currentTag = pbGetTerrainTag($game_player)
    return if PBTerrain.isRock?(currentTag)
    FollowingMoveRoute([PBMoveRoute::StepAnimeOn])
  end

rekman

Italy
Seen 9 Hours Ago
Posted 1 Week Ago
39 posts
1.5 Years
Thanks a lot :) But, as you have seen in my Game jam entry (Circular Knowledge), the sliding wall is already been implemented and fully functional. Not the best method but it works perfectly. I didn't post the solution here since there wasn't any interest towards this topic from the community. It is a very specific feature afterall. Thanks again for the help!
If anyone is really interested in this feature, just tell me and I'll wrote a tutorial :)
Pokemon Desiderium ~ DEMO COMING SOON
Advertiser Content