Frictional Games Forum (read-only)
Chase Problem.. help? - 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: Chase Problem.. help? (/thread-21559.html)



Chase Problem.. help? - Bonehead - 05-20-2013

I don't understand why I'm getting this.. heres the script..

void OnStart()
{
SetEntityPlayerInteractCallback("lantern_1", "ActivateMonster", true);
AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
SetEntityCallbackFunc("key1", "OnPickup");
AddUseItemCallback("", "key1", "dining_door", "UsedKeyOnDoor", true);
AddUseItemCallback("", "key2", "secret_door", "UseKeyOnDoor", true);
SetEntityPlayerInteractCallback("key2", "ActivateGrunt", true);
SetEntityPlayerInteractCallback("tome", "ActivateRun", true);
}


void OnEnter()
{

}

void OnLeave()
{
}

void ActivateMonster(string &in item)
{
SetEntityActive("servant_brute_1", true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_13", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_15", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_10", 0, "");
}

void ActivateGrunt(string &in item)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_23", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_25", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_17", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_13", 0, "");
SetEntityActive("armour_nice_complete_7", false);

void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("door_2", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}

void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("armour_nice_complete_8", true);
SetEntityActive("armour_nice_complete_7", true);
SetEntityActive("armour_nice_complete_6", false);
SetEntityActive("armour_nice_complete_5", false);
PlaySoundAtEntity("", "impact_wood_heavy_med3.snt", "armour_nice_complete_8", 0.1f, true);
PlaySoundAtEntity("", "impact_wood_heavy_med3.snt", "armour_nice_complete_7", 0.1f, true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("dining_door", false, true);
PlaySoundAtEntity("", "unlock_door", "dining_door", 0, false);
RemoveItem("key1");
}

void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("secret_door", false, true);
PlaySoundAtEntity("", "unlock_Door", "secret_door", 0, false);
RemoveItem("key2");
}


void ActivateRun(string &in Item)
{
SetEntityActive("servant_grunt_2" true);
ShowEnemyPlayerPosition("servant_grunt_2", true);
}


Here is the Error: No Matching Signatures to 'showenemyplayerposition(string@&, const bool)'
What am I doing wrong? Sad


RE: Chase Problem.. help? - Bridge - 05-20-2013

It appears ShowEnemyPlayerPosition only accepts strings as parameters. I found this in the HPL reference after like 30 secs of searching:

Code:
void ShowEnemyPlayerPosition(string& asName);


Makes the enemy run to the player, no matter where he is.
Also, it seems like you're missing a bracket in the function ActivateGrunt. It's left open.


RE: Chase Problem.. help? - Bonehead - 05-20-2013

(05-20-2013, 05:13 PM)Bridge Wrote: It appears ShowEnemyPlayerPosition only accepts strings as parameters. I found this in the HPL reference after like 30 secs of searching:

Code:
void ShowEnemyPlayerPosition(string& asName);


Makes the enemy run to the player, no matter where he is.
Also, it seems like you're missing a bracket in the function ActivateGrunt. It's left open.

That's the thing. I've found that bit of script.. That's what gave me the idea.. But my brain is just refusing to understand it lol. I'm not sure why it's not accepting it. I fixed the missing bracket though.


RE: Chase Problem.. help? - Bridge - 05-20-2013

I don't think you understand. The function cannot accept it. The function declaration makes no mention of a Boolean variable, and therefore it is impossible to pass a Boolean variable into it as a parameter. It changes literally nothing, because "true" doesn't mean anything in this context. Does the function not do what you want if you just pass in a string?

EDIT: As in:

Code:
ShowEnemyPlayerPosition("servant_grunt_2");

This should make servant_grunt_2 run towards the player.


RE: Chase Problem.. help? - Bonehead - 05-20-2013

(05-20-2013, 05:30 PM)Bridge Wrote: I don't think you understand. The function cannot accept it. The function declaration makes no mention of a Boolean variable, and therefore it is impossible to pass a Boolean variable into it as a parameter. It changes literally nothing, because "true" doesn't mean anything in this context. Does the function not do what you want if you just pass in a string?

EDIT: As in:

Code:
ShowEnemyPlayerPosition("servant_grunt_2");

This should make servant_grunt_2 run towards the player.

That's the thing. I didn't understand. I just started scripting a few days ago with no previous experience or understanding of it, but thank you for pointing out what I did wrong. With almost everything I'm using requiring the True value at the end, it sort of became a habit rather than actual known knowledge. I will give this a shot.

EDIT: That did the trick. Thank you.


RE: Chase Problem.. help? - Bridge - 05-20-2013

(05-20-2013, 05:51 PM)Bonehead Wrote:
(05-20-2013, 05:30 PM)Bridge Wrote: I don't think you understand. The function cannot accept it. The function declaration makes no mention of a Boolean variable, and therefore it is impossible to pass a Boolean variable into it as a parameter. It changes literally nothing, because "true" doesn't mean anything in this context. Does the function not do what you want if you just pass in a string?

EDIT: As in:

Code:
ShowEnemyPlayerPosition("servant_grunt_2");

This should make servant_grunt_2 run towards the player.

That's the thing. I didn't understand. I just started scripting a few days ago with no previous experience or understanding of it, but thank you for pointing out what I did wrong. With almost everything I'm using requiring the True value at the end, it sort of became a habit rather than actual known knowledge. I will give this a shot.

EDIT: That did the trick. Thank you.

No problem, I'm glad you sorted out your problem.