Help with infighting / friendly fire

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
Curunir
Posts: 1041
Joined: Sun Nov 02, 2003 11:24 am
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Help with infighting / friendly fire

Post by Curunir »

I am in a bit of a pickle.

I have a bunch of pre-existing monsters that have relatively low HP and tend to kill each other on the first instance of friendly fire. I looked into ways to stop that but it seems neither +NOTARGET for the actors, nor "NoInfighting" in MAPINFO will get the job done. The hitscanners fire A_CustomBulletAttacks and the ranged things use A_CustomMissileAttack, if it makes any difference.

Ideally, I want nobody to be able to harm anybody else. JUST hitscanners never damaging anything, even if the missile-firing actors do cause damage and / or infighting is also ok.

Do I use "species" actor properties to set this up and just add every enemy to the same species? The enemies currently have no species property defined.
User avatar
MFG38
Posts: 414
Joined: Sun Apr 14, 2019 8:26 am
Graphics Processor: nVidia (Modern GZDoom)
Location: Finland
Contact:

Re: Help with infighting / friendly fire

Post by MFG38 »

How about the +NOINFIGHTING flag?

EDIT: Now that I fully understood what you're looking for, I think a combination of the Species actor property with the same species name for each monster type and the +DONTHARMSPECIES flag should do the trick.
User avatar
Enjay
 
 
Posts: 27253
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Help with infighting / friendly fire

Post by Enjay »

Another approach is to make the enemies do damage of a particular custom type and then make them immune to that damage type. That allows monsters of different species to be immune to each other. Depends on exactly what's needed really I guess.
User avatar
Curunir
Posts: 1041
Joined: Sun Nov 02, 2003 11:24 am
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: Help with infighting / friendly fire

Post by Curunir »

Wiki says DONTHARMSPECIES only affects "receiving explosive damage by a projectile fired by a monster of the exact same kind", so it definitely wouldn't work on hitscanners.

Seems like Species won't do it either - "This determines infighting behavior, since a monster's missile do not inflict harm (except through splash damage) to other monsters belonging to the same species by default."

Edit: Posted as Enjay was typing. How would I set the damage type of the hitscanners I need to change as a baseline goal?
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: Help with infighting / friendly fire

Post by Void Weaver »

Sir Enjay absolutelly right. Only one (or a few) custom damagetype for all monsters with zero damagefactor to that damage type(s) can prevent from getting friendly fire damage.

For hitscan attacks (bullet\rail) its damage type should be declared directly in puff.
Other hacky way is setting of +(M)THRUSPECIES flag to puffs and projectiles, while all monsters should be united via shared species. But this solution will extremely unfair for player since all missiles and hitscans wouldn't blocked by other bodies of other monsters, so way with custom damagetype is better.
User avatar
Curunir
Posts: 1041
Joined: Sun Nov 02, 2003 11:24 am
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: Help with infighting / friendly fire

Post by Curunir »

I really can't figure out how to do this. I looked at the bulletpuff page and the actor properties page on the wiki but I still have no idea how to set the damage type for the puff actor.
Jarewill
 
 
Posts: 1855
Joined: Sun Jul 21, 2019 8:54 am

Re: Help with infighting / friendly fire

Post by Jarewill »

Have you tried putting DamageType property on the puff?
User avatar
Curunir
Posts: 1041
Joined: Sun Nov 02, 2003 11:24 am
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: Help with infighting / friendly fire

Post by Curunir »

Well, that wasn't great... Now I can't damage the hitscanners that I gave immunity with my own weapons...

Can't really be bothered to rework so much of the mod for that effect, to be honest. I will just settle with MAPINFO noinfighting, which should reduce cheesing possibilities at least a little.
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: Help with infighting / friendly fire

Post by Void Weaver »

Obviously you should create a custom puff (look into Using inheritance article) for monsters (harmless for them self), while default BulletPuff (player's) will inflict regular damage to monsters.
User avatar
Curunir
Posts: 1041
Joined: Sun Nov 02, 2003 11:24 am
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: Help with infighting / friendly fire

Post by Curunir »

It's how the mod is set up, I think - its custom puff replaces the game's default BulletPuff and it's also used by the monsters. Again, I just don't want to twat about so much with that, I can live with just no retaliation and infighting, even if enemies do damage each other.

Curious that a global toggle for this has not yet been implemented.
User avatar
Curunir
Posts: 1041
Joined: Sun Nov 02, 2003 11:24 am
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: Help with infighting / friendly fire

Post by Curunir »

So, I did this, gave both the hitscan humans "Species Humans" and "+NOINFIGHTSPECIES".

Even with that, when one tags the other with a bullet, they aggro on each other. What am I doing wrong here?

I am doing it per-species because there are more creatures that I want to put in a different species and have them not fight each other as well, but the hitscanners are turning on each other when they take damage, so...

Edit: The mod and Deco monsters author - @Vostyok helped me out and wrote the new puff for me. The solution was indeed a custom puff, I just couldn't figure out how to set it up without breaking anything.

Actor VulturePuff: Hitpuff
{
Damagetype Raiders
}

Then the hitscanning enemies were given the new puff in their firing frames, as well as a "DamageFactor "Raiders", 0" in their definition and it works now. They still produce blood when they shoot each other but don't lose health and don't aggro on each other.

I'm leaving this here for future reference, as I myself have found the answers to a bunch of questions by digging through old posts.
Post Reply

Return to “Scripting”