hi need help with altar

Are you looking for fun Custom Dungeons that you could play or do you want to share your mod with others? Then this forum is for you!
Post Reply
renen01
Posts: 6
Joined: Sun Feb 15, 2015 12:21 am

hi need help with altar

Post by renen01 »

i know there is a way to make only specific item for the altar to trigger secret door but i dont know how to make the specific item to work on it
becuse right now every item i put on the altar trigger the secret door
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: hi need help with altar

Post by minmay »

You need to use a script to check the item on the altar and open the door. Typically this is done by adding an onInsertItem connector from the SurfaceComponent to a function in a script_entity's ScriptComponent that compares the item's name to the desired name (or checks for the desired trait, or whatever other condition you want) and opens the door if they match.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Azel
Posts: 808
Joined: Thu Nov 06, 2014 10:40 pm

Re: hi need help with altar

Post by Azel »

Code: Select all

for _,item in YOUR_ALTAR_ID.surface:contents() do				
	if item.go.ID== 'YOUR_ITEM_ID' then
		DoSomething();
	end
end
renen01
Posts: 6
Joined: Sun Feb 15, 2015 12:21 am

Re: hi need help with altar

Post by renen01 »

very hard for me to understand ur replay can you give me exmple of some random item on altar so then i will understand what i need to do for sure thanks for the help
renen01
Posts: 6
Joined: Sun Feb 15, 2015 12:21 am

Re: hi need help with altar

Post by renen01 »

for flask_1,item in altar_2.surface:contents(beach_secret_door_2) do if item.go.altar_2== 'flask_1' then DoSomething(toogle); end
really not understanding how to make it work
Azel
Posts: 808
Joined: Thu Nov 06, 2014 10:40 pm

Re: hi need help with altar

Post by Azel »

It should be:

Code: Select all

for _,item in altar_2.surface:contents() do
	if item.go.ID == 'flask_1' then
		-- put your action code here
	end
end
All you have to do is put your action commands where the Comment is. Don't change anything else. Although based on your current understanding of applying LUA to Grimrock I would strongly recommend you spend a great many hours going back and forth with the Scripting Reference and your own trial and error:
http://www.grimrock.net/modding/scripting-reference/

You need to put yourself to some gruesome and lengthy scripting practice. I had to do the same thing when I first started.
renen01
Posts: 6
Joined: Sun Feb 15, 2015 12:21 am

Re: hi need help with altar

Post by renen01 »

thanks for the help azel but seems like im goin to find another way then and leave the idea of the altars to trigger doors lol
Azel
Posts: 808
Joined: Thu Nov 06, 2014 10:40 pm

Re: hi need help with altar

Post by Azel »

hah, good idea. Keep it simple :mrgreen:
Post Reply