Frictional Games Forum (read-only)

Full Version: Short question: SetEntityActive for ScriptAreas?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
As the title says, is there any kind of similar function like "SetEntityActive" but for ScriptAreas? I would like the player to walk down a corridor, go into a room, pick something up and then walk back and he hears a sound. Is this possible?
SetEntityActive works for areas too.
ok, thanks ^^
You could also use Variabels:

Code:
void OnStart()
{
SetEntityCallbackFunc("ItemYouWantToPickUp", "PickupItem");
AddEntityCollideCallback("Player", "CollideArea", "CollideArea", false, 0);
SetLocalVarInt("RandomName", 0);
}

void PickupItem(string &in asEntity, string &in OnPickup)
{
SetLocalVarInt("RandomName", 1);
}

void CollideArea(string &in asEntity, string &in asChild, int alState)
{
if(GetLocalVarInt("RandomName")==1)
{
PlaySoundAtEntity(blablabla);
}
else if(GetLocalVarInt("RandomName")==0)
{    //Do nothing
}
}

What it basicly does is that when you pick up the item, it adds a number to the variable. When you walk into the area, you can now hear the sound.