ID:142618
 
Code:
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 = 'Beam.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(mob/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] !"
var/dmg = 500
M.Hp -= dmg
// 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
Fire() // Verb used for firing the beam
if(usr.firing) // 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
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 = 6 // 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 mo


Problem description:

Ok so, heres another issue i had, pro-jec-tiles. The king of coding. What i need to know is.. how do i add damage to it? i dont know where to put damage calcs and what to add for etc. if anyone can please fix that coding up there so that the attack is given a specific amount of damage to hit the monster(mob) and minus it from there Hp :) help is greatly appreciated
Agrey123 wrote:
Code:
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 = 'Beam.dmi'
> density = 1
> Head
> icon_state = "head"
> New()
> spawn(1) // Delay is abit...
\

solved
> 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(mob/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] !"
> var/dmg = 500
> M.Hp -= dmg
> // 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
> Fire() // Verb used for firing the beam
> if(usr.firing) // 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
> 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 = 6 // 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 mo
>

Problem description:

Ok so, heres another issue i had, pro-jec-tiles. The king of coding. What i need to know is.. how do i add damage to it? i dont know where to put damage calcs and what to add for etc. if anyone can please fix that coding up there so that the attack is given a specific amount of damage to hit the monster(mob) and minus it from there Hp :) help is greatly appreciated
Well a basic blast is like this:
obj/Projectile //The actual projectile object, which is any projectile in the game
var/Damage=0
Bump(mob/A)
if(ismob(A))
A.Health-=Damage
del(src)
obj/Blast //A simple blast attack
verb/Blast() if(!usr.blasting)
usr.blasting=1
var/obj/Projectile/A=new
A.Damage=usr.KiPowerorwhatever
A.dir=usr.dir
A.loc=get_step(usr,usr.dir)
walk(A,usr.dir,1)
spawn(2) usr.blasting=0 //Added a small delay since I know you probably dont want them just firing them instantly
mob/var/blasting
In response to Agrey123
if your basing it on str it should of been usr.str -= M.def and so on and so forth but i dont know what ur basing it on mp hp str def what