[mod-wip] Treasury - General Help Me

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Glew
Posts: 64
Joined: Sat Dec 21, 2013 7:57 pm

Re: [mod-wip] Treasury - General Help Me

Post by Glew » Tue Feb 10, 2015 6:47 pm

Yeah, that's how I've done it.

Code: Select all

cloneObject{
	name = "bitter_cup",
	baseObject = "golden_chalice",
	uiName = "Bitter Cup",
	description = "This cursed cup magically poisons any drink put in it. \n The chancellor will pay a nice sum for it.",
}

defineObject{
		name = "tome_azrandula",
		class = "Item",
		uiName = "The Book of Azrandula",
		model = "assets/models/items/tome.fbx",
		description = "The handwritten Grimoire of the Master Poisoner. \n Practically invaluable.",
		gfxIndex = 30,
		weight = 1.0,
		treasure = true, 		
	}
On top of these, there is a plain old golden orb in the dungeon. So that makes 3 treasure items. Yet when I pick them up, it tells me that the total number of treasure in the dungeon is 2 (not 3). When I pick 1 up it says "Treasure found 1/2", when I pick up the next it says "2/2" and then when I pick up the 3rd on it says "3/2".
Is there some underlying code to keep track of treasures?

minmay
Posts: 2700
Joined: Mon Sep 23, 2013 2:24 am

Re: [mod-wip] Treasury - General Help Me

Post by minmay » Tue Feb 10, 2015 7:24 pm

If a treasure is spawned after the beginning of the game it won't be reflected in the maximum treasure count. This might happen with treasures in containers too, haven't tested.
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.

Glew
Posts: 64
Joined: Sat Dec 21, 2013 7:57 pm

Re: [mod-wip] Treasury - General Help Me

Post by Glew » Tue Feb 10, 2015 7:35 pm

minmay wrote:If a treasure is spawned after the beginning of the game it won't be reflected in the maximum treasure count. This might happen with treasures in containers too, haven't tested.
Interesting, all 3 of them are on an altar type item (2 altars and 1 round table). I'll check if changing that makes a difference.
But I suspect that the problem is caused by the custom defined treasure. I vaguely recall something about a table or something that contains all the treasure items...?
It must be related to the game stats. I'll do some research on it.

edit: Thanks for the tip minmay! It turns out I spawned one of the treasures from a script. Spawning it from the altar's option panel makes it behave normally. (I just hope I didn't reference the unique id of the spawned treasure in an other script... :? )

minmay
Posts: 2700
Joined: Mon Sep 23, 2013 2:24 am

Re: [mod-wip] Treasury - General Help Me

Post by minmay » Wed Feb 11, 2015 12:13 am

you could also just add an unreachable treasure (and destroy it in a script if you want) to make the max treasure count correct without having to get rid of dynamic treasure spawning
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.

Glew
Posts: 64
Joined: Sat Dec 21, 2013 7:57 pm

Re: [mod-wip] Treasury - General Help Me

Post by Glew » Sat Apr 11, 2015 8:08 pm

Hi,

I was wondering if there is a way to check if an item is a treasure. I know you can call for it's id, name or class so you can do things like

Code: Select all

if i.class=="item" or i.name=="blue_gem"
then --do something
I know that the game must somehow "know" if an item is treasure, because it counts them and plays a sound etc. So there must be some sort of code that accesses the "treasureness" of an item on pick-up. Can I use that?
What I want to do is count all the treasures the player collected by the end of the mod for a kind of score maybe alternate endings.

I was also wondering if it's not straight-up possible to just access the treasure quality of an item, maybe I could use tables? Define a table with all the treasures I placed and then somehow compare that table against the player inventory? Related to this: can you iterate through bags and containers that are in the inventory? If yes then how?

Post Reply