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!
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: 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: 266
Joined: Sat Dec 29, 2012 8:22 pm

Re: Ask a simple question, get a simple answer

Post by hyteria »

hello everybody

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

thx !
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 »

This script should work:

Code: Select all

secret_button_1:destroy()
(Change secret_button_1 to the id of your own button)
hyteria
Posts: 266
Joined: Sat Dec 29, 2012 8:22 pm

Re: Ask a simple question, get a simple answer

Post by hyteria »

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: 3172
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

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: 266
Joined: Sat Dec 29, 2012 8:22 pm

Re: Ask a simple question, get a simple answer

Post by hyteria »

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: 266
Joined: Sat Dec 29, 2012 8:22 pm

Re: Ask a simple question, get a simple answer

Post by hyteria »

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
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 »

Do you have an object in your mod called that? Try just 'ctomb_secret_wall'
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 »

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: 266
Joined: Sat Dec 29, 2012 8:22 pm

Re: Ask a simple question, get a simple answer

Post by hyteria »

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