Cyphermur9t
Junior Member
Posts: 38
Threads: 17
Joined: Jan 2013
Reputation:
2
|
I don't see what's wrong here
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...
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);
}
|
|
02-07-2013, 08:10 AM |
|
NaxEla
Senior Member
Posts: 415
Threads: 5
Joined: Dec 2012
Reputation:
28
|
RE: I don't see what's wrong here
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.
|
|
02-07-2013, 08:28 AM |
|
Cyphermur9t
Junior Member
Posts: 38
Threads: 17
Joined: Jan 2013
Reputation:
2
|
RE: I don't see what's wrong here
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.
(This post was last modified: 02-07-2013, 08:43 AM by Cyphermur9t.)
|
|
02-07-2013, 08:42 AM |
|
PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
RE: I don't see what's wrong here
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.
"Veni, vidi, vici."
"I came, I saw, I conquered."
|
|
02-07-2013, 08:50 AM |
|
NaxEla
Senior Member
Posts: 415
Threads: 5
Joined: Dec 2012
Reputation:
28
|
RE: I don't see what's wrong here
(02-07-2013, 08:50 AM)JustAnotherPlayer Wrote: 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.
|
|
02-07-2013, 09:09 AM |
|
GoranGaming
Member
Posts: 183
Threads: 30
Joined: Feb 2012
Reputation:
7
|
RE: I don't see what's wrong here
Why don't you use vagiables instead? Much easier
Current projects:
The Dark Prison 85 % (Stopped working on this one)
Unnamed Project 7 %
|
|
02-07-2013, 10:14 AM |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
RE: I don't see what's wrong here
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.
Trying is the first step to success.
|
|
02-07-2013, 10:50 AM |
|
PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
RE: I don't see what's wrong here
(02-07-2013, 09:09 AM)NaxEla Wrote: (02-07-2013, 08:50 AM)JustAnotherPlayer Wrote: 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.
"Veni, vidi, vici."
"I came, I saw, I conquered."
|
|
02-07-2013, 10:51 AM |
|
Cyphermur9t
Junior Member
Posts: 38
Threads: 17
Joined: Jan 2013
Reputation:
2
|
RE: I don't see what's wrong here
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!
|
|
02-11-2013, 04:54 AM |
|
|