Disabling Dashing while on certain terrain.

● ARCHIVED · READ-ONLY
Started by Ruiran 3 posts View original ↗
  1. I will be showing you , here and now, how to disable dashing using mostly Events and 1 line of script editing.

    For this process you can use multiple Regions (Press F7 while in the editor) or Terrain tags ( Found in the Tilesets tab ) to define if the player is allowed or not to dash, but I will be showing you this only using 1 Region.

    Let's start by selecting the desired Region(Or terrain tag) and applying it to the appropriate locations, for example you don't want your character to be able to run on grass but you want him to be able to run on sand, just apply the Region to the grassy area and :

    Spoiler
    ss2014-03-22at012059_zps6fa4b336.jpg
    Now that we have our set locations on where the character is not allowed to dash, we need to find out how to disable the dash.

    To manage that we will be making a common event, which I will name Running, which has a Parallel process trigger and any random switch as it's condition. (Before we test this remember to turn that random switch on via an event)

    This common event will be constantly checking for the region the player is standing on using a "Get location info" command (tab 3 under "Map") which will be using the players X  and Y coordinates. To set these coordinates simply make 2 variables one equal to the players Y and the other to the players X. (Map X and Y not screen X and Y) .

    Now if the player is standing on the desired Region, this common event will turn off another random switch ( not the same as the one who triggered this common event ).  If you did everything right you should end up with something similar to this:

    Spoiler
    ss2014-03-22at012127_zps6e165136.png
    Now to the final part, this will require that you add this line : 

    return false if $game_switches[100] == false in between lines 137-142 of the Game_Player script (Found in the script editor, F11 for quick access)

    (You can change the id of the switch to match your own.)

    This will make it so if the player is on the previously selected Region, he will not be able to dash, and will stop dashing.

    I am aware (thanks to Shaz) that you can just apply any of these two lines :

    Spoiler
    To ONLY allow dashing where you have put region 1:

    return false if $game_map.region_id(@x, @y) != 1To only DISABLE dashing where you have put region 1:

    return false if $game_map.region_id(@x, @y) == 1
    But I prefer to also show the use of the "Get location info" event command.
    Something in interesting to note, you can add different conditions in between lines 137-142 to disable dashing by simply having it :

    Code:
    return false if "condition"
  2. Thank you for sharing!
  3. This doesn't work.