Frictional Games Forum (read-only)
Thalers and Treasure Chests - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Thalers and Treasure Chests (/thread-21744.html)



Thalers and Treasure Chests - TotalFragout - 06-06-2013

I was just wondering how many Thalers (money) i need to open a Treasure Chest and how i can change that in a Custom Story.


RE: Thalers and Treasure Chests - PutraenusAlivius - 06-06-2013

You can adjust how many Thalers you need to open a chest. You can do so, but there will be no menu to say that will you open this or not.


RE: Thalers and Treasure Chests - TotalFragout - 06-06-2013

Where do i change it? Do i need to add a code or something? And how do i see how many Thalers i got in game?


RE: Thalers and Treasure Chests - PutraenusAlivius - 06-06-2013

(06-06-2013, 02:27 PM)TotalFragout Wrote: Where do i change it? Do i need to add a code or something? And how do i see how many Thalers i got in game?

You need to add some scripting. And no, you can't see how many Thalers you have. You need to set the value it self.


RE: Thalers and Treasure Chests - TotalFragout - 06-06-2013

Can you please send me a code? I can rep+ you for the help.


RE: Thalers and Treasure Chests - PutraenusAlivius - 06-06-2013

MEMO
Small is 1
Medium is 5
Large is 10

Let's just say you need two thalers to open a chest. That means Small X 2 because 10 X 2 is 20.
Code:
void OnStart()
{
SetLocalVarInt("ThalerCount", 0); //The LocalVarInt that tracks count of the amount of Thalers you have. Make it Global if you want it across maps.
SetEntityCallbackFunc("coin_medium", "ThalerAdd"); //3 types. Small, Medium, and Large. Make sure they match in the Level Editor and put them in quote ("") in the script. And use _ instead of space.
SetEntityPlayerInteractCallback("Treasure_Chest", "ThalerCheck", false);
}

void ThalerAdd(string &in asEntity, string &in type)
{
AddLocalVarInt("ThalerCount", 1); //Adds thaler count to 1
}

void ThalerCheck(string &in asEntity)
{
if(GetLocalVarInt("ThalerCount") == 2) //2 because the scenario wants it to be two.
{
SetSwingDoorLocked("Treasure_Chest", false, true);
}

else if
{
SetMessage("MessageCategory", "MessageEntry", 0); //You need someone else to explain this part. I can't do it.
}
}



RE: Thalers and Treasure Chests - TotalFragout - 06-06-2013

Thanks man. Rep+ for you.

But there's only 1 error that says "Unexpected end of file"
Below is my ending of the hps file

void ThalerAdd(string &in asEntity, string &in type)
{
if(GetLocalVarInt("ThalerCount") == 2)
{
SetSwingDoorLocked("Treasure_Chest", false, true);
}


RE: Thalers and Treasure Chests - PutraenusAlivius - 06-06-2013

Add another } below the existing one. That should do the trick.


RE: Thalers and Treasure Chests - VeNoMzTeamHysterical - 06-07-2013

(06-06-2013, 05:15 PM)TotalFragout Wrote: Thanks man. Rep+ for you.

But there's only 1 error that says "Unexpected end of file"
Below is my ending of the hps file

void ThalerAdd(string &in asEntity, string &in type)
{
if(GetLocalVarInt("ThalerCount") == 2)
{
SetSwingDoorLocked("Treasure_Chest", false, true);
}

If you wonder why because the first {.
void ThalerAdd(string &in asEntity, string &in type)
{ // first one does not have anything to close it }
if(GetLocalVarInt("ThalerCount") == 2)
{
SetSwingDoorLocked("Treasure_Chest", false, true);
} // And this one belongs to GetLocalVarInt
} // Closes the the bracket on the top.

Hope this explains it a bit to you.