Full Version : Spawn items in container
xmlspawner >>Q&A >>Spawn items in container


<< Prev | Next >>

Anvil- 02-15-2006
I saw a post somewhere, but can't remember where I saw it, but I"m trying to find a way to spawn a container locked, with items inside that can be stolen. After a brief peiod of time the container closes and re-locks and items inside re-spawn. Also, if it's possible to setup varying degrees of lockpicking/stealing skill ability that would be great too. Essentially I'm trying to get rid of the Voran Town Crates and do it strickly through the XML spawner.

ArteGordon- 02-19-2006
yes, you can do this. To spawn a locked, pickable container with stealable contents, something like

metalbox/movable/false/locked/true/requiredskill/70/locklevel/50/ADD,0.5/<ARMOR,1,3/movable/false/STEALABLE/true>/ADD/<gold,100/movable/false/STEALABLE/true>/ADD,0.5/<LOOT,RandomInstrument/movable/false/STEALABLE/true>

and then set the duration property on the spawner to however long you want the container to last before being respawned with new items.

You can also do this for existing containers. Just put the spawner inside the container and do something like

SETONPARENT/locked/true/requiredskill/70/locklevel/50/visible/false/visible/true
ARMOR,1,3/movable/false/STEALABLE/true
gold,100/movable/false/STEALABLE/true
LOOT,RandomInstrument/movable/false/STEALABLE/true

put all of those into the same subgroup so that they spawn together. Setting visible to false and then back to true is a little trick to force the container gump to close if someone tries to just leave it open.

Anvil- 03-13-2006
Ok, I don't mean to sound like a complete n00b here, but what's the preface commnad get these to work?

[xmladd SETONPARENT/locked/true/requiredskill/70/locklevel/50/visible/false/visible/true

ArteGordon- 03-14-2006
You can add a spawner with '[xmladd' (no args, just press the Add button when the gump opens).

Then open up the spawner gump and cut and paste each of those lines that I posted as individual entries.

Then open the extended gump by clicking the little arrow in the lower right corner of the spawner gump, and assign each of the entries to the same subgroup by setting the 'Sub' field to a value greater than zero, like '1'

Hey, I like n00bs. they're soft and fun to squeeze. (hrm, maybe im thinking of something else..)

Kalen- 03-19-2006
This worked great, easy to spawn stealables in containers. Only one problem that I can't figure out how to fix. When you steal and item off the ground the guards whack you but if you steal the same item from a container like you have written here you don't get flagged and no whacking from guards. I'm using your stealing scipt that came with xml spawner, just wondering what I could add to it to make you get flagged and whacked for stealing from containers too otherwise there is no challenge to it. Thanks for this great spawner Arte smile.gif

ArteGordon- 03-19-2006
To make stealing from containers a criminal offense, just make this mod to stealing.cs in the OnTarget method around line 345

QUOTE

    if ( caught )
    {
    // ARTEGORDONMOD
    // make stealing from containers a criminal offense
    if ( root == null || (root is Container && !(root is Corpse)))
    {
      m_Thief.CriminalAction( false );
    }


Guards! Guards! smile.gif

Kalen- 03-20-2006
Yes that worked great! *rubs head where guard whacked it* Thanks so much Arte

Anvil- 03-20-2006
what's the difference in these two skill levels in this line?

requiredskill/70/locklevel/50

If I wanted it to start at 0.0 lockpicking/stealing I would just set these to 0?

I guess I know one is for lockpicking and other is for stealing.. just wasn't sure which was for which. Thanks.

Anvil

Anvil- 03-20-2006
Also, As a test I used you lines above:

SETONPARENT/locked/true/requiredskill/70/locklevel/50/visible/false/visible/true
ARMOR,1,3/movable/false/STEALABLE/true
gold,100/movable/false/STEALABLE/true
LOOT,RandomInstrument/movable/false/STEALABLE/true

after I did an [xmladd and set the spawner to moveable, put it in an already existing container, and then set moveable to false. Added in the lines above on their own seperate entry, used the up arrow to turn them on, and then set the subgroup to 1.. when I hover the mouse over the spawner, I see all of them in subgroup one with the exception of the setonparent line and that's set to 0, and the container never locks however the items inside are not moveable but down spawn.

What am I doing wrong?

ArteGordon- 03-20-2006
the SETONPARENT line is the one that locks the container. Make sure that it is also in subgroup 1.

The locklevel is what is tested against the players lockpicking skill to determine whether they can pick it or not.
A value of 0 means that it cannot be picked, and a value of -255 means that it is magic locked. Those result in the "This lock cannot be picked by normal means" message.

The required skill is the minimum lockpicking allowed for the player to even attempt to pick it. It is what give the "You don't see how that lock can be manipulated" message.

If it is above the required skill and you fail to pick it based on the test of lockpicking skill against the locklevel, you get the "You are unable to pick the lock" message.

Anvil- 03-30-2006
Arte,

When I put this line on the first line and subgroup 1 with the rest of my lines as subgroup one

SETONPARENT/locked/true/requiredskill/70/locklevel/50/visible/false/visible/true

I'm getting an error on the spawner...

locklevel : property not found

Am I missing something?

Anvil- 03-30-2006
Ok, I found the problem...

Apparently this doesn't work on barrels smile.gif My bad... I figured it out now... but one last question, how would I set the stealing skill level? Thanks.

Anvil

ArteGordon- 03-30-2006
required stealing skill is based on target item weight (that is default OSI behavior). Make it heavier and it will be harder up to a max weight of 10 beyond which it can no longer be stolen.

Anvil- 04-04-2006
Ok, couple of problems that I've found...

First, I've added the check for criminal when stealing so guards will whack you... Works great if you're inside a shop where an NPC is... and works group if you're inside a shop where there is no NPC (no guards called). The problem I find is that when I'm in a shop with multiple rooms, and am in a room where there is no NPC and door is closed (no Line of Sight from NPC) and I steal something from a conatiner, I still get whacked as if the NPC can see me.

Second, when using an existing container (metal golden chest in Haven), I get an error message in game about unable to see item when trying to steal it and thus can't steal. a placed container works just fine and wooden crates/chests seem to work find too. Intersting...

ArteGordon- 04-04-2006
yeah, the determination of whether or not you are caught stealing is simply a skill check and doesnt involve tests for whether anyone could see you.
From stealing.cs

CODE

caught = ( m_Thief.Skills[SkillName.Stealing].Value < Utility.Random( 150 ) );


You could add such a check pretty easily if you wanted.

You should be able to steal from any actual container, placed or deco. Frozen objects would not qualify. Im not exactly sure which container you were having a problem with. You have coords?