Page 1 of 1

Item Stacks in Containers

Posted: Tue Feb 25, 2014 10:54 pm
by MadMyke
I am not sure if this was already covered, but I could not find another thread on this topic.

I am new to LoG and am working on my own dungeon. I would like to have multiple items (i.e. ammunition/thrown weapons/ingredients) stacked when placing them in a container. How would I go about this as I can only have 3 stacks of 1 instead of 1 stack of 3?

Also, how do I place items in a sack that is placed in an alcove? Or additional items on monsters spawned from spawners?

I am sure this is basic stuff, but thanks to anyone who takes time to help.

-MadMyke

Re: Item Stacks in Containers

Posted: Tue Feb 25, 2014 11:00 pm
by THOM
There are threads were many scripting questions been answered. Have a look here:

http://grimrock.net/forum/viewtopic.php?f=14&t=3240

viewtopic.php?f=14&t=3099

Concerning Items in an alcove look here:

http://www.grimrock.net/modding/how-to- ... an-alcove/

About your first question I am sorry: I don't understand, what you want...

Re: Item Stacks in Containers

Posted: Tue Feb 25, 2014 11:18 pm
by MadMyke
The first question is in reference to multiples of the same stackable item in a container or in the environment in general.

Right now, when I add a throwing knife for example, it adds a single throwing knife. I can place 3 single throwing knives, but I cannot place one stack of 3 throwing knives.

So I get:

1 Throwing Knife
1 Throwing Knife
1 Throwing Knife

instead of:

3 Throwing Knife

-MadMyke

p.s. Thanks for the link. It will help me a lot.

Re: Item Stacks in Containers

Posted: Wed Feb 26, 2014 2:14 am
by JohnWordsworth
You would have to spawn the items using code, but in a script you could spawn a stack of knives using the following;

Code: Select all

function createSackOfKnives(level, x, y, facing)
  local container = spawn("sack", level, x, y, facing);
  local knives = spawn("throwing_knife");
  knives:setStackSize(3);
  container:addItem(item);
end
I've guessed the object names - so this might not work through copy and paste. This creates a function you can use elsewhere to spawn a sack of knives. Could obviously be easily modified to spawn any stackable item in a sack, or even an alcove etc.

Re: Item Stacks in Containers

Posted: Wed Feb 26, 2014 4:26 am
by MadMyke
That's precisely what I needed.

I have just begun dabbling in Lua Script so I appreciate any insight I can find. Thank you.

Re: Item Stacks in Containers

Posted: Wed Feb 26, 2014 9:27 am
by petri
With Dungeon Editor 2 you can set stack size in the inspector :)