I don't see what's wrong here - Cyphermur9t - 02-07-2013
I'm having an issue of activating an AreaScript from another AreaScript, and having the newly activated one activate a Monster when touched. I just can't see what I did wrong with the code...
Code: void OnStart()
{
/////////
//MONSTERS
AddEntityCollideCallback("Player", "ScriptArea_3", "FUNCTION5", true, 1);
/////////
//AREAS
AddEntityCollideCallback("Player", "ScriptArea_4", "FUNCTION6", true, 1);
}
void FUNCTION5(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_2", true);
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_11", 0, "");
}
void FUNCTION6(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("ScriptArea_3", true);
}
RE: I don't see what's wrong here - NaxEla - 02-07-2013
Does the map crash when you try to load it? Or does the script just do nothing? If the map crashes, could you please post the error that pops up? If the script just does nothing, make sure that all the names are correct for the areas and the monster.
Also, delete any .map_cache files in your folder where your maps are kept. Maybe you added ScriptArea_3 or ScriptArea_4 in the level editor, but because of the map_cache, it didn't load the area in-game.
RE: I don't see what's wrong here - Cyphermur9t - 02-07-2013
All the names are correct. I check in the level editor and the hps file to see if they're all there. They are in both with the exact same names, I c+p'ed their names into the hps file.
It does not crash, the script for that just does not run. Also I had no cache file in my maps folder.
RE: I don't see what's wrong here - PutraenusAlivius - 02-07-2013
PHP Code: void OnStart()
{ AddEntityCollideCallback("Player", "ScriptArea_4", "AreaEnable", true, 1); AddEntityCollideCallback("Player", "ScriptArea_3", "MonsterSpawn", true, 1);
} void AreaEnable(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("ScriptArea_4", true);
} void MonsterSpawn(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_2", true);
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_11", 0, "");
}
My Script. Try it out.
RE: I don't see what's wrong here - NaxEla - 02-07-2013
(02-07-2013, 08:50 AM)JustAnotherPlayer Wrote: PHP Code: void OnStart()
{ AddEntityCollideCallback("Player", "ScriptArea_4", "AreaEnable", true, 1); AddEntityCollideCallback("Player", "ScriptArea_3", "MonsterSpawn", true, 1);
} void AreaEnable(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("ScriptArea_4", true);
} void MonsterSpawn(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_2", true);
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_11", 0, "");
}
My Script. Try it out.
It seems like all you did was change the function names...?
To OP: You might have a .map_cache file in your virtual store. The path will be something like this:
C:/Users/[USERNAME]/AppData/Local/VirtualStore/ProgramFiles(x86)/Amnesia - The Dark Descent/redist/custom_stories
If that doesn't work, double check that your .map file and .hps have exactly the same names.
RE: I don't see what's wrong here - GoranGaming - 02-07-2013
Why don't you use vagiables instead? Much easier
RE: I don't see what's wrong here - FlawlessHappiness - 02-07-2013
Check if PlayerLookAtCallbackAutoRemove isn't checked. If it's checked it might not work.
It is located in the corresponding ScriptArea's properties under Area.
RE: I don't see what's wrong here - PutraenusAlivius - 02-07-2013
(02-07-2013, 09:09 AM)NaxEla Wrote: (02-07-2013, 08:50 AM)JustAnotherPlayer Wrote: PHP Code: void OnStart()
{ AddEntityCollideCallback("Player", "ScriptArea_4", "AreaEnable", true, 1); AddEntityCollideCallback("Player", "ScriptArea_3", "MonsterSpawn", true, 1);
} void AreaEnable(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("ScriptArea_4", true);
} void MonsterSpawn(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_2", true);
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_11", 0, "");
}
My Script. Try it out.
It seems like all you did was change the function names...?
To OP: You might have a .map_cache file in your virtual store. The path will be something like this:
C:/Users/[USERNAME]/AppData/Local/VirtualStore/ProgramFiles(x86)/Amnesia - The Dark Descent/redist/custom_stories
If that doesn't work, double check that your .map file and .hps have exactly the same names. Compared it to my script.
RE: I don't see what's wrong here - Cyphermur9t - 02-11-2013
Everything works now. I'm not too sure what was wrong but for somereason the script I was using was correct after all and is working. Kind of strange because I knew I saved everything before I tried it out. *shrugs* Oh well. Thanks for the suggestions though everyone!
|