Frictional Games Forum (read-only)

Full Version: Making a grunt appear after keypickup
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, I am pretty new to scripting and all that, and I require your help.

Basically the player picks up a key, and a grunt should appear behind the door to the room. How do I do this?

I've already done this with a tinderbox, my script looks like this:


void TakeTinder(string &in asEntity)
{
SetEntityActive("servant_grunt_1", true);
}

void OnStart()
{
SetEntityPlayerInteractCallback("tinderbox_1", "TakeTinder", true);
}


void OnEnter()
{

}

void OnLeave()
{

}

Thank you
Use SetEntityCallbackFunc(string& asName, string& asCallback) for this one. It'll call the function based on what entity you use. In the case of the key, it'll call it when you pick it up.
(04-08-2011, 01:45 PM)MrBigzy Wrote: [ -> ]Use SetEntityCallbackFunc(string& asName, string& asCallback) for this one. It'll call the function based on what entity you use. In the case of the key, it'll call it when you pick it up.

I am curious about how this would work actually, where exactly would you use the set entity callback? Would you replace it with the set player interact func?
Thanks =)
Yeah, simply put that one callback in OnStart or somewhere, and link it to the key with the entity name. Or something. That one kinda confuses me actually, cause I don't see how it can tell what entity to use. I used the level editor for this, you can put the function name for the entity right in there.
Could I have an example of the script? I am a bit confused, but I'll learn.
It would help a lot, and I would appreciate it
Code:
void BackTrack(string &in asEntity, string &in asType)
{
   AddEntityCollideCallback("Player", "EnemyBack", "EnemyBack", true, 1);
   AddEntityCollideCallback("Player", "Flicker", "Flicker", true, 1);
   StartScreenShake(0.2f, 4, 1, 1);
   PlaySoundAtEntity("enemy_hallucination_disappear", "enemy_hallucination_disappear.snt", "Player", 0, false);
   PlaySoundAtEntity("guardian_distant3", "guardian_distant3.snt", "Player", 0, false);
}

And then I selected the key I had, and there should be a line for the CallbackFunc, and I put BackTrack there. You don't need to put the Callback in your script that way.