Frictional Games Forum (read-only)
[SCRIPT] Variables and Closet Scares - 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: [SCRIPT] Variables and Closet Scares (/thread-18957.html)



Variables and Closet Scares - Mrpeanut188 - 10-28-2012

For my map I am having a closet right next to the first spawn, and when opened, a grunt is inside. Problem is, when they respawn, I want to to not be there. So, I am using boolean variable 'ClosetTriggered' to check if it has already been activated. I have it set in the OnStart() function, and it still gives tells me it is not declared.

Here is the part of the script relating to it:
Code:
////////////////////////////
// Run when the map starts
void OnStart()
{
    AddUseItemCallback("", "Pick", "StartDoor", "UNLOCK", true);
    AddEntityCollideCallback("Player", "RoomScare", "ClosetScare", true, 1);
    bool (ClosetTriggered == false);
}


//GRUNT IN CLOSET SCARE
void ClosetScare(string &in asParent, string &in asChild, int alState)
{
for (ClosetTriggered == true);
{
SetEntityActive("ClosetMonster", false);
}
else
{
SetEntityActive("ClosetMonster", true);
(ClosetTriggered == true);
}
}



RE: Variables and Closet Scares - craven7 - 10-28-2012

Your syntax is wrong.

Use these instead to access variables:
Code:
    SetLocalVarInt("closetTriggered",0);


    if(GetLocalVarInt("closetTriggered") == 0)
    {
          // do Scare
          // SetLocalVarInt("closetTriggered",1);
    }
Also you should consider thinking about your game/map design... a scare right in the beginning doesn't really fit the amnesia style.... but this is your choice.


RE: Variables and Closet Scares - Mrpeanut188 - 10-29-2012

(10-28-2012, 01:32 PM)craven7 Wrote: Your syntax is wrong.
Hmm, I did try the LocalVar functions, but they didn't work either. Must of done it wrong

Quote:Also
you should consider thinking about your game/map design... a scare
right in the beginning doesn't really fit the amnesia style.... but this
is your choice.
Yeah, I agree. That is why I only want it once. However, this is one of a few jump-scares in the map. The closet is the nearest thing to the spawn, besides the lantern and a note. So the closet should be about the first thing to happen in the map....

[Edit]
Ahh, thanks. After a few minutes of tweaking, I realized I didn't have to do an else to set the entity to non-active, as it already was. Thanks again, he works quite nicely.


RE: Variables and Closet Scares - FlawlessHappiness - 10-29-2012

What you did was using "for", instead of "if".w