[SOLVED] Spike Traps

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!
Post Reply
User avatar
Ciccipicci
Posts: 154
Joined: Mon Oct 08, 2012 12:55 am

[SOLVED] Spike Traps

Post by Ciccipicci »

I need the script to make spike traps initially on and that alternate always one by one long a line.

Image
Last edited by Ciccipicci on Sat Jan 24, 2015 5:55 pm, edited 1 time in total.
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: Spike Traps

Post by Drakkan »

not sure if this is what you need, but

create timer called "spikes_timer", tick timer (interval 0,4 sec) and set on activate to function tick() inside script called

"spikes"

Code: Select all

step = 1

function tick()
	local seq = { 1,2,3,4,5,6,7,6,5,4,3,2 }
	
	findEntity("spikes_"..seq[step]).controller:activate()
	
	step = step%#seq+1
end
you can change the sequence here as you want, it will be repeating again and again.

then place objets floor_spike_trap and name it "spikes_1", "spikes_2", "spikes_3" etc... up to number in sequence...
Last edited by Drakkan on Sat Jan 24, 2015 10:23 pm, edited 1 time in total.
Breath from the unpromising waters.
Eye of the Atlantis
User avatar
Ciccipicci
Posts: 154
Joined: Mon Oct 08, 2012 12:55 am

Re: Spike Traps

Post by Ciccipicci »

Thanks Drakkan. It should be what I'm searching for. Anyway, following your solution triggering timer with script doesn't call any function.

To make it working I should name script "spikes_01" or similar and not only "spikes."

Thank you so much!
Post Reply

Return to “Mod Creation”