Frictional Games Forum (read-only)
[SCRIPT] Make a monster spawn when you touch an entity? - 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 - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] Make a monster spawn when you touch an entity? (/thread-21458.html)



Make a monster spawn when you touch an entity? - serbusfish - 05-10-2013

I want a water lurker to activate when you pick up an object (in my case a cog), is this possible or will I simply have to do a collide callback to spawn it?

Also when it comes to the water lurker do I simply have to place path nodes and it will follow them or do I need to script them in as well?


RE: Make a monster spawn when you touch an entity? - OriginalUsername - 05-10-2013

SetEntityPlayerInteractCallback should do the trick.
Here's the code:

PHP Code:
void OnStart()
{
SetEntityPlayerInteractCallback("cog_name""func_name"true); 
}

void func_name(string &in asEntity)
{
SetEntityActive("waterlurker_name"true);


And for the monsters: It depends. Do you want to let him patrol or chase the player?
For patrolling:
PHP Code:
AddEnemyPatrolNode("waterlurker_name""pathnode_name"0(or any time you want to let the monster wait), ""); 
If you have more nodes, just duplicate this with the right name of the node.

If you want him to chase the player:
PHP Code:
ShowEnemyPlayerPosition("waterlurker_name"); 
This means the monster'll run straight to the player. He will get stuck behind corners and debris, so it's good if he has to chase him in a long, clean corridor.

Also, this.


RE: Make a monster spawn when you touch an entity? - Your Computer - 05-10-2013

Water lurkers move based on sound, but they also require the use of path nodes to help them navigate the environment. No scripting is required for water lurkers, except perhaps to activate them.


RE: Make a monster spawn when you touch an entity? - serbusfish - 05-10-2013

Ah thanks, I knew it was something like SetEntityPlayerInteractCallback but wasnt 100%.

@Your Computer, cheers that makes it much simpler to set one up, ive just got to make sure there are plenty of path nodes.


RE: Make a monster spawn when you touch an entity? - FlawlessHappiness - 05-10-2013

When you have an idea of what it is, go to this site: http://wiki.frictionalgames.com/hpl2/amnesia/script_functions

Press Ctrl F \/ Cmd F to activate the search function in your browser.

Start searching for what you might think it is you're looking for. It's a very easy way


RE: Make a monster spawn when you touch an entity? - TheGreatCthulhu - 05-11-2013

@BeeKayK: Is that a math symbol for the logical OR I see there? \/?
Big Grin Cool


RE: Make a monster spawn when you touch an entity? - FlawlessHappiness - 05-12-2013

Yes it is Smile Why? Just something i picked up in math