ID:1635115
 
Code:
mob
var/tmp
defense = 5
injuries = 0
MaxInjuries = 100
lvl = 1
str = 10
reiki = 10
youki = 100
Maxyouki = 100
stat_points = 0
dmg

mob
verb
Rest()
stun=1
if(usr.youki <= 150)
usr.youki += 10
sleep(10)
if(usr.youki <= 150)
usr.youki += 20
sleep(10)
if(usr.youki <= 150)
usr.youki += 20
if(usr.youki ==160)
usr.youki -= 10
stun=0
proc
Attack(mob/User, mob/Target, Type = "Str", Stat="injuries", Chance=100, Cure, Extra)
if(!prob(Chance))
switch(Type)
if("Str")
dmg = User.str - (Target.defense)
if("Reiki")
dmg = User.reiki - (Target.defense)
//If Extra has been set
if(Extra)
//Set Damage to [Extra]%
dmg = (dmg/100)*Extra

//If damage is lower than 0, set it to 0
dmg = max(0,dmg)

mob
Boxer
verb
Meele()
var/mob/M = locate(/mob) in get_step(src,src.dir)
if(M)
if(!usr.BMeeleCD)return
usr.BMeeleCD = FALSE
flick('Boxer.dmi',usr)// flick jab
flick("Jab",usr)// ^
Attack(usr,M,"Str","Injuries",100,0,100)
sleep(5)
usr.BMeeleCD = TRUE

//If Cure has been set
if(Cure)
//Change damage to a negative value
dmg *= -1
switch(Stat)
if("Injuries")
Target.injuries += dmg
if("Youki")
Target.youki += dmg
//If the Attack is to cure Target, output the following
if(Cure)
//If the User is the Target, and is also a Player
if(User == Target && User.client)
User << "You restore your [Stat] by [-dmg] points!"
//Otherwise
else
//If User is a Player
if(User.client)
User << "You restore [Target]'s [Stat] by [-dmg] points!"
//If Target is a Player
if(Target.client)
Target << "[User] restored your [Stat] by [-dmg] points!"

//If the Attck is to damage the Target, output this instead
else
if(User == Target && User.client)
User <<output( "You attack [Target] for [dmg] Damage using a [Type] attack!", "output1")
DeathCheck(User,Target)
else
if(User.client)
User <<output( "You attack [Target] for [dmg] Damage using a [Type] attack!", "output1")
DeathCheck(User,Target)
if(Target.client)
Target <<output( "[User] attacked you for [dmg] Damage using a [Type] attack!", "output1")
DeathCheck(User,Target)
proc
DeathCheck(mob/Attacker, mob/Attackee)
if(Attackee.injuries >= Attackee.MaxInjuries)
Attackee.injuries = 1
Attackee << "<b>You Died!</b>"
Attacker << "<b>You killed [Attackee]!<b>"
Attackee.loc=locate(1,1,1)
return 1
return 0


Problem description: no errors but injuries are not being added and dmg variable is also not being well its not working

Your if() statement is incorrect. You're asking it to return false when it should return true. I'd imagine there might also be errors with how you're calling usr instead of src

if(!prob(Chance))

It should be
if(prob(Chance))
when exactly do i use src
In response to YoungJR1232
You should use src when you need to reference whatever it is that called a function inside that function.
i was always confused on src or usr
In response to YoungJR1232
YoungJR1232 wrote:
i was always confused on src or usr

src for procs, usr for verbs.
thnx a bunch code is fixed
In response to Gokussj99
Gokussj99 wrote:
YoungJR1232 wrote:
i was always confused on src or usr

src for procs, usr for verbs.

You shouldn't do this at all. If you start using usr in all your verbs you're going to run into a lot of issues if you ever try to call one anywhere else in your code.
src meanign the source of whats using it and user is whats using it but if its a verb its usually usr as in user,

example
if its a normal player attached verb you may used usr meaning the user of the verb

if its a verb attached to an object you may use usr if you are talking about the person using ir but if you want to talk about the object you'd use src within it's code

if the verb is attached to a mob A and a mob B is using the verb src becomes the source of the verb which would be the mob A

if object A has a verb attached to it but a mob is using it
src is object A while usr is the mob

if a mob has a verb and they use it and its all theirs, src is the mob and usr is the mob. in this case it does not matter which one you use. you may use both but its better only one so you don't confuse yourself
In response to YoungJR1232
YoungJR1232 wrote:
i was always confused on src or usr

Check out this amazing write up of when to use what.
Dream Tutor: usr Unfriendly