Frictional Games Forum (read-only)
How to make an enemy spawn facing a certain way - 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: How to make an enemy spawn facing a certain way (/thread-11868.html)

Pages: 1 2


How to make an enemy spawn facing a certain way - Cryaotic - 12-15-2011

Whenever I try to spawn an enemy entity it is always facing one way (The -Z way).

My goal is to have the entity in the corner of a dark room facing the door (Which is on the -X axis) but for the moment they only stare at the wall.

I try to make it move a bit with a pathnode to face the door but in the end it just poofs away too early and I don't even see it.

Is there a way to make an enemy spawn and stand by idle indefinitely facing a different way? Rotating it in the level editor doesn't work whatsoever.


RE: How to make an enemy spawn facing a certain way - flamez3 - 12-15-2011

You can disable triggers, it will not react to anything; that will make it so he stands one way the whole time.

"I try to make it move a bit with a pathnode to face the door but in the end it just poofs away too early and I don't even see it."



Are you making the monster spawn at the start? You can just make it spawn when you get relativity close to the monster spawn. If that's not what you mean I'm sorry I've had this problem aswell alot of times.


RE: How to make an enemy spawn facing a certain way - palistov - 12-15-2011


I've never had issues with monster facing in-game. Perhaps deleting the map cache can help?

Anyways, you could go to the extreme and just select everything in the map (minus the monster of course), press B, and rotate the compound object by changing the y-rotation value to 180 degrees. Make a backup version of your map beforehand, in case some crazy stuff happens which you can't fix. I've had issues with compounds, so it'll be good to have an old version to roll back to.



RE: How to make an enemy spawn facing a certain way - Cryaotic - 12-15-2011

(12-15-2011, 08:39 AM)palistov Wrote: I've never had issues with monster facing in-game. Perhaps deleting the map cache can help?

Anyways, you could go to the extreme and just select everything in the map (minus the monster of course), press B, and rotate the compound object by changing the y-rotation value to 180 degrees. Make a backup version of your map beforehand, in case some crazy stuff happens which you can't fix. I've had issues with compounds, so it'll be good to have an old version to roll back to.
I spoke with Jund (DamnNoHTML) and he says that you just can't change how an enemy is facing even with rotating and that he had that problem a lot when he was making his stories as well - I think generally when people spawn a monster they spawn him out of view or on a path or something.

I don't want the monster to move at all, just stand there. Whereas this works, it stands there and stairs at the wall.

I've tried the put a node there trick but I can see this being awkward because I want the monster to be in place by the time the player opens the door and I don't want there to be any animation going on.

If I put a collide area at or close to the door to spawn the enemy and then get into position it's possible the player could trigger that and not open the door and go to another instead, so I'm trying to avoid doing that.

Also moving the map is a nice idea, but I have another area where the enemy is doing something similar and that would mess that bit up (luckily where they are stuck facing is where I wanted them to face).

If it's too much trouble I think I'll just work around it and scrap the idea for now. Thanks for the help though guys. :]


RE: How to make an enemy spawn facing a certain way - palistov - 12-15-2011


One last thing you might want to try: Create a script area where you want the monster to stand, and use CreateEntityAtArea("grunty", "grunt.ent", "areaSpawnGrunt", false); and see how that affects his facing. Rotate the script area and see if that affects how it spawns. I'm not sure if this will help at all, or if you've tried it, but hey it's always worth a shot.

To avoid that small bit of lag when using this function, you need to make sure you have another grunt somewhere else in the map so the game loads it into the cache when the map starts.
Other than that I can't be much more help...I can do all kinds of trickery but sometimes (including most cases involving monsters) there's just no easy solution. Good luck to you though Big Grin


RE: How to make an enemy spawn facing a certain way - Kman - 12-15-2011

Maybe just alter the layout of the room a bit, just change up where the doors are in that one room so that way you can still have that scare work and it won't mess up the other one. If the layout of the map as it is now wouldn't work with that, I'd recommend just adding hallways so that everything fits. Sorry I can't be much of a help, but hey, I'm a mapper not a scripter Tongue I don't know all the technical fixes!


RE: How to make an enemy spawn facing a certain way - Cryaotic - 12-15-2011

(12-15-2011, 08:56 AM)palistov Wrote: One last thing you might want to try: Create a script area where you want the monster to stand, and use CreateEntityAtArea("grunty", "grunt.ent", "areaSpawnGrunt", false); and see how that affects his facing. Rotate the script area and see if that affects how it spawns. I'm not sure if this will help at all, or if you've tried it, but hey it's always worth a shot.

To avoid that small bit of lag when using this function, you need to make sure you have another grunt somewhere else in the map so the game loads it into the cache when the map starts.
Other than that I can't be much more help...I can do all kinds of trickery but sometimes (including most cases involving monsters) there's just no easy solution. Good luck to you though Big Grin
That's a no go, but definitely was a good idea to test - thanks for the attempt. :]

And Kman, with how my map is setup I have very little room to work with in terms of adjusting how the room is structured - but also thanks for the tip!


RE: How to make an enemy spawn facing a certain way - palistov - 12-15-2011

Alright one last idea. Create an area offset towards the direction you want the grunt to face. In the same function in which you set the grunt active, put PlaySoundAtEntity("", "impact_wood_heavy_low.snt", "areaName", 0, false); but make sure it comes after the line which activates the grunt. This is an attempt to make the grunt react to the sound and face that direction. No clue if it will work though.


RE: How to make an enemy spawn facing a certain way - Cryaotic - 12-15-2011

(12-15-2011, 09:08 AM)palistov Wrote: Alright one last idea. Create an area offset towards the direction you want the grunt to face. In the same function in which you set the grunt active, put PlaySoundAtEntity("", "impact_wood_heavy_low.snt", "areaName", 0, false); but make sure it comes after the line which activates the grunt. This is an attempt to make the grunt react to the sound and face that direction. No clue if it will work though.
No go on that front as well, but also was a great idea. Something tells me FG didn't plan for something like this. :]

Thanks still good sir!


RE: How to make an enemy spawn facing a certain way - palistov - 12-15-2011

< Defeated!