Item Stacks in Containers

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
MadMyke
Posts: 9
Joined: Tue Feb 25, 2014 10:42 pm

Item Stacks in Containers

Post 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
User avatar
THOM
Posts: 1280
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Item Stacks in Containers

Post 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...
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
MadMyke
Posts: 9
Joined: Tue Feb 25, 2014 10:42 pm

Re: Item Stacks in Containers

Post 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.
User avatar
JohnWordsworth
Posts: 1397
Joined: Fri Sep 14, 2012 4:19 pm
Location: Devon, United Kingdom
Contact:

Re: Item Stacks in Containers

Post 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.
Last edited by JohnWordsworth on Wed Feb 26, 2014 10:41 am, edited 1 time in total.
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
MadMyke
Posts: 9
Joined: Tue Feb 25, 2014 10:42 pm

Re: Item Stacks in Containers

Post 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.
User avatar
petri
Posts: 1917
Joined: Thu Mar 01, 2012 4:58 pm
Location: Finland

Re: Item Stacks in Containers

Post by petri »

With Dungeon Editor 2 you can set stack size in the inspector :)
Post Reply