Frictional Games Forum (read-only)
SetEntityPlayerInteractCallback!?!?!? - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: SetEntityPlayerInteractCallback!?!?!? (/thread-16682.html)



SetEntityPlayerInteractCallback!?!?!? - Jagsrs28 - 07-02-2012

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>



RE: SetEntityPlayerInteractCallback!?!?!? - Your Computer - 07-02-2012

You have the wrong interact callback syntax.


RE: SetEntityPlayerInteractCallback!?!?!? - Adny - 07-02-2012

The callback syntax for the function "Murder" is incorrect; it should be (string &in asEntity) instead of the callback you currently have.


RE: SetEntityPlayerInteractCallback!?!?!? - EXAWOLT - 07-02-2012

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)}


RE: SetEntityPlayerInteractCallback!?!?!? - Your Computer - 07-02-2012

(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.


RE: SetEntityPlayerInteractCallback!?!?!? - EXAWOLT - 07-02-2012

my wrong sorry, but i cant seem to edit my comment, somethings wrong:/


RE: SetEntityPlayerInteractCallback!?!?!? - Jagsrs28 - 07-02-2012

Finished! Yeah, It was the wrong syntax thank you guys SO MUCH!


RE: SetEntityPlayerInteractCallback!?!?!? - LulleBulle - 07-02-2012

(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.


RE: SetEntityPlayerInteractCallback!?!?!? - Jagsrs28 - 07-02-2012

(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!