var/E = new/obj/beam/kameha01
E:icon +=rgb(usr.red,usr.green,usr.blue)
usr.overlays += E
var/F = new/mob/bullet(usr.loc)
F:lasthit = usr.key
F:dir = usr.dir
F:owner = usr.key
F:red = usr.red
F:green = usr.green
F:blue = usr.blue
if(usr.dir == NORTH)
F:y += 1
if(usr.dir == SOUTH)
F:y -= 1
if(usr.dir == EAST)
F:x += 1
if(usr.dir == WEST)
F:x -= 1
F:beam = 1
F:beamtype = 1
F:damage = usr.powerlevel/20
if(F:damage <=0)
F:damage = 1
F:owner = "[usr.key]"
F:name = "Kamehameha Wave"
F:icon = 'kamehame(release).dmi'
F:icon_state = "end"
F:icon +=rgb(usr.red,usr.green,usr.blue)
walk(F:,usr.dir,2)
sleep(50)
usr.overlays -= E
usr.icon_state = ""
usr.moves = 0
usr.attacking = 0
Problem description:
var/E = new/obj/beam/kameha01
^
|
|
|
Thats the source of my problem.
Currently,my attack for my game is custom colored,meaning you can input the rgb values.
Problem is that I don't know how to remove the E.overlay incase you logout while shooting the attack,since I have it set to an individual variable,and when I try to do
src.overlays -= /obj/beam/kameha01
Upon logout,when I log back in,its still stuck on my character.
Any ideas?
usr.overlays -= E
That works just fine,after the attack is done,but it doesn't seem to work if I add that line to my logout proc.
It'd be useful to read the DM Guide before proceeding. Also make sure you use the DM Reference a lot (available from the link or by pressing F1 in Dream Maker).
Your code uses the : operator a lot. It is generally unsafe, and should never be used for the most part. There is no reason to use it instead of '.' in your code, you should simply define your variables' types properly.
Also, if you have something like this:
You should use 'else-if' instead; because if you already confirmed that dir equals NORTH, there is no reason and it is silly to still check if it also equals SOUTH,EAST or WEST which is of course impossible. An even better approach would be to use switch() -- although in this case, you're not even approaching it quite right; you should just use get_step() for that, and your entire projectile implementation is quite off. You should handle it more systematically and dynamically in procs and by using object subtypes instead of the way you have it now, hardcoding it into every verb (or whatever). Also, don't identify objects or keep track of them by their name; just use the object reference (ie 'the object itself') instead which is much more useful: