Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Variables and Closet Scares
Mrpeanut188 Offline
Junior Member

Posts: 2
Threads: 1
Joined: Oct 2012
Reputation: 0
#1
Variables and Closet Scares

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:
////////////////////////////
// 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);
}
}
10-28-2012, 08:25 AM
Find
craven7 Offline
Member

Posts: 50
Threads: 8
Joined: Aug 2012
Reputation: 1
#2
RE: Variables and Closet Scares

Your syntax is wrong.

Use these instead to access variables:
    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.
(This post was last modified: 10-28-2012, 01:34 PM by craven7.)
10-28-2012, 01:32 PM
Find
Mrpeanut188 Offline
Junior Member

Posts: 2
Threads: 1
Joined: Oct 2012
Reputation: 0
#3
RE: Variables and Closet Scares

(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.
(This post was last modified: 10-29-2012, 12:40 AM by Mrpeanut188.)
10-29-2012, 12:25 AM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#4
RE: Variables and Closet Scares

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

Trying is the first step to success.
10-29-2012, 07:32 AM
Find




Users browsing this thread: 1 Guest(s)