• 🏆 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!

Trigger Help please

Status
Not open for further replies.
Level 8
Joined
Jul 29, 2010
Messages
319
how do i make this trigger check if the unit the projectile hits dies, then add +1 to a leaderboard value
  • USE ABILITY
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Fire Blaster!
        • Then - Actions
          • Set Attackingunit[(Player number of (Triggering player))] = (Casting unit)
          • Set point[0] = (Position of (Triggering unit))
          • Set point[1] = (Target point of ability being cast)
          • Set point[2] = (point[0] offset by 20.00 towards (Angle from point[0] to point[1]) degrees)
          • Unit - Create 1 Dummy Bullet (arrow) for (Owner of (Triggering unit)) at point[2] facing (Angle from point[0] to point[1]) degrees
          • Animation - Change (Last created unit) flying height to 60.00 at 0.00
          • Set unit[0] = (Last created unit)
          • Custom script: set udg_integer = GetHandleIdBJ( udg_unit[0] )
          • Unit Group - Add (Last created unit) to dummygroup
          • Hashtable - Save (Angle from point[0] to point[1]) as 0 of integer in HASHARROW
          • -------- ARROW'S SPEED (RANGE PER 1 SEC) --------
          • Set real[0] = 3000.00
          • Hashtable - Save (real[0] / 100.00) as 1 of integer in HASHARROW
          • -------- ARROW HIT AREA --------
          • Set real[0] = 50.00
          • Hashtable - Save (real[0] / 1.00) as 2 of integer in HASHARROW
          • -------- DAMAGE --------
          • Set real[0] = 200.00
          • Hashtable - Save (real[0] / 1.00) as 3 of integer in HASHARROW
          • -------- MAX RANGE --------
          • Set real[0] = 1000.00
          • Hashtable - Save (real[0] / 1.00) as 6 of integer in HASHARROW
          • -------- GROUP TO AVOID DOUBLE DAMAGE THE SAME TARGET --------
          • Set group = (Units within (Load 2 of integer from HASHARROW) of point[1] matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of unit[0])) Equal to True)))
          • Custom script: call GroupClear( udg_group )
          • Hashtable - Save Handle Ofgroup as 5 of integer in HASHARROW
          • Custom script: call RemoveLocation( udg_point[0] )
          • Custom script: call RemoveLocation( udg_point[1] )
          • Custom script: call RemoveLocation( udg_point[2] )
        • Else - Actions
 
Level 8
Joined
Jan 28, 2016
Messages
486
You would have to do it in the loop trigger, where the Dummy Bullet unit would actually deal damage. I'm not exactly sure if this will work but wherever that damage action is, you could add an If-Then-Else statement immediately after it to check if the damaged unit's HP is below 0.405 (the threshold where a unit is technically dead) and if so, increase your kill counter by one.
 
Level 8
Joined
Jul 29, 2010
Messages
319
You would have to do it in the loop trigger, where the Dummy Bullet unit would actually deal damage. I'm not exactly sure if this will work but wherever that damage action is, you could add an If-Then-Else statement immediately after it to check if the damaged unit's HP is below 0.405 (the threshold where a unit is technically dead) and if so, increase your kill counter by one.
thank you, it's been bugging me all day :D
 
Level 11
Joined
May 16, 2016
Messages
730
how do i make this trigger check if the unit the projectile hits dies, then add +1 to a leaderboard value
If you use my template, then go to the Pick every 001 trigger and find string: Cause unit[0] to damage (Picked Unit). After that add next trigger:
If (Picked Unit) is alive equal false then add +1 to leaderboard value (for owner of unit[0]) else do nothing.
 
Status
Not open for further replies.
Top