Frictional Games Forum (read-only)

Full Version: Spawning an enemy
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i was trying to create a script so i could spawn a brute for a long hallway chase but idk the script, i did try on my own but i think i did it wrong. maybe an example script could help me? thx for anyone who helps me Smile And sorry for posting so much, just really new to this and im in the middle of creating my first CS. Thx for the help guys! Smile
It's pretty straightforward if it is a Collide Callback with a ScriptArea. I've named the ScriptArea SpawnCorridorMonster for this example.

PHP Code:
void OnStart()
{
    
AddEntityCollideCallback("Player""SpawnCorridorMonster""MonsterSpawn"true1);
}

void MonsterSpawn(string &in asParentstring &in asChildint alState)
{
    
SetEntityActive("servant_brute_1"true);


You can also call ShowEnemyPlayerPosition after you set it active to make the enemy immediately chase after the player.

A list of all the basic functions Amnesia can recognize are here: https://wiki.frictionalgames.com/hpl2/am..._functions

You can also check Frictional Games' levels to see how they did it. There are countless examples where they use CollideCallbacks to spawn enemies, especially in the Sewer level.
Remember to actually place an enemy in your level.
You're not really "spawning" it. The enemy is supposed to be inactive in your level, and in your script you use "SetEntityActive" like Romulator did, and the enemy will be set active.