• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] Ranged attack blocks?-Cover system

Status
Not open for further replies.
Level 5
Joined
Sep 11, 2006
Messages
142
Hey all, I'm looking for a way of detecting whether a doodad/destructible/unit are directly in front of an attacking unit that has a ranged attack, and then finding a way of transferring the damage, and stopping the originally targeted unit from taking the damage. Its for a cover system I'm trying to make. I'll be grateful for any help.


P.s JASS or GUI is fine.
~MaxImash~
 
Level 5
Joined
Sep 11, 2006
Messages
142
Well, i would use dummies, it just i want to do this without them, cause with dummies, there would be huge amount of dummies on the screen and map at any one time(in my map i mean), which = lag.
I was thinking maybe, i could create a region or something, and check through that, but I'm not sure how I'd go about doing that.
 
Level 7
Joined
Jul 20, 2008
Messages
377
One way (although potentially visually distracting) is to cause an attacker to change its target for a quick bit to the first thing in the way. This is possible by checking for any obstructions in a line from the attacker to the target. A sample of what I mean:

  • Actions
    • For each (Integer A) from 1 to 10, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Random unit from (Units within (50.00 x (Real((Integer A)))) of (Position of (Attacking unit)) matching ((Angle from (Position of (Attacking unit)) to (Position of (Matching unit))) Less than or equal to (Abs(((Angle from (Position of (Attacking unit)) to (P Not equal to No unit
          • Then - Actions
            • Unit - Order (Attacking unit) to Attack (that unit)
          • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Random destructible in (Rect centered at ((Position of (Attacking unit)) offset by (50.00 x (Real((Integer A)))) towards (Angle from (Position of (Attacking unit)) to (Position of (Attacked unit))) degrees) with size (50.00, 50.00))) Not equal to No destructible
              • Then - Actions
                • Unit - Order (Attacking unit) to Attack (that destructible)
              • Else - Actions
Except, of course, making the necessary leak removals and corrections (setting that random unit or destructable to a variable before making the comparison). Also, when you've found a new target, just set a variable to break the loop so it doesn't pick another target along the way. You'll want to rapidly change the target back to the original target after this is done.

But like I said, this might be awkward.
 
Level 5
Joined
Sep 11, 2006
Messages
142
Hm, that looks like it could work, but a line could mean that the tiniest movement left or right would make the target get hit, and i can just imagine people hating on the game if they get hit while behind cover.
Though i might change it to attack ground, that would make it more flexible.

How would i go about making a narrow rectangle region from the attacker to the target?

Edit: Do you think it would run fast enough for the projectile to to redirect? and not fire one first then fire again at the destructible/unit in the way.
Plus how do you detect doodads?

Edit2: Just realised that this wouldn't work, too much, margin for error, like the player orders him to attack someone else but the trigger forces him not to... etc, it would be lame.
I think ill make it so all the units have really high armor so they cant get hurt, and then apply damage through triggers...

Thanks though, the trigger you used to detect the destructible, and the one for the unit helped, I'll use that
 
Status
Not open for further replies.
Top