Page 355 of 400
Re: Ask a simple question, get a simple answer
Posted: Sun Nov 01, 2020 11:09 am
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)
Re: Ask a simple question, get a simple answer
Posted: Sun Nov 01, 2020 12:39 pm
by hyteria
hello everybody
i look for a script for grimrock 2 who remove a secret button
thx !
Re: Ask a simple question, get a simple answer
Posted: Sun Nov 01, 2020 4:21 pm
by ratman
This script should work:
(Change secret_button_1 to the id of your own button)
Re: Ask a simple question, get a simple answer
Posted: Sun Nov 01, 2020 5:16 pm
by hyteria
many thx !!
, this work but the problem now it s that remove the wall too (well he becomme transparent)
maybee i can fix it by adding a secret wall but dunno the command to make something appear somewhere

Re: Ask a simple question, get a simple answer
Posted: Sun Nov 01, 2020 8:29 pm
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()
Re: Ask a simple question, get a simple answer
Posted: Sun Nov 01, 2020 8:37 pm
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 !
Re: Ask a simple question, get a simple answer
Posted: Sun Nov 01, 2020 10:01 pm
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
Re: Ask a simple question, get a simple answer
Posted: Sun Nov 01, 2020 10:40 pm
by ratman
Do you have an object in your mod called that? Try just 'ctomb_secret_wall'
Re: Ask a simple question, get a simple answer
Posted: Sun Nov 01, 2020 10:42 pm
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.
Re: Ask a simple question, get a simple answer
Posted: Mon Nov 02, 2020 12:03 am
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 !