Trigger problem

Exide

I am amazingly focused right now!
Reaction score
448
Hi.
I couldn't find a better name for the thread title.

Anyway.. I have a trigger that:
1. A unit destroys an explosive barrel near the boss.
2. The boss takes additional damage, depending on how close he is to the barrel.
3. The barrels are standing four-by-four so the trigger fires four times each time a barrel dies.

Here is my trigger:

Code:
Sector3_ExplosiveBarrels
    Events
        Unit - Any Unit dies
    Local Variables
        dist = 0.0 <Real>
        r = 0.0 <Real>
    Conditions
        (Unit type of (Triggering unit)) == Explosives
    Actions
        Variable - Set dist = (Distance between (Position of (Triggering unit)) and (Position of Odin))
        General - If (Conditions) then do (Actions) else do (Actions)
            If
                dist < 351.0
            Then
                Environment - Create a Small Terran explosion at (Position of (Triggering unit))
                Environment - Create a Small Terran explosion at (Odin attachment point ("head"))
                Variable - Set r = (350.0 - dist)
                Unit - Set Odin Life to ((Odin Life (Current)) - r)
                Debug - Display ("Damage Dealt: " + (Text(r) with Any Precision decimal places)) as debug output using Type 1, and Do display it in the game window
            Else


What happens is: the trigger seems to ignore my If/Then/Else -condition.
It also seems to deal about 320-340 damage to the boss (Odin), no matter how close or far away he is from the barrels.

The idea is to deal maximum 350 damage to Odin (if he's standing on top of the barrel), and deal less damage the further away he is.


Bonus question: is "head" a valid attachment for my explosion?
 

Frozenwind

System maker
Reaction score
99
Regular question:
I guess you need to wake up from the evil wc3 dream and come to sc2.

"351.0" distance is about the entire map in sc2, whereas it's really small in wc3.
A small unit has a collision size of 0.6, whereas in wc3 we reach values like 80.
So I don't know how big you want it, but I mostly have about 1.0 for a small explosion (as the barell has 0.6 collision size I suppose) and then up to 2 for average damage and up to 2.5 for low damage. Yet you have to decide the radius by yourself.

Check out your terrain editor and watch to the x-coordinate if you slowly move over the terrain. Like that you can determine the AoE you want.

(Small edit: A distance of "0" will cause max damage, but take the collision size into count. Dealing 350 damage is impossible right now.)


Bonus:
Go to the previewer, you know how to, and go to the specific unit's model. Now in the mid right you see a lot of stuff including his attachment points (I suppose they're called "bones"). If head is there, it is an attachment point. If not, it's not.
 

Exide

I am amazingly focused right now!
Reaction score
448
Oh. I did not know that.
Now that ruins my whole idea of having a simple "deal damage according to have close you are to the explosion" idea. :thdown:
I'll see if I can work something out around the silly new range system. =/


As usual I don't understand this. :p
I opened the previewer and found a list of all the attachment points.
They're all called stupid things like "Ref_Target 01 [e_attach_target 02] Bone = 91"

Dunno which one is the head.
 

Frozenwind

System maker
Reaction score
99
Regular:
It's rather simple, your new formula:

350 = max damage? So 350 damage is dealt on a distance of 0.6 (the collision size of barrel)

  • MaxDmg(350)
  • MinDist(0.6) = Collision of barrel
  • MinDmg(0)
  • MaxDist(2.5 for example)
  • RealDist = distance between unit and barrel

Damage Dealt = MaxDmg - (MaxDmg/(MaxDist-MinDist)) * (RealDist-MinDist)

MaxDmg minus "rest", is just because the damage slowly decreases (-) if you get farther away (+)
MaxDmg/(MaxDist-MinDist) spreads the MaxDamage over the DamageDealingRadius (which is 2.5-0.6=1.9 for this example) multiplied with (RealDist-MinDist), which is the distance between the unit and the MaxDmgPoint.

You'll need a condition though, if it can hit air units which are nearer as MinDist, as it'll deal more as 350 dmg then.


Bonus:
About the attachments... I haven't studied them yet either, so all I know is that you can see them there xD Maybe someone else knows it.
 

Exide

I am amazingly focused right now!
Reaction score
448
Thanks, but I did this instead:

Code:
Sector3_ExplosiveBarrels
    Events
        Unit - Any Unit dies
    Local Variables
        dist = 0.0 <Real>
        r = 0.0 <Real>
    Conditions
        (Unit type of (Triggering unit)) == Explosives
    Actions
        Variable - Set dist = (Distance between (Position of (Triggering unit)) and (Position of Odin))
        General - If (Conditions) then do (Actions) else do (Actions)
            If
                dist < 6.0
            Then
                Environment - Create a Small Terran explosion at (Position of (Triggering unit))
                Environment - Create a Small Terran explosion at (Odin attachment point ("head"))
                Variable - Set r = (350.0 - (58.0 * dist))
                Unit - Set Odin Life to ((Odin Life (Current)) - r)
                Debug - Display ("Damage Dealt: " + (Text(r) with Any Precision decimal places)) as debug output using Type 1, and Do display it in the game window
            Else

It works properly now. :thup:


If anyone figures out an attachment point I can use on my model I'd love to hear how to do it. :)
 

Galdiuz

Creator of Photon Command
Reaction score
98
You know that you can check attachment points in the Previewer? Just press A to show/hide them.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top