Frictional Games Forum (read-only)
WTF Scriptlines! - 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: WTF Scriptlines! (/thread-14982.html)



WTF Scriptlines! - P44RTHURN4X - 04-21-2012

Hello to all here!

I downloaded some custom stories last time. Then I looked at the script files they have (.hps files). I was wondering about this scriptlines:
SetLocalVarInt("Var1", 0);

...
...
...

void chemical_1(string &in asItem, string &in asEntity)
{
RemoveItem("chemical_1");
PlaySoundAtEntity("", "puzzle_add_chemical.snt", "acidbarrel", 0, false);
AddLocalVarInt("Var1", 1);
func01();
}

void chemical_2(string &in asItem, string &in asEntity)
{
RemoveItem("chemical_2");
PlaySoundAtEntity("", "puzzle_add_chemical.snt", "acidbarrel", 0, false);
AddLocalVarInt("Var1", 1);
func01();
}

void chemical_3(string &in asItem, string &in asEntity)
{
RemoveItem("chemical_3");
PlaySoundAtEntity("", "puzzle_add_chemical.snt", "acidbarrel", 0, false);
AddLocalVarInt("Var1", 1);
func01();
}

void func01()
{
if(GetLocalVarInt("Var1") == 3)
{
AddUseItemCallback("", "jar_1", "acidbarrel", "giveacid", true);
PlaySoundAtEntity("", "quest_completed.snt", "Player", 0, false);
}
}

I didn't saw them in my live yet!! What the **** is "LocalVarInt"???
Please tell me, what effects these scripts have.



RE: WTF Scriptlines! - Cranky Old Man - 04-21-2012


LocalVarInt is an integer variable that is local to the script. In this case, it is used to count the number of chemicals added to an acid barrel. When the count reaches three, it will give the player acid and complete the quest.