ID:144811
 
Code:
    var
lifecycle_delay = 10
movement_probability = 50
dam2=0
amt=0
spd=0
spd2=0


Move()
if (isDead())
return 0
return ..()

proc
Attack(mob/attacker)
if(istype(src, /mob/other))
usr << "<font color=red>You Cant"
else
if(src.npp == 0|1)
attacker.amt = attacker.strength
src.amt = src.Defense
// flick("attack",attacker)
attacker.amt -= src.amt
if(attacker.amt >= 0)
attacker.dam2 = attacker.amt
attacker.spd = attacker.Speed
src.spd = src.Speed
src.spd -= attacker.spd
if(src.spd >= 10 && src.spd <= 100)
attacker.random = rand(1,25)
if(attacker.random == 2)
view(6)<<"<font color = blue>[attacker.name] trys to punch [src] but misses</font>"
flick("attack",attacker)
if(attacker.random == 10)
view(6)<<"<font color = blue>[attacker.name] trys to punch [src] but barly hits</font>"
flick("attack",attacker)
attacker.dam2 /= 2
src.powerlevel -= attacker.dam2
else
view(6)<<"<font color = blue>[attacker.name] punches [src] in the face</font>"
flick("attack",attacker)
src.powerlevel -= attacker.dam2
if(src.spd >= 100 && src.spd <= 1000)
attacker.random = rand(1,15)
if(attacker.random == 2)
view(6)<<"<font color = blue>[attacker.name] trys to kick [src] but misses</font>"
flick("attack",attacker)
if(attacker.random == 10)
view(6)<<"<font color = blue>[attacker.name] trys to kick [src] and almost misses</font>"
flick("attack",attacker)
attacker.dam2 /= 2
src.powerlevel -= attacker.dam2
else
view(6)<<"<font color = blue>[attacker.name] kicks [src] on the arm</font>"
flick("attack",attacker)
src.powerlevel -= attacker.dam2
if(src.spd >= 1000 && src.spd <= 10000)
attacker.random = rand(1,10)
if(attacker.random == 2)
view(6)<<"<font color = blue>[attacker.name] trys to punch [src] but misses</font>"
flick("attack",attacker)
if(attacker.random == 10)
view(6)<<"<font color = blue>[attacker.name] trys to punch [src] but barely touches him</font>"
flick("attack",attacker)
attacker.dam2 /= 2
src.powerlevel -= attacker.dam2
else
view(6)<<"<font color = blue>[attacker.name] punches [src] in the stomach</font>"
flick("attack",attacker)
src.powerlevel -= attacker.dam2
if(src.spd >= 10000)
attacker.random = rand(1,3)
if(attacker.random == 2)
view(6)<<"<font color = blue>[attacker.name] trys to kick [src] but misses</font>"
flick("attack",attacker)
if(attacker.random == 3)
view(6)<<"<font color = blue>[attacker.name] trys to kick [src] in the face but misses and hits the arm</font>"
flick("attack",attacker)
attacker.dam2 /= 2
src.powerlevel -= attacker.dam2
else
view(6)<<"<font color = blue>[attacker.name] kicks [src] in the face</font>"
flick("attack",attacker)
src.powerlevel -= attacker.dam2
src.Die()


Problem description:im getting the runtime error

runtime error: Cannot read null.strength
proc name: Attack (/mob/proc/Attack)
source file: battle_system.dm,22
usr: Seam (/mob/characters/saiyajin)
src: Seam (/mob/characters/saiyajin)
call stack:
Seam (/mob/characters/saiyajin): Attack(null)
Seam (/mob/characters/saiyajin): Attack(the saibaman


You're not calling the proc correctly. From the looks of it, you need to call it in this form: Person_Attacked.Attack(Person_Attacking). Show us the bit that actually calls this proc.
In response to DeathAwaitsU
DeathAwaitsU wrote:
You're not calling the proc correctly. From the looks of it, you need to call it in this form: Person_Attacked.Attack(Person_Attacking). Show us the bit that actually calls this proc.

were would i put it like that?
In response to Seam
Understand that "usr" is the atom calling the verb/proc and src is the atom containing the verb/proc.

Incorrect:

mob
verb
Kill(M as mob)
if(istype(M, /mob/other))
Attack(usr) // Incorrect
else
usr << "<font color=red>You Cant"


This is incorrect because passing "usr" into the proc causes "M" (our target) to be overlooked.

Correct:

mob
verb
Kill(M as mob)
if(istype(M, /mob/other))
Attack(M) //M instead of usr
else
usr << "<font color=red>You Cant"


Once you pass the target into Attack() you can use "usr" as the atacker since the player is the one who called the Attack() proc via the Kill() verb.

mob
verb
Kill(M as mob)
if(istype(M, /mob/other))
Attack(M)
else
usr << "<font color=red>You Cant"



proc
Attack(Target)
if(Target.npp == 0|1)
usr.amt = usr.strength
Target.amt = Target.Defense
usr.amt -= Target.amt


If you have the "monster" (/mob/other) attacking the player, then the monster becomes "usr" and the player becomes the target.
In response to JohnEM
To Quote Lummox JR:
"No put usr in procs.Ungh!"

So you may want to fix that.
Possibly if you did this:
mob
verb
Kill(M as mob)
if(istype(M, /mob/other))
Attack(usr,M) //the arguments
else
usr << "<font color=red>You Cant</font>" //don't forget to close your tags

proc
Attack(mob/M,mob/Target) //Its important that it knows they're both mobs
if(Target.npp == 0|1)
M.amt = M.strength
Target.amt = Target.Defense
M.amt -= Target.amt


~Hellsing4
In response to Hellsing4
Thank's for the fix...It still would have worked but, that was not proper coding. Good call.
In response to Hellsing4
Code:
mob
verb
Kill(M as mob)
set src in oview(1)
set category = "Fighting"
set name = "Attack"
if(!istype(M, /mob/other))
Attack(usr,M) //the arguments
else
usr << "<font color=red>You Cant</font>" //don't forget to close your tags

proc
Attack(mob/M,mob/Target) //Its important that it knows they're both mobs
if(Target.npp == 0|1)
M.amt = M.strength
Target.amt = Target.Defense
// flick("attack",attacker)
M.amt -= Target.amt
M.random = rand(1,25)
if(M.random == 2)
view(6)<<"<font color = blue>[M] trys to punch [Target] but misses</font>"
flick("attack",M)
if(M.random == 10)
view(6)<<"<font color = blue>[M] trys to punch [Target] but barly hits</font>"
flick("attack",M)
Target.dam2 /= 2
Target.powerlevel -= M.dam2
else
view(6)<<"<font color = blue>[M] punches [Target] in the face</font>"
flick("attack",M)
Target.powerlevel -= M.dam2
Target.Die()



runtime error: Cannot read null.npp
proc name: Attack (/mob/proc/Attack)
source file: mobs.dm,746

now im getting this =\