zidsal Posted March 7, 2009 Author Share Posted March 7, 2009 Well I'm making some bosses (with my new ultra urber cool SS subs and functions) But this is really getting to me and I can't figure out whats wrong:Whats suppose to happen:you lose health every milisecond for 5 ticks. After 5 ticks you take additonal damage:What really happens the ticks go on for ever.```Sub Decay(victim) dim Count Count = 0 If Count < 5 then Call SpellAnim(6, getplayermap(victim), getplayerx(victim), getplayery(victim)) Call BattleMsg(victim, "Your body begins to decay..", GREY, 0) Call SetPlayerHP(victim, getplayerhp(victim) - 1) Call SendHP(victim) Count = Count + 1 End If If Count = 5 then Call RemoveTimer("Decay " & victim) Call playermsg(victim, "Your body has decayed",4) Call SetPlayerHP(victim, getplayerhp(victim) - 5) Call SendHP(victim) End If End Sub ```so anyone want to take a crack at this? Link to comment Share on other sites More sharing options...
makairu Posted March 7, 2009 Share Posted March 7, 2009 I'm not a scripter, but I would have to say it's at``` Call SetPlayerHP(victim, getplayerhp(victim) - 1)```It may just be taken -1 over and over and over… than again, I'm not a scripter or coder Link to comment Share on other sites More sharing options...
Fulou Posted March 7, 2009 Share Posted March 7, 2009 Count is always 0 and 1, it will never reach 5\. So it will never turn the timer off. Im guessing Decay(Index) is called via the timer, you need to make Count a global value and only set count as 0 when the timer is activated.If it keeps running count = 0 everytime the counter ticks, guess what? it resets it and your 5 steps away from 5, again :P Link to comment Share on other sites More sharing options...
Fulou Posted March 7, 2009 Share Posted March 7, 2009 Feeling generous :)Dont forget to resetdecay when they are first infected!```'.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.Sub ResetDecay(Victim)'.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.Dim Count Count = 0 Call PutVar("Decay.ini", Cstr(Victim), "Count", Cstr(Count))End sub'.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.Sub Decay(victim)'.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:.:!:. dim Count Count = Int(getVar("Decay.ini", Cstr(Victim), "Count")) if Len(Cstr(Count)) = 0 then Count = 0 End if If Count => 5 then Call RemoveTimer("Decay " & victim) Call playermsg(victim, "Your body has decayed",4) Call SetPlayerHP(victim, getplayerhp(victim) - 5) Call SendHP(victim) Else Call SpellAnim(6, getplayermap(victim), getplayerx(victim), getplayery(victim)) Call BattleMsg(victim, "Your body begins to decay..", GREY, 0) Call SetPlayerHP(victim, getplayerhp(victim) - 1) Call SendHP(victim) Count = Count + 1 Call PutVar("Decay.ini", Cstr(Victim), "Count", Cstr(Count)) End If End Sub``` Link to comment Share on other sites More sharing options...
zidsal Posted March 7, 2009 Author Share Posted March 7, 2009 thanks alot Fulou I would of never spotted that if it wasn't for you so you got a high five. Link to comment Share on other sites More sharing options...
ryono Posted March 9, 2009 Share Posted March 9, 2009 you can also static the counter. just replace dim with static. I think you can do that with sadscript. basically a static is a variable that does not reset when the sub is called. u would have to take out "Count = 0". Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now