Frictional Games Forum (read-only)

Full Version: Help with script.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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..
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, "");
}

(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)

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)
(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

No problem Smile