Frictional Games Forum (read-only)
Help with script. - 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: Help with script. (/thread-15005.html)



Help with script. - mattman111 - 04-22-2012

Im still new to scripting but basically i want to enter a area and a monster wakes up breaks a door charges at you then poofs. Here is my script. And he doesn't spawn at all.

void OnStart()
{
PlayMusic("ambience_swoop_myst.ogg", true, 0.8f, 1, 0, true);
AddEntityCollideCallback("Player", "Pop1Area", "Pop1Func", true, 1);
SetEntityCallbackFunc("Pop1Door", "Pop1DoorBreakFunc");
}

void Pop1DoorBreakFunc(string &in asEntity, string &in type)
{
SetEnemyIsHallucination("Pop1Brute", true);
}


void Pop1Func(string &in asParent, string &in asChild, int alState)
{
SetNPCAwake("Pop1Brute", true, true);
ShowEnemyPlayerPosition("Pop1Brute");
}

I used the exact codes from the engine scripts wiki page. I don't know what i'm doing wrong..


RE: Help with script. - Cranky Old Man - 04-22-2012

According to the wiki article you forgot to set up and declare the path nodes:

Code:
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
    SetEntityActive("servant_grunt_1", true);
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 2, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 4, "");
}




RE: Help with script. - mattman111 - 04-22-2012

(04-22-2012, 04:56 PM)Cranky Old Man Wrote: According to the wiki article you forgot to set up and declare the path nodes:

Code:
code
But since im just enabling him and he charges at me shouldn't i not need the path nodes?

(He still doesn't spawn with path nodes FYI)




RE: Help with script. - JetlinerX - 04-22-2012

Your collide callback syntax is wrong, try this:

Code:
void OnStart()
{
PlayMusic("ambience_swoop_myst.ogg", true, 0.8f, 1, 0, true);
AddEntityCollideCallback("Player", "Pop1Area", "Pop1Func", true, 1);
SetEntityCallbackFunc("Pop1Door", "Pop1DoorBreakFunc");
}

void Pop1DoorBreakFunc(string &in asParent, string &in asChild, int alState)
{
SetEnemyIsHallucination("Pop1Brute", true);
}

void Pop1Func(string &in asParent, string &in asChild, int alState)
{
SetNPCAwake("Pop1Brute", true, true);
ShowEnemyPlayerPosition("Pop1Brute");
}

This was your problem:
void Pop1DoorBreakFunc(string &in asEntity, string &in type)

Changed to:

void Pop1DoorBreakFunc(string &in asParent, string &in asChild, int alState)


RE: Help with script. - mattman111 - 04-22-2012

(04-22-2012, 05:13 PM)JetlinerX Wrote: Your collide callback syntax is wrong, try this:

Code:
void OnStart()
{
PlayMusic("ambience_swoop_myst.ogg", true, 0.8f, 1, 0, true);
AddEntityCollideCallback("Player", "Pop1Area", "Pop1Func", true, 1);
SetEntityCallbackFunc("Pop1Door", "Pop1DoorBreakFunc");
}

void Pop1DoorBreakFunc(string &in asParent, string &in asChild, int alState)
{
SetEnemyIsHallucination("Pop1Brute", true);
}

void Pop1Func(string &in asParent, string &in asChild, int alState)
{
SetNPCAwake("Pop1Brute", true, true);
ShowEnemyPlayerPosition("Pop1Brute");
}

This was your problem:
void Pop1DoorBreakFunc(string &in asEntity, string &in type)

Changed to:

void Pop1DoorBreakFunc(string &in asParent, string &in asChild, int alState)
worked thanks <3




RE: Help with script. - JetlinerX - 04-22-2012

No problem Smile