ID:155369
 
1. How do I get my player to have full health when he re spawns after being killed (Yes I know this is a very simple fix but i just spent the last few hours working on a npc attack and respawn code)
2. How do i set up a code for health regen if the player is not fighting
3. How do I factor in defense when facing enemys
1. Depends on how your Health var is stored. If it's in a datum, a simple Max() proc resetting the value works.

2. You'd have a timer that you spawn when the player attacks. WHILE the timer is active, you'd count down, after it's done, you start to regenerate

3. You have to code it to be considered in the attack code.
In response to Lugia319
Ok I got the health thing fixed with this
src.health = maxhealth

Thank you for the help Lugia319
In response to Wrath69
I am going to recommend using datums for stats like that. See
http://www.byond.com/members/ DreamMakers?command=view_post&post=35530
In response to Lugia319
On the defense thing I have it coded in and everything but when i have the item that grants defense equiped it will say the following

Monster2 attacks Test for -58 damage! then it will add hp so how would I go about fixing this issue would i use something like
damage -= M.defence / 2

In response to Wrath69
Do an if statement. If you do less than 0 damage, then set it equal to 0.
In response to Lugia319
ok im workin with this defence thing and I came up with this

if(def<=0)
def=0
view<< "[M]'s attack misses you!"
but it comes up with a missing expression error any tips
In response to Wrath69
You need to tab the statements after the if