Beta 2.1.18

Talk about anything related to Legend of Grimrock 2 here.
User avatar
RMariano
Posts: 287
Joined: Mon Apr 02, 2012 1:16 pm
Location: Florida, USA
Contact:

Re: Beta 2.1.18

Post by RMariano »

Only anomaly I've noticed is occasionally, the game will simply minimize itself. I am however, able to bring it right back up and continue game play.
Regards,

RMariano
arcanum
Posts: 6
Joined: Mon Apr 23, 2012 5:19 am

Re: Beta 2.1.18

Post by arcanum »

The game does not minimize itself. Its your other sofwaveres running on the background that request an API call to make window open. The game itself asks "i like to go fullscreen". It does not interfere any API calls does by another softwares of yours.

-arc
User avatar
RMariano
Posts: 287
Joined: Mon Apr 02, 2012 1:16 pm
Location: Florida, USA
Contact:

Re: Beta 2.1.18

Post by RMariano »

RMariano wrote:Only anomaly I've noticed is occasionally, the game will simply minimize itself. I am however, able to bring it right back up and continue game play.
That behavior was due to an app that was running in the BG.


Condition corrected and no trubs since......
Regards,

RMariano
User avatar
RMariano
Posts: 287
Joined: Mon Apr 02, 2012 1:16 pm
Location: Florida, USA
Contact:

Re: Beta 2.1.18

Post by RMariano »

still.......

Running 2118 with no trubs.
Regards,

RMariano
User avatar
Frenchie
Posts: 219
Joined: Wed Oct 16, 2013 2:50 am

Re: Beta 2.1.18

Post by Frenchie »

Is the full updated fix list placed anywhere in the forum?

Does it include the setDoorState() bug that Isaac found mentioned in this forum topic
User avatar
Dr.Disaster
Posts: 2876
Joined: Wed Aug 15, 2012 11:48 am

Re: Beta 2.1.18

Post by Dr.Disaster »

Frenchie wrote:Is the full updated fix list placed anywhere in the forum?
2.1.18 is literally 2.1.17 plus one fix regarding misplaced crystals i.e. in the catacombs.
Frenchie wrote:Does it include the setDoorState() bug that Isaac found mentioned in this forum topic
This bug was discovered after 2.1.18 went live, so the answer is "No"
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Beta 2.1.18

Post by Isaac »

AFAIK [now], the setDoorState() issue is not seen as a bug; (so it may or may not be worked on). The setDoorState() function is apparently only intended to be used internally during level setup at load; (not in user scripts). It would be nice if it did get changed to work smoothly (as it did in LoG); I found it useful.

*A serviceable workaround is to enable/disable the model and door components of the door object.
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Beta 2.1.18

Post by minmay »

setDoorState() is trivial to implement yourself, guys...just change all the door's sounds to silence, give it infinite open/close speed, open/close it, then restore the original values the next frame.

Also, 2.1.18 fixed the GameObject:getPosition() bug, did it not?
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.
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Beta 2.1.18

Post by Isaac »

minmay wrote:setDoorState() is trivial to implement yourself, guys...just change all the door's sounds to silence, give it infinite open/close speed, open/close it, then restore the original values the next frame.

Also, 2.1.18 fixed the GameObject:getPosition() bug, did it not?
It's trivial, but it would be better to have it work reliably; it's in the script reference. Either that or remove it from the suggested usable function calls.

A replacement function that enables/ or disables the model and door [for collision] components seems to work pretty well; though I haven't really tested it, other than to try it a few times.
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Beta 2.1.18

Post by minmay »

That solution won't work if you want the user to see or interact with the door, or if you want to close the door instead of opening it, or a bunch of other things. Here's a version you can use instead.

Code: Select all

-- a version of setDoorState that...actually works
function safeSetDoorState(gameObject,doorComponentName,state)
	local door = gameObject[doorComponentName]
	if state == "closed" then
		local closeSound, closeVelocity, lockSound = door:getCloseSound(), door:getCloseVelocity(), door:getLockSound()
		door:setCloseSound("silence") door:setCloseVelocity(-math.huge) door:setLockSound("silence")
		door.go.controller:close()
		frameutils.script.callNextFrame(safeSetDoorStateCleanup,{gameObject.id,doorComponentName,state,closeSound,closeVelocity,lockSound})
	elseif state == "open" then
		local openSound, openVelocity, lockSound = door:getOpenSound(), door:getOpenVelocity(), door:getLockSound()
		door:setOpenSound("silence") door:setOpenVelocity(math.huge) door:setLockSound("silence")
		door.go.controller:open()
		frameutils.script.callNextFrame(safeSetDoorStateCleanup,{gameObject.id,doorComponentName,state,openSound,openVelocity,lockSound})
	else
		Console.warn("invalid door state ("..state..") in safeSetDoorState for "..gameObject.id.."."..doorComponentName)
	end
end

function safeSetDoorStateCleanup(gameObjectId, doorComponentName, state, sound, velocity, lockSound)
	local door = findEntity(gameObjectId)[doorComponentName]
	door:setLockSound(lockSound)
	if state == "closed" then
		door:setCloseSound(sound) door:setCloseVelocity(velocity)
	elseif state == "open" then
		door:setOpenSound(sound) door:setOpenVelocity(velocity)
	else
		Console.warn("invalid door state ("..state..") in safeSetDoorStateCleanup for "..gameObjectId.."."..doorComponentName)
	end
end
Put the following in a script entity called frameutils:

Code: Select all

nextFrameFunctions = {}
function onFrame()
	for _,nff in ipairs(nextFrameFunctions) do
		local arg = nff.arg
		-- CANNOT be shortened to
		-- nff.hook(type(arg) == "table" and unpack(arg) or arg)
		-- due to and/or only evaluating to the first value in the table.
		if type(arg) == "table" then
			nff.hook(unpack(arg))
		else
			nff.hook(arg)
		end
	end
	nextFrameFunctions = {}
end

-- Call function func next frame with arguments in table args (or just args as
-- one argument, if it is not a table). They are called
-- in the same order that callNextFrame is called.
function callNextFrame(func,args)
	table.insert(nextFrameFunctions,{hook=func,arg=args})
end
Add the following component to the definition of "party":

Code: Select all

		{	-- This will trigger once every frame.
			class = "Timer",
			name = "frame_timer",
			timerInterval = 0.001,
			onActivate = function(self)
				frameutils.script.onFrame()
			end,
		},
Then define a sound called "silence" that's just silence.
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.
Post Reply