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

Re: Ask a simple question, get a simple answer

Post by Isaac »

If you are using the tomb tile-set along with elevation changes, and are seeing holes in the wall when looking downward at them... Here is a fix for that.

http://www.grimrock.net/forum/viewtopic ... 10#p119454
hyteria
Posts: 266
Joined: Sat Dec 29, 2012 8:22 pm

Re: Ask a simple question, get a simple answer

Post by hyteria »

not sure ton understand (english not my native langage) but yes i have got some connection probleme with some tiles set and i found a fix when i change properties level rising/lowing the cell max

its seems to work for now
hyteria
Posts: 266
Joined: Sat Dec 29, 2012 8:22 pm

Re: Ask a simple question, get a simple answer

Post by hyteria »

sorry to bother again but i tried to modifie a script but to be honest i dont understand nothing :/

Code: Select all

function surfaceContains(socket, item)
	for v,i in socket:contents() do
	if i.go.name == item then return true
	end
end
end

function openfinaldoor()

	if surfaceContains(beacon_air_1.socket, "figure_ice_guardian") and if surfaceContains(beacon_earth_1.socket, "figure_snail" then
	ctomb_gate_11.controller:open()
	playSound("secret")
	else
	ctomb_gate_11.controller:close()
	
	end
end
i try to make a door who open if player insert specifics items on two different altar

i think there is something to do with counter , but i dont know
thx
User avatar
Zo Kath Ra
Posts: 940
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: Ask a simple question, get a simple answer

Post by Zo Kath Ra »

hyteria wrote: Mon Nov 02, 2020 8:29 pm sorry to bother again but i tried to modifie a script but to be honest i dont understand nothing :/
For both altars, connect their "onInsertItem" action to openfinaldoor()
hyteria
Posts: 266
Joined: Sat Dec 29, 2012 8:22 pm

Re: Ask a simple question, get a simple answer

Post by hyteria »

this was what i did , but this doesn t work

error is "unexpected symbol near "if"
hyteria
Posts: 266
Joined: Sat Dec 29, 2012 8:22 pm

Re: Ask a simple question, get a simple answer

Post by hyteria »

this work i removed the "if" and add ")" who s missing :)
hyteria
Posts: 266
Joined: Sat Dec 29, 2012 8:22 pm

Re: Ask a simple question, get a simple answer

Post by hyteria »

hello

another question :

Code: Select all

counter = 0

function dmdispelltrap()

	for i=14,15 do
	
		local tile = findEntity("spawner_"..i)
		if tile~=nil then
			local active = (tile.x+tile.y+counter) % 4
			if active == 1 then 
				tile.controller:activate()
			end
		end
	
	end
	
	counter = counter + 1
end
using this , how i have something more random ?

thx!
User avatar
Isaac
Posts: 3188
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

What kind? (Randomness in the frequency of triggering, or of which trap triggers?)

This has both:

Code: Select all

function dmdispelltrap()
	if math.random() < .26 then  										--chance of active trap; range is between zero and one
		local activeTrap = findEntity("spawner_"..math.random(14,15)) 	--randomly chooses either 14 or 15; range includes all numbers in between
		if activeTrap 													--exists
			then activeTrap.controller:activate()						--activate the trap
		end	 
	end	
end
_______________________________

* Are both spawners on the same tile, and this is used to vary the output? There is a better way for that:

Code: Select all

function dmdispelltrap()
	local effect = {"fireburst", "ice_shards", "poison_cloud_medium", "shockburst"}
	spawner_14.spawner:setSpawnedEntity(effect[math.random(#effect)])
	if math.random()<.26 then spawner_14.controller:activate() end
end
hyteria
Posts: 266
Joined: Sat Dec 29, 2012 8:22 pm

Re: Ask a simple question, get a simple answer

Post by hyteria »

this is a simple trigger who activate 3 spawner (fireball)

edit : ok i tried the first one and seems ok , to chance frequency i just have to change math method ratio ?
another thing , i noticed that spawner shot one after the other , this is possible to add chance that both spawn ?
thx a lot for your help !
User avatar
Isaac
Posts: 3188
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

It activates three?
___________

To make the trap fire more often, raise the .26 value. (*Maximum of up to 1)
0.5 is a 50/50 chance. As written, if the chance fails, then none trigger. It can be changed so the random element simply chooses which one fires for that call, so that there will always be one that fires.
___________

Are they really just random? Your players will probably try to find a meaningful pattern to them.
Post Reply