ID:179015
 
i am have a magic script here

mob/proc/Hand_Of_Fire(mob/M as mob in oview(3))
set category = "Spells"
if(usr.mp<=5)//this Will cause a action if the users magic is less then 5//
usr<<"You don't have enough Magic"
else if(src.isnpc == 0)
usr<<"You Prepare to use the Fire Spell"//Tells the user he/she is getting ready to use the Fire Spell//
usr.overlays+=/obj/overlays/FireStart//This adds the overlay defined at /obj/overlays/FireStart//
sleep(30)//Waits 5 seconds till next action//
usr.overlays-=/obj/overlays/FireStart//This subtracts the overlay defined at /obj/overlays/FireStart//
sleep(1)//This delays the next action for 1/10 of a second//
missile(/obj/Fire,usr,M.loc)//This calls the missle proc to fire the obj defined at obj/Fire to M's loc//
var/damage=11*usr.lvl//This makes a damage var which equals 10 times the users level//
M.overlays+=/obj/overlays/FireEnd//This Makes the overlay FireEnd appear over M makeing it look like he/she is on fire :)//
sleep(10)//This Delays the Next Action One Second//
M.overlays-=/obj/overlays/FireEnd//M is lucky now the Fire is out//
M.hp-=damage//This takes what ever the damage var equals from M's health//
usr.mp-=3
if(M.hp<=0)//This Makes it so something happens if M's Health drops below 0//
M.loc=locate(1,1,1)//This Moves M to the location 1,1,1 after his/her Health drops below 0//
M.hp=M.maxhp//Whats Death without your Health Returning to its Max//
M.mp=M.maxmp
else
usr << "You cant attack helpless npcs!"

can someone help me jif it up so you can lets say only cast spells like once untill finished,
If anybody could thanks!
The easiest way to do it would be to have a casting var for the mob.

mob
var/casting = 0
verb
Cast()
if(!casting)
casting = 1
//do your magic stuff here
casting = 0
If you want it to be limited to only one time until it's finished...just add a simple variable switch like so...
Hand_of_Fire()
var/in_progress = 0
if (in_progress)
src << "You cannot use this spell again yet..."
else
in_progress = 1
\\spell stuff goes here and once it's all over...just turn the variable back "off"...
in_progress = 0



The first time they call the spell...the in_progress variable will be "off"...so the spell will continue... As soon as the spell starts, though...it turns the variable "on"... And any attempt after that will stop them at the "You cannot use this spell again yet..." message...

At the end of the spell...the variable is turned back "off"...so they can use the spell again once it's completed...
In response to English
Great minds think alike! lol

(Seriously, though...this is probably the most common method...)
In response to SuperSaiyanGokuX
i have added what you said can someone tell me if what i posted above is right