Frictional Games Forum (read-only)

Full Version: Need help making a body creep up behind you
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Okay, so here's what I've got in this level: a room with a dead body on the table, and a hallway with an monster that activates.

These are the things I'm hoping to accomplish with these rooms, in player interaction order:

1. When Player interacts with door, monster appears on other side and breaks it down and disappears at certain distance from the player. (ACCOMPLISHED)

2.When Player progresses towards end of the hallway, script activates that makes scream come from the dead body in the room behind and the body disappears (ACCOMPLISHED)

3. If Player returns to room to investigate the sound, he most likely steps into a previously inactive script area (activated by the screaming one at the end of the hallway) that makes the dead body appear floating in the air behind him in the hallway which disappears when he looks directly at it and plays a sound. (NOT ACCOMPLISHED)

In summary, my problem is, how do you activate an inactive script that does something?

Here's my room's script so far (It's pretty short, no worries.):

void OnStart()
{
FadeOut (0);
FadeIn(15);

PlayMusic("18_amb.ogg", true, 1.0f, 3.0f, 0, true);
}

void OnEnter()
{
SetEntityPlayerInteractCallback("castle_no_grav_1", "monster", true);
SetEntityPlayerLookAtCallback("antidote_corpse_drilled_2", "disappear", true);
AddEntityCollideCallback("Player", "Scream_Script", "death", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_1", "behind", true, 1);
}

void monster(string& asName)
{
SetEntityActive("servant_grunt_1", true);
}

void death(string&in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "15_man_hunted.snt", "antidote_corpse_drilled_1", 0, false);
SetEntityActive("antidote_corpse_drilled_1", false);
SetEntityActive("ScriptArea_1", true);
}

void behind (string&in asParent, string &in asChild, int alState)
{
SetEntityActive("antidote_corpse_drilled_2", true);
}

void disappear(string&in asEntity, int alState)
{
SetEntityActive("antidote_corpse_drilled_2", false);
}

So I'm basically trying to make the "disappear" function work, but it works on a script that is activated by the first script area for "death". Help?
Okay, First to activate a script that isn't activated yet.

you just had to put SetEntityActive("ScriptName", true);

I see in your script You already have that down. Do you have your Script Inactive in the level editor?

-Grey Fox
(08-21-2011, 08:04 PM)GreyFox Wrote: [ -> ]Okay, First to activate a script that isn't activated yet.

you just had to put SetEntityActive("ScriptName", true);

I see in your script You already have that down. Do you have your Script Inactive in the level editor?

-Grey Fox

Omg, I just realized... I didn't save the level after I had added the script... disregard my stupidity. Big Grin
It's okay, it happens. Tongue Any name for this we can look forward to?