Rand prog, non-aggro attacking when lacking an item

For builders to discuss and ask building questions.
Post Reply
User avatar
Myn
Sword Apprentice
Sword Apprentice
Posts: 92
Joined: Mon Aug 04, 2003 3:23 pm
Location: Zhentil Keep

Rand prog, non-aggro attacking when lacking an item

Post by Myn » Wed Aug 10, 2016 5:07 am

I've been struggling with figuring if/how this might work, so I am hoping someone might have some insight. The scenario is this:

I have mobs that are set to be not aggressive. They are supposed to turn aggressive on any char who is not wearing an object (118235). I am able to get them to behave properly when walking into a room with the mobs, however I would ideally like to have a catch if a player was say invis/hiding/teleported in to make the mob attack or not depending on if they have said object. Below is what I have, but doesn't work as they attack even when wearing the object. I'm assuming it has to do with the if actorhasobjnum not checking against the PC, but I can't find a way to aim it. I added the if ispc($r) hoping, maybe it would guide the check but wasn't surprised when it didn't.

Code: Select all

>rand_prog 50~
if ispc($r)
and position($i) != 8 
  if actorhasobjnum(118235)
    get all.coin    
  else
    kill $r
  endif
endif
~
User avatar
Harroghty
Staff
Staff
Posts: 9695
Joined: Tue Jul 27, 2004 5:38 pm

Re: Rand prog, non-aggro attacking when lacking an item

Post by Harroghty » Wed Aug 10, 2016 12:18 pm

What about an intercept program on the vis command? Rand programs can be tricky.
"A man may die yet still endure if his work enters the greater work, for time is carried upon a current of forgotten deeds, and events of great moment are but the culmination of a single carefully placed thought." - Chime of Eons
User avatar
Myn
Sword Apprentice
Sword Apprentice
Posts: 92
Joined: Mon Aug 04, 2003 3:23 pm
Location: Zhentil Keep

Re: Rand prog, non-aggro attacking when lacking an item

Post by Myn » Wed Aug 10, 2016 3:56 pm

That seems like a pretty good work around. Thanks!
Post Reply