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!
Zo Kath Ra
Posts: 891
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: Ask a simple question, get a simple answer

Post by Zo Kath Ra » Sun Nov 01, 2020 11:09 am

IttaBitta wrote:
Sun Nov 01, 2020 3:22 am
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
After spawning the item, add it to the altar's surface component:
http://www.grimrock.net/modding/scripting-reference/
SurfaceComponent:addItem(item)

The function parameter must be an item component, not an entity:

Code: Select all

altar_1.surface:addItem(spawn("cheese").item)

hyteria
Posts: 265
Joined: Sat Dec 29, 2012 8:22 pm

Re: Ask a simple question, get a simple answer

Post by hyteria » Sun Nov 01, 2020 12:39 pm

hello everybody

i look for a script for grimrock 2 who remove a secret button

thx !

ratman
Posts: 147
Joined: Fri Jan 10, 2020 1:13 am

Re: Ask a simple question, get a simple answer

Post by ratman » Sun Nov 01, 2020 4:21 pm

This script should work:

Code: Select all

secret_button_1:destroy()
(Change secret_button_1 to the id of your own button)

hyteria
Posts: 265
Joined: Sat Dec 29, 2012 8:22 pm

Re: Ask a simple question, get a simple answer

Post by hyteria » Sun Nov 01, 2020 5:16 pm

many thx !!
, this work but the problem now it s that remove the wall too (well he becomme transparent)

Image

maybee i can fix it by adding a secret wall but dunno the command to make something appear somewhere :)

User avatar
Isaac
Posts: 3089
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac » Sun Nov 01, 2020 8:29 pm

The secret button assets include the walls too. If you just want the button to stop working, then disable the clickable component:

Code: Select all

secret_button_1.clickable:disable()
Otherwise, if you want it to look like it was never there, then you must replace the button-wall with a regular one.

Code: Select all

dungeon_secret_button_large_1:spawn("dungeon_wall_01") 
dungeon_secret_button_large_1:destroy()

hyteria
Posts: 265
Joined: Sat Dec 29, 2012 8:22 pm

Re: Ask a simple question, get a simple answer

Post by hyteria » Sun Nov 01, 2020 8:37 pm

many thx for help ! it was a long time i didn t create a map
i gonna try this i keep you informed !

hyteria
Posts: 265
Joined: Sat Dec 29, 2012 8:22 pm

Re: Ask a simple question, get a simple answer

Post by hyteria » Sun Nov 01, 2020 10:01 pm

ok so i tried

Code: Select all

function destroybutton()

oneuse:spawn("ctomb_secret_wall_25") 
oneuse:destroy()

end
but this doesn t work : undefined object ctomb_secret_wall_25
:/

oneuse if the name on secret button

ratman
Posts: 147
Joined: Fri Jan 10, 2020 1:13 am

Re: Ask a simple question, get a simple answer

Post by ratman » Sun Nov 01, 2020 10:40 pm

Do you have an object in your mod called that? Try just 'ctomb_secret_wall'

User avatar
Isaac
Posts: 3089
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac » Sun Nov 01, 2020 10:42 pm

The spawn function expects the name of a template object, not an instance Id. So in the case of the tomb tile-set, it should be:

Code: Select all

function destroybutton()

oneuse:spawn("tomb_wall_01") 
oneuse:destroy()

end
*This makes a very obvious physical change to the wall. There is also the Disable Self option in the button component; in the object inspector. That will disable the button on the first use.

hyteria
Posts: 265
Joined: Sat Dec 29, 2012 8:22 pm

Re: Ask a simple question, get a simple answer

Post by hyteria » Mon Nov 02, 2020 12:03 am

it work ! thx
i think i have understand the logic i changed tomb_wall_01 for ctomb_wall_01 to get the correct wall tileset !

many thx !

Post Reply