Frictional Games Forum (read-only)
Monster appear - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Monster appear (/thread-6413.html)



Monster appear - Sudden - 01-29-2011

How do i make a monster appear from nowhere and start patroling when i enter a area?


RE: Monster appear - Vradcly - 01-29-2011

Create the monster in your map and make sure its not active (there is a checkbox for that), create pathnodes for where you want the enemy patrol (areas, pathnode), make sure not to set the pathnodes to far apart. Then open your map script and add the first and last point in the enemy path inside void OnStart()
{
AddEnemyPatrolNode("servant_grunt_1","PathNodeArea_1",0.0f, "");
AddEnemyPatrolNode("servant_grunt_1","PathNodeArea_50",0.0f, "");
}
like that for example.

Then create a area of type script and put it in your map where you want the player to be when the enemy activates. Then add a collide callback for that area:
AddEntityCollideCallback("Player", "Script_Area_1", "CollideScript_Area_1", true, 1);
Something like that.

Then you put the CollideScript_Area_1 function outside of your OnStart(), ex above:

void CollideScript_Area_1(string &in asParent, string &in asChild, int alState)
{

}
void OnStart()
{
(lots of code)
}

and at last put the SetEntityActive("servant_grunt_1", true); inside your callision function:

void CollideScript_Area_1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);
}

like that. Hope that helps, if not I suggest you look at the guides for this, there are lots of information out there...


RE: Monster appear - Robby - 01-29-2011

Here is a script file that I used as an example.
Code:
////////////////////////////
// Run first time starting map
void OnStart()
{
     AddEntityCollideCallback("Player", "ScriptArea_1", "MonsterFunc1", true, 1);
}
void MonsterFunc1(string &in asParent, string &in asChild, int alState)
{
     SetEntityActive("servant_grunt_1", true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{

}
////////////////////////////
// Run when leaving map
void OnLeave()
{

}

Notes: At the SetEntityActive line, you must use the monster's exact name.

If you have servant_grunt_1 in your level, for example, then you must use "servant_grunt_1" at the SetEntityActive line in the script file.

Just copy-paste the code, and check your entity and scriptarea in your map and in your script file.


RE: Monster appear - Sudden - 01-29-2011

It worked! Big Grin Thanks alot Smile


RE: Monster appear - CrushedRaiD - 02-05-2011

Having problems with this script:

////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "MonsterFunc1", true, 1);
}
void MonsterFunc1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);
}

AddEnemyPatrolNode("servant_grunt_1","PathNodeArea_1",0.0f, "");
AddEnemyPatrolNode("servant_grunt_1","PathNodeArea_4",0.0f, "");
}
////////////////////////////
// Run when entering map
void OnEnter()
{

}
////////////////////////////
// Run when leaving map
void OnLeave()
{

}

Any help plox =)[/quote]


RE: Monster appear - Oscar House - 02-05-2011

Your AddEnemyPatrolNodes are not in a function.

Code:
void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "MonsterFunc1", true, 1);
}
void MonsterFunc1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1","PathNodeArea_1",0.0f, "");
AddEnemyPatrolNode("servant_grunt_1","PathNodeArea_4",0.0f, "");
}

////////////////////////////
// Run when entering map
void OnEnter()
{

}
////////////////////////////
// Run when leaving map
void OnLeave()
{

}



RE: Monster appear - CrushedRaiD - 02-05-2011

(02-05-2011, 09:28 AM)Oscar House Wrote: Your AddEnemyPatrolNodes are not in a function.

Code:
void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "MonsterFunc1", true, 1);
}
void MonsterFunc1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1","PathNodeArea_1",0.0f, "");
AddEnemyPatrolNode("servant_grunt_1","PathNodeArea_4",0.0f, "");
}

////////////////////////////
// Run when entering map
void OnEnter()
{

}
////////////////////////////
// Run when leaving map
void OnLeave()
{

}
Thank you ill try that one Big Grin