mob prog - how to activate only if a PC is in room

For builders to discuss and ask building questions.
Post Reply
Nedylene
Sword Grand Master
Sword Grand Master
Posts: 517
Joined: Mon Aug 25, 2003 2:00 am
Location: Zhentil Keep

mob prog - how to activate only if a PC is in room

Post by Nedylene » Tue Apr 17, 2007 6:49 pm

On my time away from the mud I have been spending time building and muddling through it myself. While working with wizinvis mobs that load up certain mobiles, food etc for quests I have a dungeon in the area for the crime code.

There is an if check for if in room, does this check if the MOBILE is in said room or if the PC is in said room?

If this checks that the MOBILE is in said room, how can you make the program only activate IF the PC is in the room?

The program I am trying to put on the mobile is a program that loads up breakfast at 7am and dinner at 21pm ONLY if the PC is in the dungeon. How can we accomplish this?

More questions to come, wanted to keep them seperate for easy searches =)
Dalvyn
Sword Grand Master
Sword Grand Master
Posts: 4708
Joined: Tue Jul 15, 2003 9:26 pm
Location: House of Wonder, Waterdeep

Post by Dalvyn » Tue Apr 17, 2007 11:06 pm

You would most likely have to use a time_prog (to make it trigger at a given time), or actually two time_prog, one for each hour.

Then, in the program, you could use a pcinroom check. I do not remember the exact syntax (nor the exact name of the check - so it might be a bit different from "pcinroom"), but you'll find it in the web lessons. This check indicates how many PCs are in the room. If that value is > 0, then there is at least one PC, and you can bring in breakfast.
Nedylene
Sword Grand Master
Sword Grand Master
Posts: 517
Joined: Mon Aug 25, 2003 2:00 am
Location: Zhentil Keep

Post by Nedylene » Tue Apr 17, 2007 11:08 pm

I don't suppose I could convince you to post the feed prog from the waterdeep dungeon as example? *goes off to reread the building lessons*
User avatar
Japcil
Sword Grand Master
Sword Grand Master
Posts: 1143
Joined: Fri Jun 17, 2005 5:32 pm
Location: Golden Oaks
Contact:

Post by Japcil » Wed Apr 18, 2007 5:13 am

all the feed prog really is:

Code: Select all

time_prog -1
mpoload ifood
mpecho Someone shoves food from a slit in the cage.
drop ifood
a better one would be:

Code: Select all

time _prog -1
if ovnumhere (ifood) < 1
  mpoload ifood
  mpecho Someone shoves food from a slit in the cage
  drop ifood
endif
Last edited by Japcil on Wed Apr 18, 2007 5:28 pm, edited 1 time in total.
Image
Dalvyn
Sword Grand Master
Sword Grand Master
Posts: 4708
Joined: Tue Jul 15, 2003 9:26 pm
Location: House of Wonder, Waterdeep

Post by Dalvyn » Wed Apr 18, 2007 2:57 pm

An even better one would use the correct form "drop" instead of "mpdrop". ;)

Note that the feed program above triggers on each hour (that's what time_prog -1 means) and that the second version above will only load a new food item if there is none on the ground.
User avatar
Japcil
Sword Grand Master
Sword Grand Master
Posts: 1143
Joined: Fri Jun 17, 2005 5:32 pm
Location: Golden Oaks
Contact:

Post by Japcil » Wed Apr 18, 2007 5:28 pm

Eeep. Edited! :oops:
Image
Post Reply