mob
var
firing = 0 // This var determines whether the mob is firing a beam, or not.
move = 1
obj
var
mob/owner = null // This var will be set as the owner of the beam being fired.
total = 0 // The total number of spaces the beam's head is allowed to move
moved = 0 // The number of spaces the beam's head has moved
list/Beam = list() // A simple list to keep track of the beam's body
Beams
icon = 'Kamehameha.dmi'
density = 1
Head
icon_state = "head"
New()
spawn(1) // Delay is abit...
Start() // Calls the Start() proc
Check()
..()
proc
Start()
walk(src,usr.dir,1) // Makes the beam's head move
Check() // This is the proc used to delete the beam when its at the map's edge
while(src)
var/turf/T = get_step(src,src.dir)
if(!T)
owner.firing = 0
owner.icon_state = ""
owner.move = 1
if(src)
for(var/obj/O in src.Beam)
del(O)
del(src)
sleep(1)
Bump(atom/M)
if(isturf(M)) // If whatever the head bumps is a turf..
owner.firing = 0 // Allow the owner to fire another beam
owner.icon_state = "" // Give them their default icon_state
owner.move = 1 // Allow them to move
for(var/obj/O in src.Beam) // Checks for objects in the Head's Beam 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 beam hits [M]!" // For all in the owner's view, gives a message
owner.firing = 0 // Allows the owner to fire another beam
src.owner.icon_state = "" // Sets them to their default icon_state
owner.move = 1 // Allows them to move
for(var/obj/O in src.Beam) //For all objects in the Head's Beam list...
del(O) //Delete any objects found
del(src) // Delete the head
else
if(!ismob(M) && !isturf(M) && !isobj(M) && !isarea(M))
owner.firing = 0 // Allow the owner to fire another beam
owner.icon_state = "" // Give them their default icon_state
owner.move = 1 // Allow them to move
for(var/obj/O in src.Beam) // Checks for objects in the Head's Beam list...
del(O) // Deletes any objects found
del(src) // Deletes the head
Body // The Beam's body
icon_state = "body"
density = 1
Move()
if(istype(src,/obj/Beams/Head)) //If the obj trying to move is The Beam's Head...
var/obj/Body = new/obj/Beams/Body(src.loc) // Create a new body at the current location
Body.owner = src //Set the owner of the body to the Head
src.Beam.Add(Body) // Adds the Body to the Head's Beam list, for later tracking and deletion of it
Body.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.firing = 0 // Allows the owner to fire another beam
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.Beam) // Checks for the objects in the Head's Beam list
del(O) // Delete any objects found
del(src) // Deletes the Head
..() // Continues with the Move() procs norm
mob
verb
Kamehameha2() // Verb used for firing the beam
set category = "Techniques"
usr << "kamehameha!!"
if(usr.firing) // If the mob's firing var is one...
usr << "This cannot be done."
return
if(usr.buku) // If the mob's firing var is one...
usr << "This cannot be done."
return
if(usr.doing) // If the mob's firing var is one...
usr << "This cannot be done."
return
if(usr.monkey) // If the mob's firing var is one...
usr << "This cannot be done."
return
else // If the firing var isn't 1...
usr.firing = 1 // Sets the firing var to 1, so he cant fire another beam
usr.move = 0 // Disables the mob's movement
usr.icon_state = "shoot" // Sets the mob's icon_state
usr.Beam() // Calls the Beam() proc
proc
Beam()
var/obj/Head = new/obj/Beams/Head() // Creates the Beam's Head
var/ki_damage = round(usr.powerlevel_max * 0.05)
var/ki_cost = round(src.ki_max * 0.05)
if(src.ki >= ki_cost)
if(!src.doing)
src.doing = 1
src.ki -= ki_cost
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 = 10 // 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 // Sets the Head's owner to the mob
while(H)
step(H,H.dir)
if(!H)break
var/turf/T = H.loc
if(T.density)
del(H)
break
for(var/mob/M as mob in T)
var/ki_absorbed = round(M.ki_shield_strength - ki_damage)
if(M == src)
continue
if(!M.dead && !M.safe)
if(M.ki_shield)
if(ki_absorbed >= 1)
src << "<font color = #00C3ED>[M]'s Ki Shield Absorbs the attacks damage!"
M << "<font color = #00C3ED>Your Ki Shield Absorbs [src]'s Attack!"
for(var/mob/M2 in view(3))
if(M2 != M && !M2.safe)
M2 << "\red [src.name]'s Kamehameha explosion hurts you"
M2.powerlevel -= round(ki_damage)
M2.KIDEATH()
M.powerlevel -= round(ki_absorbed)
M.ki_shield_strength -= round(ki_damage)
M.KIDEATH()
src.doing = 0
src.frozen = 0
return
else
usr << "\red [src]'s Kamehameha slams into you!"
src <<"\red Your Kamehameha slams into [M]!"
for(var/mob/M2 in view(3))
if(M2 != M && !M2.safe)
M2 << "\red [src.name]'s Kamehameha explosion hurts you"
M2.powerlevel -= round(ki_damage)
M2.KIDEATH()
M.powerlevel -= round(ki_absorbed)
M.ki_shield_strength -= round(ki_damage)
M.KIDEATH()
src.doing = 0
src.frozen = 0
return
M << "\red [src.name]'s Kamehameha slams into you"
for(var/mob/M2 in view(3))
if(M2 != M && !M2.safe)
M << "\red [src.name]'s Kamehameha explosion hurts you"
M2.powerlevel -= round(ki_damage)
M2.KIDEATH()
M.powerlevel -= ki_damage
M.KIDEATH()
del(H)
sleep(1)
Code 2:
mob/learn/
verb
Kamehameha()
set category = "Techniques"
if(usr.doing)
src << "You are already doing something!"
return
if(usr.buku)
return
if(usr.dead)
return
if(usr.monkey == 1)
usr << "<font size = -1><B>You cannot use this technique while in the form of a Oozaru!"
return
if(usr.ki_lock)
src << "Cannot use this Technique at his time"
return
Kamehameha_Shoot()
src.afk_time = 0
mob
proc
Kamehameha_Shoot()
var/obj/H = new/obj/Kamehameha
var/ki_damage = round(usr.powerlevel_max * 0.05)
var/ki_cost = round(src.ki_max * 0.05)
if(src.ki >= ki_cost)
if(!src.doing)
src.doing = 1
src.ki -= ki_cost
src.overlays += kamehameha_charge
view(6) << "<font color = white>[src]:</font> Ka..."
sleep(8)
view(6) << "<font color = white>[src]:</font> Me..."
sleep(8)
view(6) << "<font color = white>[src]:</font> Ha..."
sleep(8)
view(6) << "<font color = white>[src]:</font> ME..."
sleep(8)
view(6) << "<font color = white>[src]:</font> HA!!!"
src.overlays -= kamehameha_charge
spawn(5) src.doing = 0
spawn(5) src.frozen = 0
if(!H)return
H.dir = src.dir
H.loc = src.loc
while(H)
step(H,H.dir)
if(!H)break
var/turf/T = H.loc
if(T.density)
del(H)
break
for(var/mob/M as mob in T)
var/ki_absorbed = round(M.ki_shield_strength - ki_damage)
if(M == src)
continue
if(!M.dead && !M.safe)
if(M.ki_shield)
if(ki_absorbed >= 1)
src << "<font color = #00C3ED>[M]'s Ki Shield Absorbs the attacks damage!"
M << "<font color = #00C3ED>Your Ki Shield Absorbs [src]'s Attack!"
for(var/mob/M2 in view(3))
if(M2 != M && !M2.safe)
M2 << "\red [src.name]'s Kamehameha explosion hurts you"
M2.powerlevel -= round(ki_damage)
M2.KIDEATH()
M.powerlevel -= round(ki_absorbed)
M.ki_shield_strength -= round(ki_damage)
M.KIDEATH()
src.doing = 0
src.frozen = 0
return
else
usr << "\red [src]'s Kamehameha slams into you!"
src <<"\red Your Kamehameha slams into [M]!"
for(var/mob/M2 in view(3))
if(M2 != M && !M2.safe)
M2 << "\red [src.name]'s Kamehameha explosion hurts you"
M2.powerlevel -= round(ki_damage)
M2.KIDEATH()
M.powerlevel -= round(ki_absorbed)
M.ki_shield_strength -= round(ki_damage)
M.KIDEATH()
src.doing = 0
src.frozen = 0
return
M << "\red [src.name]'s Kamehameha slams into you"
for(var/mob/M2 in view(3))
if(M2 != M && !M2.safe)
M << "\red [src.name]'s Kamehameha explosion hurts you"
M2.powerlevel -= round(ki_damage)
M2.KIDEATH()
M.powerlevel -= ki_damage
M.KIDEATH()
del(H)
sleep(1)
obj/Kamehameha
icon = 'Kamehameha.dmi'
Problem description:
im trying to use code 1 I added the vars from code 2,but ended up with lots of errors can someone please correct me(btw the errors are inconstant indentations)thier werent any errors til I added the
while(H)
step(H,H.dir)
if(!H)break
var/turf/T = H.loc
if(T.density)
del(H)
break
for(var/mob/M as mob in T)
var/ki_absorbed = round(M.ki_shield_strength - ki_damage)
if(M == src)
continue
if(!M.dead && !M.safe)
if(M.ki_shield)
if(ki_absorbed >= 1)
src << "<font color = #00C3ED>[M]'s Ki Shield Absorbs the attacks damage!"
M << "<font color = #00C3ED>Your Ki Shield Absorbs [src]'s Attack!"
for(var/mob/M2 in view(3))
if(M2 != M && !M2.safe)
M2 << "\red [src.name]'s Kamehameha explosion hurts you"
M2.powerlevel -= round(ki_damage)
M2.KIDEATH()
M.powerlevel -= round(ki_absorbed)
M.ki_shield_strength -= round(ki_damage)
M.KIDEATH()
src.doing = 0
src.frozen = 0
return
else
usr << "\red [src]'s Kamehameha slams into you!"
src <<"\red Your Kamehameha slams into [M]!"
for(var/mob/M2 in view(3))
if(M2 != M && !M2.safe)
M2 << "\red [src.name]'s Kamehameha explosion hurts you"
M2.powerlevel -= round(ki_damage)
M2.KIDEATH()
M.powerlevel -= round(ki_absorbed)
M.ki_shield_strength -= round(ki_damage)
M.KIDEATH()
src.doing = 0
src.frozen = 0
return
M << "\red [src.name]'s Kamehameha slams into you"
for(var/mob/M2 in view(3))
if(M2 != M && !M2.safe)
M << "\red [src.name]'s Kamehameha explosion hurts you"
M2.powerlevel -= round(ki_damage)
M2.KIDEATH()
M.powerlevel -= ki_damage
M.KIDEATH()
del(H)
sleep(1)