Frictional Games Forum (read-only)

Full Version: SetEntityPlayerInteractCallback!?!?!?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So I have been trying to make sort of a dramatic moment in my custom story, and It is not working. So basically there is a knife on the floor and you have to find it all drugged. When you pick it up a bunch of stuff happens.
Here is the script:



SetEntityPlayerInteractCallback("Knife_1", "Murder", true);
}

void Murder(string &in asParent, string &in asChild, int alState)
{
StopMusic(1, 0);
FadeIn(1);
AddTimer("Timer2", 4, "Into2");
GetPlayerSpeed();
SetPlayerJumpDisabled(false);
SetPlayerMoveSpeedMul(0)
}

void Into2(string &in asTimer)
{
FadeOut(1);
AddTimer("Timer3", 2, "Sounds1");
}

void Sounds1(string &in asTimer)
{
PlaySoundAtEntity("", "24_cut.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_breath.snt", "Player", 0, false);
AddTimer("Timer4", 27, "Neworld1");
}

void Neworld1(string &in asTimer)
{
ChangeMap("02.map", "PlayerStartArea_1", "", "");
}


I have the OnStart(), OnEnter(), OnLeave()
Have any questions I will be happy to answer them.



EDIT:
In the Level Editor, I named the knife, "Knife_1"
I also went into the .lang and put:



<Entry Name="ItemDesc_knife_1">Knife to cut.</Entry>
<Entry Name="ItemName_knife_1">Knife</Entry>
You have the wrong interact callback syntax.
The callback syntax for the function "Murder" is incorrect; it should be (string &in asEntity) instead of the callback you currently have.
SetEntityPlayerInteractCallback will be called when "walking" on or touch the item.
SetEntityCallbackFunc("knife", "OnPickup"); = iwill be called when picking up the item.
void OnPickup(string &in asEntity, string &in type)
{
StopMusic(1, 0);
FadeIn(1);
AddTimer("Timer2", 4, "Into2");
GetPlayerSpeed();
SetPlayerJumpDisabled(false);
SetPlayerMoveSpeedMul(0)}
(07-02-2012, 02:53 PM)EXAWOLT Wrote: [ -> ]SetEntityPlayerInteractCallback will be called when "walking" on or touch the item.

Walking on an object is not a form of interaction.
my wrong sorry, but i cant seem to edit my comment, somethings wrong:/
Finished! Yeah, It was the wrong syntax thank you guys SO MUCH!
(07-02-2012, 03:48 PM)Jagsrs28 Wrote: [ -> ]Finished! Yeah, It was the wrong syntax thank you guys SO MUCH!
Incase you want to make stuff happend when you walk on it put a small script area over it and use AddEntityCollideCallback.
(07-02-2012, 06:25 PM)LulleBulle Wrote: [ -> ]
(07-02-2012, 03:48 PM)Jagsrs28 Wrote: [ -> ]Finished! Yeah, It was the wrong syntax thank you guys SO MUCH!
Incase you want to make stuff happend when you walk on it put a small script area over it and use AddEntityCollideCallback.
I know ,but thanks anyways!