Trapping keys?
Moderator: Moderators
Trapping keys?
hi everyone!
ill be quick, is there a way i can detect what keys have been pressed?
so like if someone pressed their key for left then do something?
if(local.player.pressed=="moveleft") -or something?
ill be quick, is there a way i can detect what keys have been pressed?
so like if someone pressed their key for left then do something?
if(local.player.pressed=="moveleft") -or something?
Yes there is a way, but it involves more than just scripting
Since I think you are a talented scripter, I'll give a brief explanation and see how far you get with it
Mohaa uses so-called state files to determine player animations based on their actions (i.e. what they are doing) and the good thing is you can modify these things. You can find them in global/mike_legs.st and global/mike_torso.st.
You can use these files to send information about key presses to other scripts, for example when a player is starting to walk forward you could exec a script by adding it to the entrycommands of that state.
You could also add a bunch of new states to keep things easier and better organized. In a script, you can use $player forcelegsstate SOME_STATE and $player forcetorsostate SOME_STATE to throw players in a certain state.
Anyway hope this helps some how... good luck
Since I think you are a talented scripter, I'll give a brief explanation and see how far you get with it
Mohaa uses so-called state files to determine player animations based on their actions (i.e. what they are doing) and the good thing is you can modify these things. You can find them in global/mike_legs.st and global/mike_torso.st.
You can use these files to send information about key presses to other scripts, for example when a player is starting to walk forward you could exec a script by adding it to the entrycommands of that state.
You could also add a bunch of new states to keep things easier and better organized. In a script, you can use $player forcelegsstate SOME_STATE and $player forcetorsostate SOME_STATE to throw players in a certain state.
Anyway hope this helps some how... good luck

