Frictional Games Forum (read-only)
Gandalf's scripting questions thread - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Gandalf's scripting questions thread (/thread-6787.html)

Pages: 1 2


RE: Gandalf's scripting questions thread - gandalf91 - 03-06-2011

So, my interact script still isn't working properly. I've read around that the type of "interaction" can depend on the item, but I'm not sure how I'd go about changing it if need be.

SetEntityPlayerInteractCallback("rock_small_1", "CorridorScream", true);

...

void CorridorScream(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "04_scream.snt", "ScriptArea_8", 0.0f, false);
StartScreenShake(0.025f, 2, 0, 1.5f);
GiveSanityDamage(5.0f, true);
}

I've tried setting the boolean to false, but that didn't help (not that I really expected it to). If I change this function to an entitycollide with player, it works. But I don't want collision with the rock to trigger this event, but when you move it around. I'm not sure if moving it around counts as "interaction" though.


RE: Gandalf's scripting questions thread - Pandemoneus - 03-06-2011

In the wiki you got following:
Code:
/**
* Callback syntax: MyFunc(string &in entity)
*/
void  SetEntityPlayerInteractCallback(string& asName, string& asCallback, bool abRemoveOnInteraction);
/**

The commented line shows you what your formal function parameters have to look like. In this case, when using SetEntityPlayerInteractCallback, you will need a function

Code:
void CorridorScream(string &in entity) {
}

Always take a look at the scripting functions. Wink


RE: Gandalf's scripting questions thread - gandalf91 - 03-06-2011

Ahh..thank you. Smile I can assure you, once I start realizing my mistakes I'll begin picking this all up a lot quicker! At the very start though it's just hard for me to understand what means what and what I need to be looking for when troubleshooting.