Frictional Games Forum (read-only)
Can anyone find the script error? - 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: Can anyone find the script error? (/thread-18351.html)



Can anyone find the script error? - danimora2012 - 09-15-2012

////////////////////////////
//Run First Time Starting map
void OnStart()
{
SetEntityCallbackFunc("key", "Jump");
}

void jump(string &in asEntity, string &in type)
{
SetEntityActive("bro_1", true);
}


////////////////////////////
// Run when leaving map
void OnLeave()

i can't make the guy pop out when i pick up the key...

Name of the key -- key
Name of guy -- bro_1
Name of area -- Jump


RE: Can anyone find the script error? - FlawlessHappiness - 09-15-2012

Check the script wiki. It's:

SetEntityPlayerInteractCallback(string& asName, string& asCallback, bool abRemoveOnInteraction);

Calls a function when the player interacts with a certain entity.
Callback syntax: void MyFunc(string &in asEntity)
asName - internal name
asCallback - function to call
abRemoveOnInteraction - determines whether the callback should be removed when the player interacts with the entity

[/color]


RE: Can anyone find the script error? - Wapez - 09-15-2012

It should be like this:

PHP Code:
//////////////////////////////Run First Time Starting map
void OnStart()
{
SetEntityPlayerInteractCallback("key""Jump"true);
}

void Jump(string &in asEntitystring &in type)
{
SetEntityActive("bro_1"true);
}


////////////////////////////
// Run when leaving map
void OnLeave() 



RE: Can anyone find the script error? - danimora2012 - 09-15-2012

(09-15-2012, 08:25 PM)Wapez Wrote: It should be like this:

PHP Code:
//////////////////////////////Run First Time Starting map
void OnStart()
{
SetEntityPlayerInteractCallback("key""Jump"true);
}

void Jump(string &in asEntitystring &in type)
{
SetEntityActive("bro_1"true);
}


////////////////////////////
// Run when leaving map
void OnLeave() 
Uuuuuh...that's exacly the same... Dodgy


RE: Can anyone find the script error? - The chaser - 09-15-2012

(09-15-2012, 08:45 PM)danimora2012 Wrote:
(09-15-2012, 08:25 PM)Wapez Wrote: It should be like this:

PHP Code:
//////////////////////////////Run First Time Starting map
void OnStart()
{
SetEntityPlayerInteractCallback("key""Jump"true);
}

void Jump(string &in asEntitystring &in type)
{
SetEntityActive("bro_1"true);
}


////////////////////////////
// Run when leaving map
void OnLeave() 
Uuuuuh...that's exacly the same... Dodgy
No, it isn't. Check the SetEntityPlayerInteractCallback. You don't have that.

http://wiki.frictionalgames.com/hpl2/tutorials/start
http://wiki.frictionalgames.com/hpl2/tutorials/scripting/triggering_monsters_on_entities

The first link are the tutorials in the wiki. Please, before creating a thread asking something, check the wiki. The second link explains how to trigger a monster in an entity. Follow the instructions and all will be fine.

Also, here are the engine scripts. It says every single function:

http://wiki.frictionalgames.com/hpl2/amnesia/script_functions

Please, development support is for things that you may not understand in the wiki. Use this section if you can't find your answer. We are always happy to help, but try to solve yourself your problems always that you can.


RE: Can anyone find the script error? - danimora2012 - 09-15-2012

(09-15-2012, 08:52 PM)The chaser Wrote:
(09-15-2012, 08:45 PM)danimora2012 Wrote:
(09-15-2012, 08:25 PM)Wapez Wrote: It should be like this:

PHP Code:
//////////////////////////////Run First Time Starting map
void OnStart()
{
SetEntityPlayerInteractCallback("key""Jump"true);
}

void Jump(string &in asEntitystring &in type)
{
SetEntityActive("bro_1"true);
}


////////////////////////////
// Run when leaving map
void OnLeave() 
Uuuuuh...that's exacly the same... Dodgy
No, it isn't. Check the SetEntityPlayerInteractCallback. You don't have that.

http://wiki.frictionalgames.com/hpl2/tutorials/start
http://wiki.frictionalgames.com/hpl2/tutorials/scripting/triggering_monsters_on_entities

The first link are the tutorials in the wiki. Please, before creating a thread asking something, check the wiki. The second link explains how to trigger a monster in an entity. Follow the instructions and all will be fine.

Also, here are the engine scripts. It says every single function:

http://wiki.frictionalgames.com/hpl2/amnesia/script_functions

Please, development support is for things that you may not understand in the wiki. Use this section if you can't find your answer. We are always happy to help, but try to solve yourself your problems always that you can.
Alright...now i have this but still doesn't work...


//////////////////////////////Run First Time Starting map
void OnStart()
{
SetEntityPlayerInteractCallback("Player", "bro_1", "true");
}

void Jump(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("bro_1", true);
AddPropForce("bro_1", 0, 0, -9000, "world");
PlaySoundAtEntity("", "ahhh.snt", "Player", 0, false);
}

////////////////////////////// Run when leaving map
void OnLeave()


RE: Can anyone find the script error? - The chaser - 09-15-2012

Then try with SetEntityCallbackFunc("key", "Jump");


RE: Can anyone find the script error? - Your Computer - 09-15-2012

Not sure how you managed to copy and paste and ruin the syntax of the callback. The original issue was that the callback syntax was incorrect and that the callback function name didn't match. And now it's the same issue, along with the fact that you converted a boolean into a string.


RE: Can anyone find the script error? - The chaser - 09-15-2012

(09-15-2012, 10:06 PM)Your Computer Wrote: Not sure how you managed to copy and paste and ruin the syntax of the callback. The original issue was that the callback syntax was incorrect and that the callback function name didn't match. And now it's the same issue, along with the fact that you converted a boolean into a string.
Damn, I didn't saw that. It's true: Jump and jump.

Confused How I couldn't see that? Confused


RE: Can anyone find the script error? - FlawlessHappiness - 09-15-2012

*cough*(string &in asEntity) *cough*

Wink this syntax is what means: you are interacting with something and calling a function by it