Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with script.
mattman111 Offline
Junior Member

Posts: 3
Threads: 1
Joined: Apr 2012
Reputation: 0
#1
Help with script.

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..
(This post was last modified: 04-22-2012, 05:23 PM by mattman111.)
04-22-2012, 04:48 PM
Find
Cranky Old Man Offline
Posting Freak

Posts: 986
Threads: 20
Joined: Apr 2012
Reputation: 38
#2
RE: Help with script.

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

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, "");
}


Noob scripting tutorial: From Noob to Pro

04-22-2012, 04:56 PM
Find
mattman111 Offline
Junior Member

Posts: 3
Threads: 1
Joined: Apr 2012
Reputation: 0
#3
RE: Help with script.

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

04-22-2012, 05:08 PM
Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#4
RE: Help with script.

Your collide callback syntax is wrong, try this:

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)

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

(This post was last modified: 04-22-2012, 05:16 PM by JetlinerX.)
04-22-2012, 05:13 PM
Website Find
mattman111 Offline
Junior Member

Posts: 3
Threads: 1
Joined: Apr 2012
Reputation: 0
#5
RE: Help with script.

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

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

04-22-2012, 05:19 PM
Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#6
RE: Help with script.

No problem Smile

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

04-22-2012, 05:39 PM
Website Find




Users browsing this thread: 1 Guest(s)