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
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
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) != 1
To 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"
复制代码
本贴来自国际rpgmaker官方论坛作者:Ruiran处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/disabling-dashing-while-on-certain-terrain.25244/