Programs

Posted by Alkarindil on Thu 21 Jun 2007 02:13 AM — 9 posts, 41,829 views.

Brazil #0
I am thinking in how to make a program to lead the mob to another room in a date and time, without the mob get lost.

For example, I found this code:

time_prog 22
yawn
emote lies down
sleep

This makes the mob sleep at 22h, right?
I can make the mob go east at 22h and then sleep in a bed, right?
The problem is: if some player uses a charm spell to force the mob out of the room, how do I make the program examine the room where the mob is and lead the mob to the right place?

Thanks in advance!
USA #1
Use mpgoto and a room echo. Wont matter where in the world the mob is at the appointed time, he'll end up in his bed like he's supposed to be.
USA #2
There is no way for the prog to navigate the mob to the right room, unless you coding something new in (such as moving based on the track code).
USA #3
Series of goto commands "navigates" just fine, Ive used the trick a number of times myself.
USA #4
I don't consider that navigating. :P I meant moving (north/west/etc).
#5
SMAUG 1.8 has a "MPHUNT" command that lets an NPC track a player or NPC, then attack on sight...

Maybe something like this....

guard james(vnum #1) - stationed at "East Gate", (vnum #100)
gilbert_rat (vnum #2) -

At time 22, James want to go to bed, in his barrack (vnum #130).


>time_prog 22
mpat 130 mpmload 2 1
mphunt gilbert_rat

>entry_prog 100
if mobinroom(gilbert_rat) == 1
mppeace $i
say Home sweet home...
say Hello there buddy...
sleep
endif


USA #6
I wonder if you could combine mphunt and the pacifist flag to make is more simple, so that it doesn't attack.
#7
Pacifist flags on either/both NPCs will not start a fight, but the "hunting" NPC will still be stuck in a fighting "mode".

(If you "if isfight($i)", it will return true).

With MPPEACE, the fighting is suppressed immediately, so the fight won't start at all.
USA #8
Ah, I didn't think the mppeace would work in time before a few hits got in.