Frictional Games Forum (read-only)
Help with GetLocalVarInt - 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: Help with GetLocalVarInt (/thread-8957.html)



Help with GetLocalVarInt - Paulpolska - 07-04-2011

I have script that we must put three wheels to machine after my next function must show message if GetLocalVarInt = 3. Of course don't show

Code:
void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "Plax", true, 1);
AddEntityCollideCallback("cogwheel_tiny01_4", "StickyArea_3", "CollideWheel", false, 1);
AddEntityCollideCallback("cogwheel_tiny01_5", "StickyArea_1", "CollideWheel", false, 1);
AddEntityCollideCallback("cogwheel_tiny01_6", "StickyArea_2", "CollideWheel", false, 1);
}


void CollideWheel(string &in asParent, string &in asChild, int alState)
{
    AddLocalVarInt("asChild", 1);
    PlaySoundAtEntity("", "impact_metal_low", "Player", 0.05f, false);
    
}


void StartSectionDead(string &in asChild, int alVal)
{
if(GetLocalVarInt("asChild") != 3) {
SetMessage("Journal", "Slime", 0);
}
}



RE: Help with GetLocalVarInt - DamnNoHtml - 07-04-2011

I don't see anywhere where "StartSectionDead" is actually being called.

Also, != 3 means not equal to 3.


RE: Help with GetLocalVarInt - Paulpolska - 07-04-2011

If i set "==" too is don't work. Hmm how I call this function when three wheels is putting ?

I check it but still is dead

Code:
void CollideWheel(string &in asParent, string &in asChild, int alState)
{
    AddLocalVarInt("asChild", 1);
    PlaySoundAtEntity("", "impact_metal_low", "Player", 0.05f, false);
    if(GetLocalVarInt("asChild") == 3) {
      AddEntityCollideCallback("Player", "ScriptArea_2", "StartSectionDead", false, 1);
}
}


void StartSectionDead(string &in asParent, string &in asChild, int alState)
{
SetMessage("Journal", "Slime", 0);
}



RE: Help with GetLocalVarInt - Kyle - 07-04-2011

You must set a local var int first be adding.

Use this:

SetLocalVarInt("asChild", 0); in your void OnStart()

It's just all messed up... :/


RE: Help with GetLocalVarInt - palistov - 07-05-2011

You don't need to use quotation marks when using the asChild reference. asChild is already a string, and you use " " to denote a string. You're basically saying ""asChild"". Also, you need to script the collide callback in your OnStart, as well as declare the variable beforehand. Like Kyle said, use SetLocalVarInt() to declare your variable. Since we don't know what your asChild is named, you'll need to do that on your own.


RE: Help with GetLocalVarInt - Paulpolska - 07-05-2011

Easy I finished this problem yesterday ;] thanks all