ID:2301396
 
(See the best response by Klogaum.)
Code:
    proc
BurnEffect()
var/GAME_MOB/P = usr
usr << "TESTTTT!"
src.overlays += 'Art/Jutsus/BurnEffect.dmi'
src << "Only a test!."
burn_dmg = round(25) + round(P.ninjutsu/1.255)
src.health -= burn_dmg
spawn(100)
src.overlays -='Art/Jutsus/BurnEffect.dmi'


Problem description:

Im trying to make a burn effect when i shout my technique the overlays work fine but the damage and the text doesnt work can you help me so i can learn from my error. (i want that the effect do like exemple 25 damage each 4 second and when the spawn(100) come the effect stop. )
Best response
proc/Burn(mob/A,mob/B,TIME=0,hittime=5)
spawn(-1)
A << "[B] HIT YOU";B << "YOU HIT [A]!"
A.overlays += 'Art/Jutsus/BurnEffect.dmi'
for(var/a=1 to TIME)
if(a%hittime==0)
var/burn_dmg=round(25) + round(B.ninjutsu/1.255)
A.health-=burn_dmg
sleep(1)
A.overlays -='Art/Jutsus/BurnEffect.dmi'

proc/Burn(mob/A,mob/B,TIME=0,hittime=5,enterhit=0)
spawn(-1)
A << "[B] HIT YOU"
B << "YOU HIT [A]!"
A.overlays += 'Art/Jutsus/BurnEffect.dmi'
if(enterhit){sleep(enterhit);var/dmg=round(25)+round(B.ninjutsu/1.255);A.health-=dmg}
for(var/a=1 to TIME)
if(a%hittime==0)
var/dmg=round(25) + round(B.ninjutsu/1.255);A.health-=dmg
sleep(1)
A.overlays -='Art/Jutsus/BurnEffect.dmi'

proc/Burn(mob/A,mob/B,TIME=0,hittime=5,enterhit=0)spawn(-1){
A<<"[B] HIT YOU";B<<"YOU HIT [A]!"
A.overlays+='Art/Jutsus/BurnEffect.dmi'
if(enterhit){sleep(enterwithhit);var/dmg=round(25)+round(B.ninjutsu/1.255);A.health-=dmg}
for(var/a=1 to TIME)
if(a%hittime==0)var/dmg=round(25)+round(B.ninjutsu/1.255);A.health-=dmg;
sleep(1)
A.overlays -='Art/Jutsus/BurnEffect.dmi'}
For the second code I got B and A unrefined car so I just need to create a var?
I do not understand abbreviated English
You have many ways to the end
Confirm the doubt again
mob/verb/Flames()
for(var/mob/M in get_step(usr,dir))Burn(M,usr)

mob/verb/Flames()
var/mob/M=locate(/mob/) in get_step(usr,dir)
if(M)Burn(M,usr)
Sorry it my auto corrector I mean I got error. B.ninjutsu undefined var and A.ninjutsu undefined var
Check out Effectlib. It's a much cleaner, safer way to do this.

http://www.byond.com/developer/Ter13/EffectLib


You just need to follow the documentation for implementation of new temporary combat effects.

In this case, we want a ticker effect, so we set a duration and a tick_delay. We also need it to show the overlay when the effect is added, and remove the overlay when removed. Last, we need to have the user take damage every few seconds.

Effectlib includes easy hooks functions you can override.

effect
burn
duration = 300
tick_delay = 40

var
power = 0

Added(mob/target,time)
target.overlays += 'Art/Jutsus/BurnEffect.dmi'

Removed(mob/target,time)
target.overlays -= 'Art/Jutsus/BurnEffect.dmi'

Ticked(mob/target,tick,time)
target.health -= power



Last, we just need to actually create the effect we just defined and add it to a target. You'll want to do something like this in your code.

var/effect/burn/e = new/effect/burn
e.power = round(25 + user.ninjutsu/1.255)
e.Add(target)


Check out this thread for further documentation on how to use EffectLib. It was written exactly for this kind of thing.

http://www.byond.com/forum/?post=2286256
It may happen that your variable is something beyond
mob/var
health=10
mob/Player/var
taijutsu=10
nin=10
gen=10
mob/Monster/var
Dmg1=10
Dmg2=10
Ter after use it deletes itself, right?
del e <- you do not need that
In response to Klogaum
Klogaum wrote:
Ter after use it deletes itself, right?
del e <- you do not need that

I rely on garbage collection. My references should be managed properly. If you don't manage your references, that's on you. I'd prefer not to call del unless it's totally unavoidable.
Thanks you for the help it really appreciate:) !!
Garbage collection.

I always knew it existed, but now I'm sure it was worth it.