Enemy Path help!! - Peku - 12-24-2011
I tried to spawn a brute and make a path and the "loop" thing for it, but it doesn't work.
It crashes and says "main (160, 7) : ERR E : Unexpected end of file"
//===========================================
// Starter's Script File!
//===========================================
//===========================================
// This runs when the map first starts
void OnStart()
{
GiveItemFromFile("lantern", "lantern.ent"); for(int i=0;i<5;i++)
GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
AddEntityCollideCallback("Player", "ScriptArea_1", "MonsterVoice1", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_4", "MonsterSpawn1", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_5", "MonsterSpawnOff1", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_2", "CloseDoor", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_6", "OpenDoor", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_7", "MonsterSpawn2", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_8", "PrisonerVoice1", true, 1);
AddUseItemCallback("", "Cell_Key1", "door_1", "KeyOnDoor", true);
AddEntityCollideCallback("Player", "ScriptArea_9", "MonsterFunction", true, 1);
AddEntityCollideCallback("Player", "MonsterEnd", "MonsterEnd", true, 1);
AddEntityCollideCallback("servant_brute_1", "PNScriptArea", "MonsterFunction2", false, 1);
}
void TimerDoneLookAt(string &in asTimer)
{
StopPlayerLookAt();
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "door_1", 0.0f, true);
}
void CloseDoor(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("door_1", true, true);
SetSwingDoorLocked("door_1", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(15.0f, true);
}
void MonsterVoice1(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "enabled.snt", "torch_static01_3", 0, false);
}
void MonsterSpawn1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);
}
void MonsterSpawnOff1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", false);
}
void OpenDoor(string &in asParent, string &in asChild, int alState)
{
AddPropImpulse("iron_maiden_1", 50, 1, 50, "World"); //red is x axis, blue is z axis, green is y axis.
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false);
GiveSanityDamage(15.0f, true);
}
void PrisonerVoice1(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "15_prisoner_beg.snt", "Player", 0, false);
}
void MonsterSpawn2(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_10", 0, "");
}
void MonsterFunction2()
{
for (int i = 1; i <6; i++)
{
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_"+10, 0, "");
}
}
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_1", for (int i = 1; i <11; i++)
{
int x = i;
if (i == 1)
{
x = 2;
}
if (i = 10)
{
x = 4;
}
if (i != 1 || i != 10)
{
x = 0;
}
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_"+i, x, "");
}
}
void MonsterEnd(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_1", false);
}
Please, help me with this and solve it. I would really appreciate it.
RE: Script Problem!! - Your Computer - 12-24-2011
Your MonsterFunction function was not properly closed.
RE: Script Problem!! - Peku - 12-24-2011
I managed to solve that problem but got a new one.
"main (128, 6) : INFO : Compiling void MonsterFunction(string&in, string&in, int)
main (130, 37) : ERR : Expected expression value
main (130, 63) : ERR : Expected ';' "
I put the new script in the first post
RE: Enemy Path help!! - Your Computer - 12-24-2011
You didn't properly close SetEntityActive.
RE: Enemy Path help!! - Peku - 12-24-2011
I tried but it's still not working.. Can you please fix it?
I know that i'm a pain in the ass but I really want to make it work..
RE: Enemy Path help!! - Your Computer - 12-24-2011
Try this:
PHP Code: void OnStart() { GiveItemFromFile("lantern", "lantern.ent"); for(int i=0;i<5;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
AddEntityCollideCallback("Player", "ScriptArea_1", "MonsterVoice1", true, 1); AddEntityCollideCallback("Player", "ScriptArea_4", "MonsterSpawn1", true, 1); AddEntityCollideCallback("Player", "ScriptArea_5", "MonsterSpawnOff1", true, 1); AddEntityCollideCallback("Player", "ScriptArea_2", "CloseDoor", true, 1); AddEntityCollideCallback("Player", "ScriptArea_6", "OpenDoor", true, 1); AddEntityCollideCallback("Player", "ScriptArea_7", "MonsterSpawn2", true, 1); AddEntityCollideCallback("Player", "ScriptArea_8", "PrisonerVoice1", true, 1); AddUseItemCallback("", "Cell_Key1", "door_1", "KeyOnDoor", true); AddEntityCollideCallback("Player", "ScriptArea_9", "MonsterFunction", true, 1); AddEntityCollideCallback("Player", "MonsterEnd", "MonsterEnd", true, 1); AddEntityCollideCallback("servant_brute_1", "PNScriptArea", "MonsterFunction2", false, 1); }
void TimerDoneLookAt(string &in asTimer) { StopPlayerLookAt(); }
void KeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("door_1", false, true); PlaySoundAtEntity("", "unlock_door.snt", "door_1", 0.0f, true); }
void CloseDoor(string &in asParent, string &in asChild, int alState) { SetSwingDoorClosed("door_1", true, true); SetSwingDoorLocked("door_1", true, true); PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false); PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false); GiveSanityDamage(15.0f, true); }
void MonsterVoice1(string &in asParent, string &in asChild, int alState) { PlaySoundAtEntity("", "enabled.snt", "torch_static01_3", 0, false); }
void MonsterSpawn1(string &in asParent, string &in asChild, int alState) { SetEntityActive("servant_grunt_1", true); }
void MonsterSpawnOff1(string &in asParent, string &in asChild, int alState) { SetEntityActive("servant_grunt_1", false); }
void OpenDoor(string &in asParent, string &in asChild, int alState) { AddPropImpulse("iron_maiden_1", 50, 1, 50, "World"); //red is x axis, blue is z axis, green is y axis. PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false); PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false); GiveSanityDamage(15.0f, true); }
void PrisonerVoice1(string &in asParent, string &in asChild, int alState) { PlaySoundAtEntity("", "15_prisoner_beg.snt", "Player", 0, false); }
void MonsterSpawn2(string &in asParent, string &in asChild, int alState) { SetEntityActive("servant_brute_1", true); AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 2, ""); AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_2", 0, ""); AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_3", 0, ""); AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_4", 0, ""); AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_5", 0, ""); AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_6", 0, ""); AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_7", 0, ""); AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_8", 0, ""); AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_9", 0, ""); AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_10", 0, ""); }
void MonsterFunction2() { for (int i = 1; i <6; i++) { AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_"+10, 0, ""); } }
void MonsterFunction(string &in asParent, string &in asChild, int alState) { SetEntityActive("servant_brute_1");
for (int i = 1; i <11; i++) { int x = i; if (i == 1) { x = 2; } if (i = 10) { x = 4; } if (i != 1 || i != 10) { x = 0; } AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_"+i, x, ""); } }
void MonsterEnd(string &in asParent, string &in asChild, int alState) { SetEntityActive("servant_brute_1", false); }
RE: Enemy Path help!! - Peku - 12-24-2011
Again, a new error.
Code: "FATAL ERROR: Could not load script file 'custom_stories/My Story/maps/map01.hps'!
main (96, 5) : ERR : No matching signatures to 'SetEntityActive(string@&)'
main (107, 13) : ERR : Expression must be of boolean type"
RE: Enemy Path help!! - Your Computer - 12-24-2011
I'm going to assume you want the monster to activate.
PHP Code: void OnStart() { GiveItemFromFile("lantern", "lantern.ent"); for(int i=0;i<5;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
AddEntityCollideCallback("Player", "ScriptArea_1", "MonsterVoice1", true, 1); AddEntityCollideCallback("Player", "ScriptArea_4", "MonsterSpawn1", true, 1); AddEntityCollideCallback("Player", "ScriptArea_5", "MonsterSpawnOff1", true, 1); AddEntityCollideCallback("Player", "ScriptArea_2", "CloseDoor", true, 1); AddEntityCollideCallback("Player", "ScriptArea_6", "OpenDoor", true, 1); AddEntityCollideCallback("Player", "ScriptArea_7", "MonsterSpawn2", true, 1); AddEntityCollideCallback("Player", "ScriptArea_8", "PrisonerVoice1", true, 1); AddUseItemCallback("", "Cell_Key1", "door_1", "KeyOnDoor", true); AddEntityCollideCallback("Player", "ScriptArea_9", "MonsterFunction", true, 1); AddEntityCollideCallback("Player", "MonsterEnd", "MonsterEnd", true, 1); AddEntityCollideCallback("servant_brute_1", "PNScriptArea", "MonsterFunction2", false, 1); }
void TimerDoneLookAt(string &in asTimer) { StopPlayerLookAt(); }
void KeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("door_1", false, true); PlaySoundAtEntity("", "unlock_door.snt", "door_1", 0.0f, true); }
void CloseDoor(string &in asParent, string &in asChild, int alState) { SetSwingDoorClosed("door_1", true, true); SetSwingDoorLocked("door_1", true, true); PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false); PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false); GiveSanityDamage(15.0f, true); }
void MonsterVoice1(string &in asParent, string &in asChild, int alState) { PlaySoundAtEntity("", "enabled.snt", "torch_static01_3", 0, false); }
void MonsterSpawn1(string &in asParent, string &in asChild, int alState) { SetEntityActive("servant_grunt_1", true); }
void MonsterSpawnOff1(string &in asParent, string &in asChild, int alState) { SetEntityActive("servant_grunt_1", false); }
void OpenDoor(string &in asParent, string &in asChild, int alState) { AddPropImpulse("iron_maiden_1", 50, 1, 50, "World"); //red is x axis, blue is z axis, green is y axis. PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false); PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false); GiveSanityDamage(15.0f, true); }
void PrisonerVoice1(string &in asParent, string &in asChild, int alState) { PlaySoundAtEntity("", "15_prisoner_beg.snt", "Player", 0, false); }
void MonsterSpawn2(string &in asParent, string &in asChild, int alState) { SetEntityActive("servant_brute_1", true); AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 2, ""); AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_2", 0, ""); AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_3", 0, ""); AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_4", 0, ""); AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_5", 0, ""); AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_6", 0, ""); AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_7", 0, ""); AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_8", 0, ""); AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_9", 0, ""); AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_10", 0, ""); }
void MonsterFunction2() { for (int i = 1; i <6; i++) { AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_"+10, 0, ""); } }
void MonsterFunction(string &in asParent, string &in asChild, int alState) { SetEntityActive("servant_brute_1", true);
for (int i = 1; i <11; i++) { int x = i; if (i == 1) { x = 2; } if (i == 10) { x = 4; } if (i != 1 || i != 10) { x = 0; } AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_"+i, x, ""); } }
void MonsterEnd(string &in asParent, string &in asChild, int alState) { SetEntityActive("servant_brute_1", false); }
RE: Enemy Path help!! - Peku - 12-24-2011
Fatal error and now it says only
Code: "FATAL ERROR: Could not load script file 'custom_stories/My Story/maps/map01.hps'!
main (107, 13) : ERR : Expression must be of boolean type"
RE: Enemy Path help!! - Your Computer - 12-24-2011
My previous post is edited.
|