设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 76|回复: 0

[制作教程] Disabling Dashing while on certain terrain.

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    3 天前
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    4550

    主题

    864

    回帖

    2万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    23107
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    28551

    灌水之王

    发表于 3 天前 | 显示全部楼层 |阅读模式
    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 :

    SpoilerTo 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:        
    1. return false if "condition"
    复制代码




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

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-7-15 19:03 , Processed in 0.143066 second(s), 52 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表