One sided defensible position- how?

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
Enjay
 
 
Posts: 27163
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

One sided defensible position- how?

Post by Enjay »

I can't think how to achieve this. I want to create a small "sniper nest" that the player can go into and fire out of to kill enemies. The front of the nest would face onto the area of the level where the enemies are likely to come from but they could approach from other angles too. I do not want the enemies to be able to fire into the sniper nest through the front but I do want them to be able to attack the player if they manage to get behind the sniper nest and come in from that angle.

So, what I need is a way of making a line (or something) that lets player shots (projectile and hitscans) cross from one side (inside to outside) but does not let enemy shots (also projectiles and hitscans) cross from the other side (outside to inside).

I can't think of a line blocking type that will do this and I can't just make the player invulnerable while he is in the nest because I want the possibility of him being attacked from other angles. I've a funny feeling that it probably can't be done (at least not particularly efficiently) but if anyone has any ideas, I'd be glad to hear them.
yqco
Posts: 80
Joined: Sat Jul 06, 2013 9:19 pm

Re: One sided defensible position- how?

Post by yqco »

I've played around and managed to get a one-way obstacle working for both projectile and hitscan attacks. It isn't a pretty solution but it does what it's supposed to. I've attached a working demo/test map if you wish to try it.

This solution revolves around the [wiki=Actor_flags#GHOST]GHOST[/wiki] flag, the [wiki=Actor_properties#Species]species[/wiki] property, and their THRU-flag counterparts ([wiki=Actor_flags#THRUGHOST]THRUGHOST[/wiki]/[wiki=Actor_flags#THRUSPECIES]THRUSPECIES[/wiki]).
  • A projectile may pass through an actor of matching species if the projectile has the THRUSPECIES flag.
  • A hitscan (bullet puff) may pass through a GHOST-actor if the bullet puff has the THRUGHOST flag.
So, the idea is to have two actors for each attack: One with the THRU flag and one without. The weapon/monster then checks for a dummy item to determine which version of the projectile/bullet puff it should use. This dummy item is given and taken when the player enters and leaves the sniper nest.

Some caveats with this solution:
  • Lots of inheritance is required to add support for a single actor.
  • Rockets fired outside the nest can hurt players inside if they're too close to the blast.
  • It relies on the GHOST flag which, as I understand it, behaves differently in Heretic.
  • It doesn't support nested or opposing sniper-nests. If you're in one nest then you're in them all as far as this solution is concerned.
While working on this problem I stumbled upon this feature request of yours. Should this be implemented, the last two problems I listed could be removed. Anyways, I hope I could help.
Attachments
one_way_obstacle.pk3
One-way sniper nest example for Doom 2 (map01, Doom in Hexen format).
(6.89 KiB) Downloaded 18 times
User avatar
Enjay
 
 
Posts: 27163
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: One sided defensible position- how?

Post by Enjay »

Wow! That works really well. Thanks for the effort that you put into this. I'm going to look at it to see how easily I can integrate it. One immediately obvious potential problem is that a number of the enemies I am thinking of have the Ghost flag. However, I will see how much of a problem this turns out to be. Thank you.
Locked

Return to “Editing (Archive)”