Thread: [Script] Simple Dialogue System
View Single Post
Old 01-05-2017   #5
LunarDestroyer's Avatar

//To handle input and stop the player from moving around when selecting an option.
addHook("ThinkFrame", do
    for p in players.iterate()
        //Handle if dialogue is currently open.
        if p.conversation != nil then
            //Stop the character from moving.
            p.normalspeed = 0
            p.jumpfactor = 0
            p.charability = 0
            p.charability2 = 0
        //Otherwise, set speed, jump height, and abilities back to normal. For this reason, this script does not play nice, by default, with anything that alters any of these.
            p.normalspeed = skins[].normalspeed
            p.jumpfactor = skins[].jumpfactor
            p.charability = skins[].ability
            p.charability2 = skins[].ability2
        p.oldButtons = p.cmd.buttons //Keep the oldbuttons variable up to date.
        p.oldForwardMove = p.cmd.forwardmove //Keep oldForwardMove up to date.
This is a pretty huge bump, but I had just thought of this, and figured it was worth bringing up. Wouldn't a fairly simple fix to this be to save the player's stats to variables (or a table, if you want to be fancy) before overwriting them, then, when the menu is closed, replace the player's stats with the ones saved from before? The only possible problem with that solution that I could think of is if Speed Shoes directly modify the player's stats in order to achieve their effect, and that probably wouldn't be too difficult to find workarounds for (You could check and see if the player has speed shoes when saving the variables and adjust accordingly, that would probably work.).

In any case, if anyone is looking to implement this into something and wants to also provide support for scripts that modify the player's stats, this is something to keep in mind.
LunarDestroyer is offline   Reply With Quote