![]() |
Need help with code - Printable Version +- Mirage Source (https://mirage-engine.uk/forums) +-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61) +--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18) +---- Forum: Help Wanted (https://mirage-engine.uk/forums/forumdisplay.php?fid=50) +---- Thread: Need help with code (/showthread.php?tid=2753) |
Need help with code - Xlithan - 17-04-2009 I've been trying to get spell buffs to work for some time now but to no avail. Setting up the spell and adjusting the stats I can do, but there needs to be some sort of timer so that the stat goes back to normal, and an on/off flag to tell the code that the spell is currently active (So it can't be used again until the timer runs out). Any help would be much appreciated. Thanks. Re: Need help with code - Matt - 17-04-2009 Add a variable to the temp player rec to store the timer for the buffer. Make it an array or w/e, so you can set a max amount of buffs per player. Then check that timer in the loop and if it's true, give it the stat bonuses, if it's not, take them away. Re: Need help with code - Xlithan - 17-04-2009 not sure I understand you. I want them to activate the buff using a spell, then after 30 seconds, it goes back to normal again. I want these spells to be used on other players as well as yourself. Re: Need help with code - GIAKEN - 17-04-2009 I suggest doing something like this...all pseudo code I just typed up in this post. Make an array for much easier server looping. Like this: Code: Public SpellBuff(1 To 1) As SpellBuffRec Then when the player casts the spell, do something like this: Code: If UBound(SpellBuff) > 1 Then Something like that? Then the server would loop like this: Code: For i = 1 to UBound(SpellBuff) Of course there's problems with taking down a piece of the array...example: Spell buff 1 finishes, but there's a spell buff 2 and 3...since the UBound is 3 for the array, spell buff 3 gets taken down. You'll need to make some adjusting code that moves all the array data down a notch to fix the problem. Eh I'm bored...something like this: Code: Sub AdjustBuffArray(ByVal Index As Long) Something like that maybe? Then: Code: If UBound(SpellBuff) > 1 Then Not sure about it all but I hope you get the idea. Re: Need help with code - Rian - 17-04-2009 Steve, I think learning more about GetTickCount will solve most of the problems you're having. http://www.codebeach.com/tutorials/high ... -basic.asp Re: Need help with code - Xlithan - 17-04-2009 Very true Rian, thanks lol. |