Frictional Games Forum (read-only)

Full Version: Thalers and Treasure Chests
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
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.
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?
(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.
Can you please send me a code? I can rep+ you for the help.
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.
}
}
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);
}
Add another } below the existing one. That should do the trick.
(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.