Ask a simple question, get a simple answer

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
IttaBitta
Posts: 19
Joined: Thu Oct 22, 2020 12:14 am

Re: Ask a simple question, get a simple answer

Post by IttaBitta »

Um... could you dumb it down a little? >.>

I wish I could record how I set them up in the preview :/
I can handily organize them with the ol' click&drag

Image

but as it stands I can't parse a line of that second code. Timing's not really a problem, I just need to know how to put them in the RIGHT places
User avatar
Isaac
Posts: 3172
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

Each object has a subtile X&Y coordinate/offset. The intra-tile positions of items can be shifted using the :setSubtileOffset(x, y) function of the game object. Vertical positioning can be done using the :setWorldPositionY() function.

https://github.com/JKos/log2doc/wiki/Ob ... #methods-1
IttaBitta
Posts: 19
Joined: Thu Oct 22, 2020 12:14 am

Re: Ask a simple question, get a simple answer

Post by IttaBitta »

unrelated question: is there a way to bury something other than a chest?
User avatar
Zo Kath Ra
Posts: 931
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: Ask a simple question, get a simple answer

Post by Zo Kath Ra »

IttaBitta wrote: Fri Oct 30, 2020 6:20 am unrelated question: is there a way to bury something other than a chest?
Yes you can:
Put a floor_trigger on the map.
Check its "triggeredByDigging" box, and uncheck the other boxes.
Also check its "disableSelf" box, so the player can only dig it up once.
Then connect it to a script that spawns an item.
IttaBitta
Posts: 19
Joined: Thu Oct 22, 2020 12:14 am

Re: Ask a simple question, get a simple answer

Post by IttaBitta »

Zo Kath Ra wrote: Fri Oct 30, 2020 8:19 am Yes you can:
Put a floor_trigger on the map.
Check its "triggeredByDigging" box, and uncheck the other boxes.
Also check its "disableSelf" box, so the player can only dig it up once.
Then connect it to a script that spawns an item.
I was trying to summon a different kind of container but it doesn't seem to let me effect what's in THAT
User avatar
Zo Kath Ra
Posts: 931
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: Ask a simple question, get a simple answer

Post by Zo Kath Ra »

IttaBitta wrote: Fri Oct 30, 2020 8:54 am I was trying to summon a different kind of container but it doesn't seem to let me effect what's in THAT
Post your code and we'll see what we can do.
User avatar
ratman
Posts: 158
Joined: Fri Jan 10, 2020 1:13 am

Re: Ask a simple question, get a simple answer

Post by ratman »

What type of container? An item (like a sack or wooden box) or another chest-type object?
User avatar
Skuggasveinn
Posts: 561
Joined: Wed Sep 26, 2012 5:28 pm

Re: Ask a simple question, get a simple answer

Post by Skuggasveinn »

IttaBitta wrote: Fri Oct 30, 2020 8:54 am I was trying to summon a different kind of container but it doesn't seem to let me effect what's in THAT
I did a tutorial about digging stuff up, in this tutorial I hooked a script to the floor trigger just like Zo Kath Ra suggested.
https://www.youtube.com/watch?v=T9vM91bLUY8&t=4s

The scripts was

Code: Select all

function hiddencorpse()
      self.go:spawn("floor_corpse")
      self.go:spawn("skull")
      self.go:spawn("rapier")
      hudPrint("You have found a buried body")
      for i = 1, 4, 1 do
      party.party:getChampion(i):gainExp(250)
      end
      hudPrint("250 exp")
      playSound("secret")
end
If you are spawning another container that you want filled with some items I would simply place it below the map populated with your items, and then use the script to move it into position when the party digs.
first use print(floor_trigger_1:getWorldPosition()) to get the worldposition of your floor trigger.
And then use yourcontainer_1:setWorldPosition(vec(1, 1, 1, 0)) in the script to set the container where vec is the location you got before.

Skuggasveinn.
Link to all my LoG 2 assets on Nexus.
Link to all my LoG 1 assets on Nexus.
IttaBitta
Posts: 19
Joined: Thu Oct 22, 2020 12:14 am

Re: Ask a simple question, get a simple answer

Post by IttaBitta »

Skuggasveinn wrote: Fri Oct 30, 2020 7:14 pm
IttaBitta wrote: Fri Oct 30, 2020 8:54 am I was trying to summon a different kind of container but it doesn't seem to let me effect what's in THAT
I did a tutorial about digging stuff up, in this tutorial I hooked a script to the floor trigger just like Zo Kath Ra suggested.
https://www.youtube.com/watch?v=T9vM91bLUY8&t=4s

The scripts was

Code: Select all

function hiddencorpse()
      self.go:spawn("floor_corpse")
      self.go:spawn("skull")
      self.go:spawn("rapier")
      hudPrint("You have found a buried body")
      for i = 1, 4, 1 do
      party.party:getChampion(i):gainExp(250)
      end
      hudPrint("250 exp")
      playSound("secret")
end
If you are spawning another container that you want filled with some items I would simply place it below the map populated with your items, and then use the script to move it into position when the party digs.
first use print(floor_trigger_1:getWorldPosition()) to get the worldposition of your floor trigger.
And then use yourcontainer_1:setWorldPosition(vec(1, 1, 1, 0)) in the script to set the container where vec is the location you got before.

Skuggasveinn.
Tried that, now the container(a coffin) is incorporeal for some reason.
I can walk through it but not touch it.
edit: solved the problem, I now have it waiting above ground, just hidden away in a corner, and it works now.
IttaBitta
Posts: 19
Joined: Thu Oct 22, 2020 12:14 am

Re: Ask a simple question, get a simple answer

Post by IttaBitta »

neeeeeeeeeew question
how would I go about making a button that dispenses cheese into an alcove or on to an altar
I can easily get it to spawn on the floor but that is gross :V
Post Reply