I have used a Beam demo by someone called something like Radditz.
But when I fire, it works quite well, but the tail is not deleted after the head is deleted.
Also, it is meant to say "(Whoever's) beam has hit (whoever)" in view 6, but it doesn't say anything!
Here is my code:
obj
SBC
icon = 'kame.dmi'
icon_state = "sbchead"
density = 1
Head
icon_state = "sbchead"
New()
spawn(1) // Delay is abit...
Start() // Calls the Start() proc
Check()
..()
proc
Start()
walk(src,usr.dir,1) // Makes the Kame's head move
Check() // This is the proc used to delete the Kame when its at the map's edge
while(src)
var/turf/T = get_step(src,src.dir)
if(!T)
owner.kame = 0
owner.icon_state = ""
owner.move = 1
if(src)
for(var/obj/O in src.SBC)
del(O)
del(src)
sleep(1)
Bump(atom/M)
if(isturf(M)) // If whatever the head bumps is a turf..
owner.kame = 0 // Allow the owner to fire another Kame
owner.icon_state = "" // Give them their default icon_state
owner.move = 1 // Allow them to move
for(var/obj/O in src.SBC) // Checks for objects in the Head's Kame list...
del(O) // Deletes any objects found
del(src) // Deletes the head
else if(ismob(M)) // If whatever the head bumps is a mob...
view(src.owner) << "[src.owner]'s Special Beam Attack hits [M]!" // For all in the owner's view, gives a message
owner.kame = 0 // Allows the owner to fire another Kame
src.owner.icon_state = "" // Sets them to their default icon_state
owner.move = 1 // Allows them to move
for(var/obj/O in src.SBC) //For all objects in the Head's Kame list...
del(O) //Delete any objects found
del(src) // Delete the head
else
if(!ismob(M) && !isturf(M) && !isobj(M) && !isarea(M))
owner.kame = 0 // Allow the owner to fire another Kame
owner.icon_state = "" // Give them their default icon_state
owner.move = 1 // Allow them to move
for(var/obj/O in src.SBC) // Checks for objects in the Head's Kame list...
del(O) // Deletes any objects found
del(src) // Deletes the head
Tail // The Kame's body
icon_state = "tail"
Move()
if(istype(src,/obj/SBC/Head)) //If the obj trying to move is The Kame's Head...
var/obj/Tail = new/obj/SBC/Tail(src.loc) // Create a new body at the current location
Tail.owner = src //Set the owner of the body to the Head
src.SBC.Add(Tail) // Adds the Body to the Head's Kame list, for later tracking and deletion of it
Tail.dir = src.dir // Set its direction
moved++ // Adds 1 to the Head's moved var
if(moved == total) // Checks to see if the spaces moved(the moved var) is equal to the spaces its allowed to move(the total var)
owner.kame = 0 // Allows the owner to fire another Kame
owner.icon_state = "" // Sets the owner to its default icon_state
owner.move = 1 // Allows the owner to move
if(src) // Just incase...checking to make sure the object is still there, we dont want any runetime errors, do we? =p
for(var/obj/O in src.SBC) // Checks for the objects in the Head's Kame list
del(O) // Delete any objects found
del(src) // Deletes the Head
..() // Continues with the Move() procs norm
obj
Sbc
verb
Sbc()
set name = "Special Kame Cannon"
set category = "Fighting"
if(usr.safe != 1)
usr.kame = 1
usr.move = 0
view(6) << "[usr] : Special..."
sleep(2)
view(6) << "[usr] : Kame..."
sleep(2)
view(6) << "[usr] : CANNON!!!"
sleep(2)
FireSpecialBeamAttack()// Calls the Beam() proc
usr.kame = 0
usr.move = 1
else
usr<<"Not in a safe zone!"
proc
FireSpecialBeamAttack()
var/obj/Head = new/obj/SBC/Head() // Creates the Beam's Head
if(usr.dir == NORTH) // If the mob's dir is NORTH...
Head.loc = locate(usr.x,usr.y+1,usr.z)
if(usr.dir == SOUTH) // If SOUTH...
Head.loc = locate(usr.x,usr.y-1,usr.z)
if(usr.dir == WEST) // If WEST...
Head.loc = locate(usr.x-1,usr.y,usr.z)
if(usr.dir == EAST) // If EAST...
Head.loc = locate(usr.x+1,usr.y,usr.z)
Head.total = 8 // Sets the total to 6, that means the beam's head can move 6 spaces before deletion
Head.dir = usr.dir // Sets the Head's dir to the mob's dir
Head.owner = usr
Any help would be greatly appreciated!
~GokuSS4Neo~
Lummox JR