Frictional Games Forum (read-only)
multiple functions problem - 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: multiple functions problem (/thread-10668.html)



multiple functions problem - reptalol - 10-09-2011

I appologize for two threads so soon of eachother, and definitely thanks for solving my problem earlier! But i've ran into another one, this one regarding my script. Ive watched several guides and read every tutorial i could find, but i'm not 100% sure what's wrong with this script, can you guys tell me?

PHP Code:
void OnStart()
{
FadeOut(float (0));
SetPlayerSanity(float (0));
StartScreenShake(float (1), float (1), float (1), float (2));FadeIn(float (7));


AddEntityCollideCallback("Player""SanityTest""Scripttest"true, (1));SetEntityCallbackFunc("beginninglantern""lanterntrigger")}
void Scripttest(string &in asParentstring &in asChildint alState) {SetPlayerSanity(float (65));}
void lanterntrigger(string &in asEntitystring &in type) {SetSwingDoorClosed("castle_1"truetrue);} 



RE: multiple functions problem - Tanshaydar - 10-09-2011

You don't have to write float (1) for float numbers, writing just 1 will automatically convert it to float.

Do you have any familiarity with identation which helps the code to be readable.

Write your numbers without float (1) or any parentheses. For further examples, you can look into the actual game maps scrip files.


RE: multiple functions problem - reptalol - 10-09-2011

Oh thanks! As i said earlier im very new too this, but the problem im having was with the SetEntityCallbackFunc part, the first callback worked fine, but when they're both together my map wont start it would seem.


RE: multiple functions problem - Tanshaydar - 10-09-2011

There are types of callbacks depends on what you want to do.
Collision callbacks (collide callback)
Interaction callbacks (interact callback)
State callbacks (for wheels and levers, statechange callback)
and special type of callbacks like "OnIgnite", "OnBreak" and "OnPickup"

I'm sure you want to do something as soon as player picks up lantern. So it's easy. Just set the lanterntrigger name into the interaction callback section of entity tab.

void lanterntrigger(string &in asEntity)
{
SetSwingDoorClosed("castle_1", true, true);
}


for further reference http://wiki.frictionalgames.com/hpl2/amnesia/script_functions


RE: multiple functions problem - reptalol - 10-09-2011

perfect! Thanks so much that's excatly what i needed help on Tongue