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
How to make an enemy spawn facing a certain way
Cryaotic Offline
Senior Member

Posts: 369
Threads: 13
Joined: Oct 2010
Reputation: 72
#1
How to make an enemy spawn facing a certain way

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.

12-15-2011, 04:48 AM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#2
RE: How to make an enemy spawn facing a certain way

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.

12-15-2011, 05:34 AM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#3
RE: How to make an enemy spawn facing a certain way


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.

12-15-2011, 08:39 AM
Find
Cryaotic Offline
Senior Member

Posts: 369
Threads: 13
Joined: Oct 2010
Reputation: 72
#4
RE: How to make an enemy spawn facing a certain way

(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. :]

12-15-2011, 08:46 AM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#5
RE: How to make an enemy spawn facing a certain way


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

12-15-2011, 08:56 AM
Find
Kman Offline
Posting Freak

Posts: 4,187
Threads: 25
Joined: Jul 2011
Reputation: 219
#6
RE: How to make an enemy spawn facing a certain way

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!

Posting Freak
12-15-2011, 08:57 AM
Website Find
Cryaotic Offline
Senior Member

Posts: 369
Threads: 13
Joined: Oct 2010
Reputation: 72
#7
RE: How to make an enemy spawn facing a certain way

(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!

12-15-2011, 09:04 AM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#8
RE: How to make an enemy spawn facing a certain way

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.

12-15-2011, 09:08 AM
Find
Cryaotic Offline
Senior Member

Posts: 369
Threads: 13
Joined: Oct 2010
Reputation: 72
#9
RE: How to make an enemy spawn facing a certain way

(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!

12-15-2011, 09:24 AM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#10
RE: How to make an enemy spawn facing a certain way

< Defeated!

12-15-2011, 09:31 AM
Find




Users browsing this thread: 1 Guest(s)