Page 5 of 5
Re: [mod-wip] Treasury - General Help Me
Posted: Tue Feb 10, 2015 6:47 pm
by Glew
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?
Re: [mod-wip] Treasury - General Help Me
Posted: Tue Feb 10, 2015 7:24 pm
by minmay
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.
Re: [mod-wip] Treasury - General Help Me
Posted: Tue Feb 10, 2015 7:35 pm
by Glew
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...

)
Re: [mod-wip] Treasury - General Help Me
Posted: Wed Feb 11, 2015 12:13 am
by minmay
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
Re: [mod-wip] Treasury - General Help Me
Posted: Sat Apr 11, 2015 8:08 pm
by Glew
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?