ID:266229
Sep 30 2001, 5:21 pm
|
|
how do i stop mobs from attacking npcs, like shopkeepers or something....
|
In response to sapphiremagus
|
|
sapphiremagus wrote:
I would imagine that one could do it by adding a variable to mobs in general ( I assume that your NPCs are mobs) called no_attack and initialize it to 0 (false). > if (!no_attack) > attack() > else > usr >> "You cant attack a shop keeper!!" > I realize that this is a very basic idea and needs refinement, but the general idea is there for you to work with. Hope it helps =) A more common way is to use if(istype()) |
In response to Nadrew
|
|
Nadrew wrote:
A more common way is to use if(istype()) This will produce countless lines of if(istype(M,/mob/blahblah)) when you have lots of mobs. It has the answer in the FAQ, please read the section on it, its easy to find. Alathon |
Set it to 1 (true) for your NPCs.
In your attack code, make it check to see if no_attack is true, for example:
I realize that this is a very basic idea and needs refinement, but the general idea is there for you to work with. Hope it helps =)