ID:264066
 
mob
Necromancer
verb
Angorodons_Gaze(mob/M as mob in view())
set category = "Spells"
set name = "Angorodon's Gaze"
set desc = "Steal 10,34,or 40 Health from foe.Takes 5 MP,5 seconds to recharge,and 1 second to activate."
var/random = rand(1,2)
if(usr.rechargeAG==1)
usr<<"You Need To Wait."
if(usr.rechargeAG==0)
usr.MP-=5
sleep(10)
if(random==1)
M.Health-=10
view()<<"[M] was hit with [usr]'s [src] for 10 damage!"
if(src.Health<=0)
deathcheck(M)
usr.rechargeAG=1
sleep(500)
usr.rechargeAG=0
if(usr.undercondition==1)
usr.Health+=1
if(random==2)
M.Health-=34
view()<<"[M] was hit with [usr]'s [src] for 34 damage!"
if(src.Health<=0)
deathcheck(M)
usr.rechargeAG=1
sleep(50)
usr.rechargeAG=0
if(usr.undercondition==1)
usr.Health+=7


Problem description:
umm, it doesnt make the person wait to attack, its like the little "rechargeAG" thing is never there setting it to 1, whats wrong here?


Oof. You've got several design flaws here, which can be remedied if you did an overhaul of your skill system. If you do want to continue using that system, however, you change this:
sleep(50)
usr.rechargeAG=0


to this:

spawn(50) usr.rechargeAG=0


I suggest you research datums and build a skill system based on that. Another thing you'd benefit from is having a single list that contains all of your cooldown timers for your skills -- then you just use a loop to subtract from all of the timers in the loop. Much easier than trying to handle 50 different variables in that way.
In response to Volte
mob
Necromancer
verb
Angorodons_Gaze(mob/M as mob in view())
set category = "Spells"
set name = "Angorodon's Gaze"
set desc = "Steal 10,34,or 40 Health from foe.Takes 5 MP,5 seconds to recharge,and 1 second to activate."
if(usr.rechargeAG)
usr << "You cannot cast this now!"
return
var/damageDone
usr.rechargeAG=1
spawn(50) usr.rechargeAG=0
usr.MP -= 5
sleep(10)
if(prob(50)) // Prob() will calculate the chance of the argument you supply. 50% chance is the same thing as picking 1 or 2.
damageDone=10
if(usr.undercondition) usr.Health++
else
damageDone=34
if(usr.undercondition) usr.Health+=7
view()<<"[M] was hit with [usr]'s Angorodon's Gaze for [damageDone] damage!" // src is not the name of the verb, but the mob that the verb belongs to (not the mob who executed it).
deathcheck(M) // The HP check should really be in your deathcheck() procedure.


I made some changes to it, hopefully you can learn from it!
In response to Volte
o.o; Uhhh, Thanks I Think
In response to Volte
Yea, I hope i can learn from it to..thats not that all confusing its just, the prob thing o.o i dont get it what if there was like 10 choices, would it be prob(10) or w/e??
In response to Reno Kujika
Reno Kujika wrote:
Yea, I hope i can learn from it to..thats not that all confusing its just, the prob thing o.o i dont get it what if there was like 10 choices, would it be prob(10) or w/e??

No, you'd probably use a random number for something like that. I just used prob(50) since it's the same as generating a random number between 1 and 2 and picking one. For more options, you might do something like:

switch(rand(1,5))
if(1)
// option 1
if(2)
// option 2
if(3)
// option 3
// etc.

In response to Volte
K, Thanks it works now