Page 1 of 2
Trapping keys?
Posted: Sun May 30, 2004 3:03 pm
by Elgan
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?
Posted: Mon May 31, 2004 6:48 am
by bdbodger
the only 2 I know of are useheld and fireheld
Posted: Mon May 31, 2004 4:32 pm
by Elgan
yeah i have used both of them:(
Posted: Mon May 31, 2004 8:00 pm
by Elgan
is there a way of detecting secondry fire?
Posted: Mon May 31, 2004 8:18 pm
by jv_map
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

Posted: Mon May 31, 2004 8:23 pm
by Elgan
wow thanx ill go try:):D
and this would be totaly server sided yes?
Posted: Mon May 31, 2004 8:25 pm
by jv_map
Yes
Note: if you want you could use map specific state files. For example, if you want to use global/mymap_legs.st and global/mymap_torso.st add this line to the top of your map script:
setcvar g_statefile "global/mymap"
Downside is that you'd have to change it back somehow when the map changes

Posted: Mon May 31, 2004 8:47 pm
by Elgan
couldnt you just have setcvar g_statefile "global/mike_legs.st" at the top of all the maps and then on the one i want modified have setcvar g_statefile "global/maymaps_new_state.st"?
Posted: Mon May 31, 2004 8:50 pm
by jv_map
Yes you could do that
But remember it should be without the _legs.st
(default is global/mike)
Posted: Mon May 31, 2004 9:08 pm
by Elgan
hmm have u an example of an edited .st please?
i edited it and changed the map file to load its new state but maps wont load now

Posted: Mon May 31, 2004 9:19 pm
by jv_map
Look in the console for errors.
Posted: Mon May 31, 2004 9:26 pm
by Elgan
it just says error coulnt load filename
ill delete it and try again:P
Posted: Tue Jun 01, 2004 1:11 am
by Elgan
ok ive been trying this for hours but everytime i try to load the map it fails:(
does any1 have an example?
Posted: Tue Jun 01, 2004 1:52 am
by Elgan
crap!
i been messing for aggges and nout worked!
1 of them might of:(
because i just set setcvar g_statefile "global/mymap.st"
and made mymap state with default and it still didnt work:@
Posted: Tue Jun 01, 2004 6:06 am
by jv_map
Set g_statefile to global/mymap and make 2 statefiles global/mymap_legs.st and global/mymap_torso.st... then you should be fine
