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

[Solved] Need help with ability that has 80% chance hit

Level 12
Joined
Oct 28, 2019
Messages
475
An archer shoots a poison arrow, if it has the item in stock, but has 80% chance hit. I made random number betwen 1 and 5 if is 1 the dummy without the poison ability will cast the poison arrow, a floating text miss appears, if not the dummy with the poison ability casts. But it is not working, need help, sometimes dont shoot the poison arrow.

  • Poison Arrow old
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Envenomed Arrow (Archer)
      • ((Casting unit) has an item of type Poison Arrow) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 5) Equal to 1
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Charges remaining in (Item carried by (Casting unit) of type Poison Arrow)) Greater than 1
            • Then - Actions
              • Set VariableSet FA_Point = (Position of (Casting unit))
              • Set VariableSet UnitPoison = (Target unit of ability being cast)
              • Unit - Create 1 Poison Arrow Dummy Miss for Neutral Passive at FA_Point facing (Facing of (Casting unit)) degrees
              • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
              • Custom script: call RemoveLocation(udg_FA_Point)
              • Unit - Order (Last created unit) to Attack Once UnitPoison
              • Item - Set charges remaining in (Item carried by (Casting unit) of type Poison Arrow) to ((Charges remaining in (Item carried by (Casting unit) of type Poison Arrow)) - 1)
              • Floating Text - Create floating text that reads |cffff0000Miss|r at (Position of (Casting unit)) with Z offset 0.00, using font size 8.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Charges remaining in (Item carried by (Casting unit) of type Poison Arrow)) Equal to 1
                • Then - Actions
                  • Set VariableSet FA_Point = (Position of (Casting unit))
                  • Set VariableSet UnitPoison = (Target unit of ability being cast)
                  • Unit - Create 1 Poison Arrow Dummy Miss for Neutral Passive at FA_Point facing (Facing of (Casting unit)) degrees
                  • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
                  • Custom script: call RemoveLocation(udg_FA_Point)
                  • Unit - Order (Last created unit) to Attack Once UnitPoison
                  • Item - Remove (Item carried by (Casting unit) of type Poison Arrow)
                  • Unit - Remove Envenomed Arrow (Archer) from (Casting unit)
                  • Floating Text - Create floating text that reads |cffff0000Miss|r at (Position of (Casting unit)) with Z offset 0.00, using font size 8.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                  • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                  • Floating Text - Change (Last created floating text): Disable permanence
                  • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
                • Else - Actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Charges remaining in (Item carried by (Casting unit) of type Poison Arrow)) Greater than 1
            • Then - Actions
              • Set VariableSet FA_Point = (Position of (Casting unit))
              • Set VariableSet UnitPoison = (Target unit of ability being cast)
              • Unit - Create 1 Poison Arrow Dummy for Neutral Passive at FA_Point facing (Facing of (Casting unit)) degrees
              • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
              • Custom script: call RemoveLocation(udg_FA_Point)
              • Unit - Order (Last created unit) to Attack Once UnitPoison
              • Item - Set charges remaining in (Item carried by (Casting unit) of type Poison Arrow) to ((Charges remaining in (Item carried by (Casting unit) of type Poison Arrow)) - 1)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Charges remaining in (Item carried by (Casting unit) of type Poison Arrow)) Equal to 1
                • Then - Actions
                  • Set VariableSet FA_Point = (Position of (Casting unit))
                  • Set VariableSet UnitPoison = (Target unit of ability being cast)
                  • Unit - Create 1 Poison Arrow Dummy for Neutral Passive at FA_Point facing (Facing of (Casting unit)) degrees
                  • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
                  • Custom script: call RemoveLocation(udg_FA_Point)
                  • Unit - Order (Last created unit) to Attack Once UnitPoison
                  • Item - Remove (Item carried by (Casting unit) of type Poison Arrow)
                  • Unit - Remove Envenomed Arrow (Archer) from (Casting unit)
                • Else - Actions
 
Top