| Mirage Source http://miragesource.net/forums/ |
|
| Class Specific Input http://miragesource.net/forums/viewtopic.php?f=201&t=4157 |
Page 1 of 1 |
| Author: | Acruno [ Thu Aug 14, 2008 8:30 am ] |
| Post subject: | Class Specific Input |
Ok, I am now attempting a feature that would allow Class X to press F1 and drink a HP Potion, and Class Y to press F1 and cast a spell. Judging by how my class-specific backgrounds are chosen, I assume I would send a packet from the server with the player's class, and then define the keypresses in ModHandleData. However, I am not sure what sub to send it in server-side. Anyone able to help? [NOTE]I also would like to find out how to stop people just holding down a button to keep repeating an action (i.e. holding down ctrl and spam attacking an npc). I assume I could use a timer (for things like mining), or that there is some code that only runs the request once. Thanks in advance |
|
| Author: | Robin [ Thu Aug 14, 2008 9:07 am ] |
| Post subject: | Re: Class Specific Input |
Acruno wrote: Ok, I am now attempting a feature that would allow Class X to press F1 and drink a HP Potion, and Class Y to press F1 and cast a spell. Judging by how my class-specific backgrounds are chosen, I assume I would send a packet from the server with the player's class, and then define the keypresses in ModHandleData. However, I am not sure what sub to send it in server-side. Anyone able to help? [NOTE]I also would like to find out how to stop people just holding down a button to keep repeating an action (i.e. holding down ctrl and spam attacking an npc). I assume I could use a timer (for things like mining), or that there is some code that only runs the request once. Thanks in advance If you want it to only happen once per button press, call it in KeyPress or KeyUp instead of KeyDown. As for how to call it, create the packet that sends the KeyPress request to the server, then write something like this: Code: Select Case GetPlayerClass(index)
Case 0 'Warrior If HasItem(index, POTIONITEM#) then Hp = Hp + PotionAddHP TakeItem index, POTIONITEM# SendHp index exit sub Case 1 'Mage CastSpell index, SPELLSLOT# exit sub End select |
|
| Author: | Acruno [ Thu Aug 14, 2008 9:32 am ] |
| Post subject: | Re: Class Specific Input |
That should work, I'll try that now. On the subject of Key Presses, what about if I have a foraging skill and I only want to player to be able to forage on that tile once every X seconds (X defined in the editor perhaps)? |
|
| Author: | Robin [ Thu Aug 14, 2008 10:51 am ] |
| Post subject: | Re: Class Specific Input |
Take advantage of the TempTile. Set the timer to one of the variables in there, and then do a check. Try.. erm, CheckGetMapItem or something in the server. It handles all the stuff when pressing Enter. At the end, add something like: Code: CheckForage index, map, x, y Then the subroutine something like this: Code: If Player(index).ForageTimer > gettickcount + 1000 then
GiveItem index, ITEM#, ITEMVAL Player(index).foragetimer = gettickcount playermsg "omfg u got something!", white exit sub else playermsg "u cant get that u silly fishcake", white end if |
|
| Author: | Acruno [ Thu Aug 14, 2008 10:55 am ] |
| Post subject: | Re: Class Specific Input |
Ok, I think I understand now, thanks for your help |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|