ID:179399
 
Would anyone be able to help me create a code that would stop attacking or fighting in an area called "Safe". This is intended so that people cant get killed in certain areas because say a monster came from the north hemisphere to the starting location all the new players would more than likely get killed. Which in turn will most likely make them hate the game.

So to make things better I would like to know how I would go about making a safe area so that monsters cant attack players in the safe areas and so that the players cant kill other players in these safe areas too.

Thanks for any help,

Lee
Try checking the area that the person who is being attacked is standing on(the area is almost alwease loc.loc). Mayby something like this


/area/
var/safe = 0

mob/verb/attack(M as mob in orange(2))
var/area/a = loc.loc
if(!a) return 0 // incase the player is at null loc
if(a.safe) return 0
else
// go ahead with the attack
In response to Alathon
Alathon wrote:
Try checking the area that the person who is being attacked is standing on(the area is almost alwease loc.loc). Mayby something like this


/area/
var/safe = 0

mob/verb/attack(M as mob in orange(2))
var/area/a = loc.loc
if(!a) return 0 // incase the player is at null loc
if(a.safe) return 0
else
// go ahead with the attack

Thanks, I will try that.