• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] Bullet help

Status
Not open for further replies.
Level 5
Joined
Jan 12, 2010
Messages
132
So i have the first trigger that set the value that i need for bullet trigger
  • test tower
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Combine
      • (Number of units in Darkness_rune[(Player number of (Owner of Temp_unit))]) Greater than or equal to 1
      • (Number of units in Earth_rune[(Player number of (Owner of Temp_unit))]) Greater than or equal to 1
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Darkness Rune
          • (Unit-type of (Triggering unit)) Equal to Earth Rune
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Earth Rune
        • Then - Actions
          • Set Caster = (Triggering unit)
          • Set Temp_point = (Position of Caster)
          • Set Temp_unit = (Random unit from Darkness_rune[(Player number of (Owner of (Triggering unit)))])
          • Unit Group - Remove Temp_unit from Darkness_rune[(Player number of (Owner of (Triggering unit)))]
          • Set Temp_point2 = (Position of Temp_unit)
          • Unit - Remove Temp_unit from the game
          • Unit - Create 1 Dummy (Dark) for (Owner of (Triggering unit)) at Temp_point2 facing Temp_point
          • Lightning - Create a Drain Mana lightning effect from source Temp_point2 to target Temp_point
          • Lightning - Change color of (Last created lightning effect) to (1.00 1.00 1.00) with 1.00 alpha
          • Set Bullet_timer = 2.00
          • Set Bullet_angle = (Angle from Temp_point2 to Temp_point)
          • Hashtable - Save Handle OfTemp_point as 1 of (Key (Last created unit)) in Hashtable
          • Hashtable - Save Bullet_timer as 2 of (Key (Last created unit)) in Hashtable
          • Hashtable - Save Bullet_angle as 3 of (Key (Last created unit)) in Hashtable
          • Hashtable - Save Handle Of(Last created lightning effect) as 4 of (Key (Last created unit)) in Hashtable
          • Custom script: call RemoveLocation(udg_Temp_point)
          • Custom script: call RemoveLocation(udg_Temp_point2)
          • Unit Group - Add (Last created unit) to Bullets
          • Unit - Remove Caster from the game
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Darkness Rune
        • Then - Actions
          • Set Caster = (Triggering unit)
          • Set Temp_point = (Position of Caster)
          • Set Temp_unit = (Random unit from Earth_rune[(Player number of (Owner of (Triggering unit)))])
          • Unit Group - Remove Temp_unit from Earth_rune[(Player number of (Owner of (Triggering unit)))]
          • Set Temp_point2 = (Position of Temp_unit)
          • Unit - Remove Temp_unit from the game
          • Unit - Create 1 Dummy (Earth) for (Owner of (Triggering unit)) at Temp_point2 facing Temp_point
          • Lightning - Create a Drain Mana lightning effect from source Temp_point2 to target Temp_point
          • Lightning - Change color of (Last created lightning effect) to (1.00 1.00 1.00) with 1.00 alpha
          • Set Bullet_timer = 2.00
          • Set Bullet_angle = (Angle from Temp_point2 to Temp_point)
          • Hashtable - Save Handle OfTemp_point as 1 of (Key (Last created unit)) in Hashtable
          • Hashtable - Save Bullet_timer as 2 of (Key (Last created unit)) in Hashtable
          • Hashtable - Save Bullet_angle as 3 of (Key (Last created unit)) in Hashtable
          • Hashtable - Save Handle Of(Last created lightning effect) as 4 of (Key (Last created unit)) in Hashtable
          • Custom script: call RemoveLocation(udg_Temp_point)
          • Custom script: call RemoveLocation(udg_Temp_point2)
          • Unit Group - Add (Last created unit) to Bullets
          • Unit - Remove Caster from the game
        • Else - Actions
And that trigger work but for a reason that I dont know bullet dont move to the angle that is saved in hashtable.instood of that in move to angle 45 grades.
  • Bulet move
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Bullets and do (Actions)
        • Loop - Actions
          • Set Bullet_timer = (Load 2 of (Key (Picked unit)) from Hashtable)
          • Set Bullet_unit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Bullet_timer Greater than or equal to 0.02
            • Then - Actions
              • Hashtable - Save (Bullet_timer - 0.02) as 2 of (Key (Picked unit)) in Hashtable
              • Set Bullet_point = (Position of Bullet_unit)
              • Set Bullet_point2 = (Load 1 of (Key (Picked unit)) in Hashtable)
              • Set Bullet_angle = (Load 3 of (Key (Picked unit)) from Hashtable)
              • Set Bullet_point3 = (Bullet_point offset by ((Distance between Bullet_point and Bullet_point2) / 100.00) towards Bullet_angle degrees)
              • Unit - Move Bullet_unit instantly to Bullet_point3
              • Lightning - Move (Load 4 of (Key (Picked unit)) in Hashtable) to source Bullet_point3 and target Bullet_point2
              • Custom script: call RemoveLocation(udg_Bullet_point)
              • Custom script: call RemoveLocation(udg_Bullet_point2)
              • Custom script: call RemoveLocation(udg_Bullet_point3)
            • Else - Actions
              • Lightning - Destroy (Load 4 of (Key (Picked unit)) in Hashtable)
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Hashtable
              • Unit Group - Remove Bullet_unit from Bullets
              • Unit - Remove Bullet_unit from the game
 
All references to (Picked unit) should be changed to Bullet_unit in
the loop. Many native calls, like this one, are expensive in rapid
timer loops like what you have so referencing the variables is
going to help you.

I recommend changing all references of 0.02 to 0.3 or 0.04. There
is no reason to run this thing 50 times per second because your
eye can only see maybe 30 frames per second anyway.
 
Status
Not open for further replies.
Top