mattman111
Junior Member
Posts: 3
Threads: 1
Joined: Apr 2012
Reputation:
0
|
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 |
|
Cranky Old Man
Posting Freak
Posts: 986
Threads: 20
Joined: Apr 2012
Reputation:
38
|
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, "");
}
|
|
04-22-2012, 04:56 PM |
|
mattman111
Junior Member
Posts: 3
Threads: 1
Joined: Apr 2012
Reputation:
0
|
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:
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 |
|
JetlinerX
Senior Member
Posts: 599
Threads: 49
Joined: Jun 2011
Reputation:
19
|
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)
(This post was last modified: 04-22-2012, 05:16 PM by JetlinerX.)
|
|
04-22-2012, 05:13 PM |
|
mattman111
Junior Member
Posts: 3
Threads: 1
Joined: Apr 2012
Reputation:
0
|
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 |
|
JetlinerX
Senior Member
Posts: 599
Threads: 49
Joined: Jun 2011
Reputation:
19
|
RE: Help with script.
No problem
|
|
04-22-2012, 05:39 PM |
|
|