Selecting a random character

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Grimfan
Posts: 369
Joined: Wed Jan 02, 2013 7:48 am

Re: Selecting a random character

Post by Grimfan »

The script is very simple. It's basically just like the one above with a hudPrint ("One of your party members has been sucked into the crystal") and sound ("party_crushed") attached to it, however here's the interesting point:

The script is within Diarmuid's and Neikun's extensive crystalHandler script and basically changes the properties of one of their crystals from the normal party:heal to the script already mentioned (note that their script does not using grimq a far as I can tell). Now could it be that the onClick function of the crystals (is a crystal clicked by all party members simultaneously?) or something similar about their construction is causing the script to fail if there are any dead characters (it crashes preview mode)?

Mmmm...

Any ideas guys?
User avatar
Xanathar
Posts: 629
Joined: Sun Apr 15, 2012 10:19 am
Location: Torino, Italy
Contact:

Re: Selecting a random character

Post by Xanathar »

If it's a crash i know the solution .. grab the last version I fixed that bug last week :)
Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com

The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563

My preciousss: http://www.moonsharp.org
Grimfan
Posts: 369
Joined: Wed Jan 02, 2013 7:48 am

Re: Selecting a random character

Post by Grimfan »

Well if it's a bug it means that JKos hasn't updated his framework to your new version. If he has then something else is going on.
Grimfan
Posts: 369
Joined: Wed Jan 02, 2013 7:48 am

Re: Selecting a random character

Post by Grimfan »

Just updated (replacing version 1.2 for 1.4.1) and got this error:

mod_assets/framework/module/grimq.lua:48 attempt to call global 'print' (a nil value).

It seems to be referring to this code:

Code: Select all

function _log(level, prefix, text)
	if (level <= LOG_LEVEL) then
		print(prefix .. LOG_PREFIX .. text)
	end
end
If I set the LOG_LEVEL to -1 (no info) it works (I expected as much), but setting the LOG_LEVEL to anything else gives me the error.
User avatar
Xanathar
Posts: 629
Joined: Sun Apr 15, 2012 10:19 am
Location: Torino, Italy
Contact:

Re: Selecting a random character

Post by Xanathar »

Hi Grimfan,
congratulations on your problem solving skills! Yes changing the log level should do the trick. What you are seeing is probably a consequence of grimq being called from the framework, when print is not yet bound to a function by the engine. When I get back from holydays I'll make an install with just the framework and grimq and try debug it.

Anyway, glad you solved it :)

I would suggest doing something similar to:

Code: Select all

local champs = grimq.fromAliveChampions()

if (champs:count() > 1) then
	champs:random():setEnabled(false)
	hudPrint("Four little Soldier Boys going out to sea; A red herring swallowed one and then there were three.")
else
	hudPrint("One little Soldier Boy left all alone; He went out and hanged himself and then there were none.")
	grimq.gameover();
end
This should solve all issues you can have with previously disabled and dead champs (and shows you also how "count" works :) plus a lame excuse to cite some great book).
Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com

The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563

My preciousss: http://www.moonsharp.org
Grimfan
Posts: 369
Joined: Wed Jan 02, 2013 7:48 am

Re: Selecting a random character

Post by Grimfan »

While my workaround fixed that problem Xanathar as soon as I start preview mode the game crashes. Now I think it has to be a compatibility issue between your new version of grimq and JKos current framework or another piece of script I'm running (note that I simply replaced version 1.2 with version 1.4.1).

Thanks for your help thus far Xanathar. As soon as I've finished testing my dungeon I'll hopefully release it and get your treasure chests on show! :)
User avatar
Xanathar
Posts: 629
Joined: Sun Apr 15, 2012 10:19 am
Location: Torino, Italy
Contact:

Re: Selecting a random character

Post by Xanathar »

I fixed that issue in the new version (see its thread).. too late I think :) but thanks for the report :)
Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com

The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563

My preciousss: http://www.moonsharp.org
Post Reply