mob/cop
icon = 'copper.dmi'
TakeAction()
var/action_taken
// Before moving, the cops see if there is someone to arrest within 1 space.
for (var/mob/other_mob in oview(1, src))
// Don't arrest if it's an innocent pc, npc or another cop
if (wanted == "NO" ||(istype(other_mob, /mob/npc ) || istype(other_mob, /mob/cop )))
continue
Arrest(other_mob)
action_taken = 1
// No one to attack, so see if a non-cop is within 3 spaces to move towards.
for (var/mob/other_mob in oview(3, src))
if (wanted == "NO" ||(istype(other_mob, /mob/npc ) || istype(other_mob, /mob/cop )) )
continue
view(src) << "[src] is going after [other_mob]!"
step_towards(src, other_mob)
action_taken = 1
if (action_taken)
return
// No one around, do default behavior.
..()
<dm>
Ive tried usr.wanted and other ideas but to no avail.
the problem is in this part:
if (wanted == "NO" ...etc
mob/pc/musician
class = "musician"
icon = 'player mobs.dmi'
icon_state = "musician_m"
maxhp = 50
hp = 50
show = 10
gold = 10
wanted = "NO"
ID:166808
Jun 13 2006, 3:02 am
|
|
my cops dont arrest the npc's or the other cops, but whether I'm innocent or not they arrest me. I have a variable wanted which is YES or NO but when I call it in the script it is not taken in account
|
In response to TheLunarWolf
|
|
Thanks, in fact whilst changing all the NO s into zeros, I found a 'no' which was my problem.
Clearly, I must write down all my variables more clearly, maybe on a bit of paper next to my computer. |
In response to Eurobusker
|
|
no problem, glad I could help.
|
In response to TheLunarWolf
|
|
actually it dont work.
|
In response to Eurobusker
|
|
what errors are you getting?
|
In response to TheLunarWolf
|
|
Indeed. Being as clear as possible is important if you want help, Eurobusker. =)
O-matic |
> mob/cop 'wanted' refers to src. other_mob.wanted refers to the other_mob's wanted variable. Going into a for() loop doesn't change src to other_mob. |
In response to Alathon
|
|
COOL that works! youre right, of course "other_mob.wanted" will refer to my player at each cycle. thank you very much
|
That should fix it but I'm not in a position to test it right now - don't have BYOND installed in cybercafes :(
also to close dm use /dm