Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Spawning an enemy
XeOnTricks Offline
Junior Member

Posts: 27
Threads: 12
Joined: Feb 2017
Reputation: 0
#1
Spawning an enemy

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
02-25-2017, 08:19 AM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#2
RE: Spawning an enemy

It's pretty straightforward if it is a Collide Callback with a ScriptArea. I've named the ScriptArea SpawnCorridorMonster for this example.

PHP Code: (Select All)
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.

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 02-25-2017, 11:33 AM by Romulator.)
02-25-2017, 09:56 AM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#3
RE: Spawning an enemy

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.

Trying is the first step to success.
02-25-2017, 02:51 PM
Find




Users browsing this thread: 1 Guest(s)