Full Version : Locking Static Container?
xmlspawner >>Q&A >>Locking Static Container?
<< Prev | Next >>
cheetah2003- 10-01-2006
Is there a way to use XML Spawner to make static containers become locked, and specify what level the lock should be?
ArteGordon- 10-01-2006
yes. There are different approaches depending on whether the spawner is inside or outside the container.
from the xmlspawner thread on RunUO I grabbed a couple of posts

QUOTE

QUOTE (Greystar)
I've been tossing around some ideas for sticking XMLSpawners inside some chest. I know I can use them to spawn items in chests but heres some questions I have. 1) Can I make the spawner Lock the chest when it respawns the items? (might require two spawners)
2) If it can lock the chest can i also make it set the lock level?
If I can think of any other questions I may add to this post unless it gets buried. I am contemplating using the Chests that are in the mining camp in minoc and in a couple other camps that are currently empty. I have seen a couple of shards stick an item in there here and there that respawn eventually. Like a pickaxe, or shoes, or gerenal clothing.

yes, you can have the spawner lock the chest and set the lock level. Use something like this
SETONPARENT/locked/true/locklevel/60
When the spawner is in the chest, the parent is the chest.
If you want that entry executed at the same time as your item is spawned, just put them into the same subgroup and they will always be spawned together as a group.
(edit)
note, if you are using fixed chests (not respawned ones), it is possible for a player to open the chest, and then just keep the chest gump open. Then even if you lock it, they will still be able to get to the contents.
To get around this you can use a little trick, which is to make it invisible, which will force any gumps to close, and then make it immediately visible again. Like this
SETONPARENT/locked/true/locklevel/60/visible/false/visible/true

QUOTE

QUOTE (Anvil)
Ok, I've searched through 52 pages... *eesh!* and I can't locate what I'm looking for... I'm looking for some information on how to go about spawning a container, that is locked, trapped, with items that spawn inside it. Also, is it possible to set the min skill in lock picking and remove trap skill that is required in order to open the container? I'm not so worried about the stealing skill being used to get the items inside the container, it's more for practicing lockpicking and remove trap. Thanks.
Anvil

there are a bunch of posts on the topic around page 44. Here is an example of one way to do it

CODE
woodenbox/movable/false/locked/true/traptype/poisontrap/trappower/30/ADD/<gold/amount/RND,1,25/STEALABLE/true/movable/false>

You can set the RequiredSkill (min req skill) and the LockLevel (skill difficulty) properties of the containers for lockpicking difficulty.
(edit)
oh, and the trappower sets the difficulty in trap removal.

QUOTE

QUOTE (LordHogFred)
Sorry I didn't see the posts . Thanks to you and Arte for helping out, I had a look at Alari's posts and found exactly what I was looking for, the SETONPARENT code. Just one last question. Is the anything I can add to a line to make it spawn 100% of the time? Basically I have set up the SETONPARENT code and then added several items (gold, ingots, gems, etc) but I only want one to spawn so I set the spawn count to 2 but I always want it to spawn the SETONPARENT line and then one of the ADD lines. Is htis possible? (It probably is because this is the most amazing spawner I have ever seen, thanks Arte! :cool:)
Chz ,

There are a couple of ways to do that.
One would be do have different subgroup blocks, each one with two lines - one with the stuff you want to drop, and the other the SETONPARENT line.
Because they are each in the same subgroup, the two lines will always spawn together.
So like this:

CODE
subgroup 1 SETONPARENT/locked/true/traptype/poisontrap/trappower/30 subgroup 1 gold/amount/RND,10,250/STEALABLE/true/movable/false subgroup 2 SETONPARENT/locked/true/traptype/explosiontrap/trappower/30 subgroup 2 diamond/amount/RND,1,5/STEALABLE/true/movable/false
etc.

The way the subgroups work is that when the spawner decides to spawn something it will randomly select from all the available spawns and when it picks one that has a subgroup > 0, it will also spawn all other entries in that subgroup.
The second way is just to put everything on multiple individual SETONPARENT lines, like this

CODE
SETONPARENT/locked/true/traptype/poisontrap/trappower/30/ADD/<gold/amount/RND,1,25/STEALABLE/true/movable/false>

since SETONPARENT will refer to the container, that is what the ADD will apply to. It would be like substituting 'metalbox' (which would spawn the box for you) for the 'SETONPARENT' (which refers to an existing box). Same idea.
Notice how you have to use the <> grouping around the stuff after the ADD so that the property mods like amount/RND,1,25/STEALABLE/true apply to the ADDed gold item and not the SETONPARENT.
(edit)
I think that I would do it the second way. Note, you can have multiple ADD statements on a single line if you want to do it the second way but have more than one thing added.
If you did it the first way, there might be some issue with the maxcount of 2 occasionally allowing one of the added items from another subgroup to spawn (I'm going to think about changing that behavior).
cheetah2003- 10-01-2006
Awsome, Arte, thank you very much!!
cheetah2003- 10-01-2006
Any special command I can use to delete all the items in the chest when the spawn occurs (except the spawner itself, of course)?
People often leave things behind they don't want. And when adding Random spawns with a probability, these don't get removed on respawn either.
IE:

CODE
SETONPARENT/ADD,0.5/LOOT,RandomReagent/Amount/RND,1,2

Random reagents start piling up everytime that probability triggers a spawn.
ArteGordon- 10-02-2006
yes, you can use the SETONNEARBY keyword along with the DELETE keyword as in this thread
http://xmlspawner.15.forumer.com/index.php?showtopic=850