lordmestari
Junior Member
Posts: 22
Threads: 8
Joined: Apr 2011
Reputation:
0
|
Making a grunt appear after keypickup
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
(This post was last modified: 04-08-2011, 10:46 AM by lordmestari.)
|
|
04-08-2011, 10:42 AM |
|
MrBigzy
Senior Member
Posts: 616
Threads: 18
Joined: Mar 2011
Reputation:
8
|
RE: Making a grunt appear after keypickup
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 |
|
Simpanra
Senior Member
Posts: 314
Threads: 28
Joined: Mar 2011
Reputation:
0
|
RE: Making a grunt appear after keypickup
(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 =)
|
|
04-08-2011, 02:07 PM |
|
MrBigzy
Senior Member
Posts: 616
Threads: 18
Joined: Mar 2011
Reputation:
8
|
RE: Making a grunt appear after keypickup
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.
(This post was last modified: 04-08-2011, 02:33 PM by MrBigzy.)
|
|
04-08-2011, 02:14 PM |
|
lordmestari
Junior Member
Posts: 22
Threads: 8
Joined: Apr 2011
Reputation:
0
|
RE: Making a grunt appear after keypickup
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
|
|
04-08-2011, 02:26 PM |
|
MrBigzy
Senior Member
Posts: 616
Threads: 18
Joined: Mar 2011
Reputation:
8
|
RE: Making a grunt appear after keypickup
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.
|
|
04-08-2011, 02:36 PM |
|
|