ID:143586
 
how do i make my beam do damage on someone


i want it so the beam does damage according to how much Str u have compared to the def the other guy has. Like if u have 100 str and he has 50 def u hit 50 damage on him if u have 200 str and he has 50 def u hit 150 damage on him

here are my vars

mob
var/Str = 5
var/Def = 5
var/maxHp = 100
var/Endurance = 5
var/Hp= 100
var/wealth=100
var/maxStr=5
var/Level=1
var/Rank="Starter"
var/inventory[0]


this is the hole beam code so just narrow it down if u need too



obj/projectile
icon = 'projectiles.dmi'
density = 1
var
delay = 2

length=20
dmg=2
splash
mob/owner
New(_loc,mob/_owner)

if(_owner)
src.dir = _owner.dir
if(!src.loc) src.loc = get_step(_owner,_owner.dir)
src.owner = _owner
Move()
src.length--
if(!src.length) del src
return ..()
Bump(atom/O)
if(ismob(O))

viewers(O) << "[src.owner] has hit [O:name] with \his [src]!"
else if(isobj(O)) del O
else if(isturf(O))

del src
Kurosaki_power
icon_state = "energyball"
delay = 1
dmg=100
Final_Strike
icon_state = "bigbang"
delay = 3
dmg=5
splash=5
beam
var
list/trails = new
max_trails = 0

New()
..()
src.icon_state = "[src.icon_state]head"

Del()
for(var/A in src.trails) del A
..()
Move()
var/turf/old_loc = src.loc
. = ..()
if(!.) return

var/obj/O = new(old_loc)
O.name = "trail"
O.dir = src.dir
O.icon = icon(src.icon,"[initial(src.icon_state)]trail")
src.trails += O
if(src.max_trails && src.trails.len > src.max_trails)
var/a = src.trails[1]
src.trails -= a
del a
Blue_Blast
icon_state = "ka_"
dmg=3
splash=2
EnergyBeam
icon_state = "energybeam_"
max_trails = 5
Blue_Blast1
icon_state = "poo"
dmg=3
splash=2
verb
Kurosaki_power()
set category = "Shoot"
var/obj/projectile/Kurosaki_power/P = new(null,usr)
walk(P,P.dir,P.delay)
Final_Strike()
set category = "Shoot"
var/obj/projectile/Final_Strike/P = new(null,usr)
walk(P,P.dir,P.delay)
Blue_Blast()
set category = "Shoot"
var/obj/projectile/beam/Blue_Blast/P = new(null,usr)
walk(P,P.dir,P.delay)
Blue_Blast1()
set category = "Shoot"
var/obj/projectile/beam/Blue_Blast1/P = new(null,usr)
walk(P,P.dir,P.delay)
EnergyBeam()
set category = "Shoot"
var/obj/projectile/beam/EnergyBeam/P = new(null,usr)
walk(P,P.dir,P.delay)

hmm maybe cause under the bump u didint put like say

try this just fix the vars
      Bump(mob/M)//when the obj bumps into a mob
var/damage = 10//sets the damage to 10
M.Health -= damage//damages the mob it bumps into
In response to Trane5
i dunno where to put it can u put it into the hole code then send it
In response to Agrey123
just paste it over ur bump verb simple
In response to Trane5
it says incositstant indentation plz try to add it for me
In response to Agrey123
as I got it he want to know the atk vs def code O.o

It should look something like this:

"damage = Str - M.Def"