Targeting $r in a program

For builders to discuss and ask building questions.
Post Reply
Nylo
Sword Grand Master
Sword Grand Master
Posts: 447
Joined: Tue Jul 26, 2011 7:15 pm
Location: Ohio, USA

Targeting $r in a program

Post by Nylo » Sun Jan 20, 2013 7:35 pm

Question!

In the following prog, for instance.

Code: Select all

>fight_prog 10~
mpecho Something happens to $r!
cast 'random spell' $r
mptransfer $r 0000
~
Can I make it first, randomly pick a PC in the room, then have it use that PC as the target for the rest of the actions? Or does $r already do this? I couldn't find anywhere in the helpfile explaining it.
Nylo, Fighter of Tempus
Anver, Transmuter of Garl
Malic, Cleric of Tyr
Luthir, Druid of Mielikki
User avatar
Harroghty
Staff
Staff
Posts: 9695
Joined: Tue Jul 27, 2004 5:38 pm

Re: Targeting $r in a program

Post by Harroghty » Sun Jan 20, 2013 9:33 pm

I believe that you would be better served in this case with a random prog (which is the only time to use $r). So something like this....

Code: Select all

>rand_prog 10~
if position($i) == 8
  mpcast spell $r
endif
~
But note that you may be better served by mpaffect paired with an echo. This program triggers 10% of the time; it checks first that the mobile is fighting, and then it casts a spell at a random target in that room.
"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
Nylo
Sword Grand Master
Sword Grand Master
Posts: 447
Joined: Tue Jul 26, 2011 7:15 pm
Location: Ohio, USA

Re: Targeting $r in a program

Post by Nylo » Mon Jan 21, 2013 1:37 am

So in the rand_prog, when I target $r, if I perform multiple actions in that prog, will it target the same PC each time? With mpecho, mpaffect, and any others?
Nylo, Fighter of Tempus
Anver, Transmuter of Garl
Malic, Cleric of Tyr
Luthir, Druid of Mielikki
User avatar
Harroghty
Staff
Staff
Posts: 9695
Joined: Tue Jul 27, 2004 5:38 pm

Re: Targeting $r in a program

Post by Harroghty » Mon Jan 21, 2013 3:03 am

Yes, it will target only one PC each time, but it might target several PCs during one combat as it triggers potentially more than once.
"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
Nylo
Sword Grand Master
Sword Grand Master
Posts: 447
Joined: Tue Jul 26, 2011 7:15 pm
Location: Ohio, USA

Re: Targeting $r in a program

Post by Nylo » Mon Jan 21, 2013 3:11 am

That's exactly what I want it to do. Thank you!
Nylo, Fighter of Tempus
Anver, Transmuter of Garl
Malic, Cleric of Tyr
Luthir, Druid of Mielikki
Post Reply