• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Line of Fire

Status
Not open for further replies.
Level 13
Joined
Jul 2, 2015
Messages
872
I've been thinking for a while, is it possible to make it that friendly ranged units could cause friendly fire? For example rifleman attacking an enemy but causing friendly fire due to friendly troops in front of them.

Is there a way to make something like this?
 
Level 39
Joined
Feb 27, 2007
Messages
4,994
With a projectile system and triggered unit attack projectiles, yes. Without those, no. Rifleman attacks are specifically what you want to use for all your units in your map as it's the only hitscan (instant) ranged attack. Detect when a unit attacks another with a DDS, save the pre-mitigation damage dealt, prevent the damage dealt, launch a projectile from source to target that can impact all units, and attach both the source and the saved damage to this projectile. When it hits any unit, have the source damage that unit for the saved damage amount.
 
Level 28
Joined
Feb 18, 2014
Messages
3,579
I'm not sure I understand what you're trying to achieve here. You want to deal damage to all units that stand in the line between the Attacking and the Attacked unit or you simply want to interrupt the attack if there is a friendly unit in that line so that you can reverse the damage to it instead?
 
Level 13
Joined
Jul 2, 2015
Messages
872
I'm not sure I understand what you're trying to achieve here. You want to deal damage to all units that stand in the line between the Attacking and the Attacked unit or you simply want to interrupt the attack if there is a friendly unit in that line so that you can reverse the damage to it instead?
Deal all damage, and if its for example a bowman or archer they cant friendly fire (due to fire arc)
 
Level 28
Joined
Feb 18, 2014
Messages
3,579
I can only think of two solutions : The easiest way and the hardest way. The easiest way is to use a custom ability that deals damage in a cone such as carrion swarm or breath of fire and order a dummy unit to cast it whenever the rifleman recieve the order to attack. The hardest way is to use triggers, basically what you need to do is to pick all units between the rifleman and the attacked unit and cause damage to them. There are plenty of threads here that explains how to make damage in a line.
 
Level 39
Joined
Feb 27, 2007
Messages
4,994
With a projectile system and triggered unit attack projectiles, yes. Without those, no. Rifleman attacks are specifically what you want to use for all your units in your map as it's the only hitscan (instant) ranged attack. Detect when a unit attacks another with a DDS, save the pre-mitigation damage dealt, prevent the damage dealt, launch a projectile from source to target that can impact all units, and attach both the source and the saved damage to this projectile. When it hits any unit, have the source damage that unit for the saved damage amount.
This is the solution. With a projectile system in place it is not particularly difficult.
 
Status
Not open for further replies.
Top