Full Version : Spawn Monster on Container Open
xmlspawner >>Q&A >>Spawn Monster on Container Open


<< Prev | Next >>

DrussRob- 01-27-2006
I looked through the docs and didnt find a reference to this.
Basically, the player opens the container to get at the items inside. When the container is dbl clicked to open it spawns a monster. I'm not gonna ask if this is possible, because I've learned by now that there isn't much this spawner can't do!

thx again smile.gif

ArteGordon- 01-27-2006
there are some examples of that kind of thing in xmlextras.

I think it is called chestguardian.xml

and there are some variants, chestguardian2.xml and chestguardian3.xml

You cant actually trigger on doubleclicking the chest using this approach because there is no property 'opened' like there is on doors, but what you can do is to trigger on the 'locked' property. Just test for it being false and then you can spawn when someone unlocks the chest.

It actually is possible to do the 'spawn-on-double-click' thing, but it involves adding an attachment that detects OnUse. That feature has to be enabled through an additional installation step. The locked approach is easier.

You can also just make a simple mod to add your own Opened property to containers and test on that. Here is a post on that approach
http://runuo.com/forums/showpost.php?p=364970&postcount=312

from xmlspawner2.txt

QUOTE

An example of using this feature is given in chestguardian2.xml in xmlextras.
In this example the guardian spawner is triggered by the property test (TriggerObjectProp)  "totalitems<1 | totalweight<20" which will lead to triggering of the chest guardian if anyone removes the pile of gold from the chest completely (leaving totalitems=0), or removes some of the gold, (reducing the totalweight to below 20).
Another example is given in chestguardian3.xml in xmlextras.
In this example the guardian spawner is triggered by the property test (TriggerObjectProp)  "totalitems>1 & totalweight>40" which will lead to triggering of the chest guardian if at least one additional item is added (totalitems>1), and the added items weigh enough to push the totalweight above 40.


QUOTE

Description of doorguardian.xml:
(note, after loading the example do a respawn on both to quickly set them up)
This uses two spawners. One spawns three doors, and the other spawns a mob that is triggered by opening one of the doors.  This is an example that
demonstrates how the SERIAL and GETONSPAWN keywords can be combined to set up self-configuring triggered spawners rather than having to explicitly
use targeting to select triggering objects.  The first spawner spawns 3 metal doors and makes them immovable. At the same time it sets the TriggerObject property on the second spawner (named DoorGuardian#2) to the serial id of the first spawn entry (one of the metal doors).  It also sets the TriggerObjectProp propery of the second spawner to "open=true", which will cause the second spawner to be triggered when that door is opened.
The second spawner simply spawns the guardian mob that is a standard troll with its hits and str buffed.
Each line is a spawn entry and the number next to it refers to the subgroup assigned to the entry.

First spawner (DoorGuardian#1)
1 metaldoor,0/movable/false
1 SET,DoorGuardian#2/triggerobject/GETONSPAWN,1,SERIAL/triggerobjectprop/open=true

Second spawner (DoorGuardian#2)
troll/name/Door Guardian/hitsmaxseed/1000/hits/1000/str/200

Note, this spawner example is exactly the same as manually creating the doors, then creating the guardian spawner and setting its TriggerObject and TriggerObjectProp properties by hand.


Description of chestguardian.xml:
This is similar to doorguardian.xml but uses chests instead of doors, and is triggered when a player removes the contents of the chest.

DrussRob- 01-28-2006
wow, I overlooked that big time. I apologize about that, I'll look closer next time. Thank you for your help as always.