• 🏆 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] Juxtapose Image Limit

Status
Not open for further replies.
Level 8
Joined
Nov 21, 2008
Messages
316
What do i need to add to my trigger to limit images to 5
  • Juxtapose
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacking unit) has buff Juxtapose ) Equal to True
    • Actions
      • Set J_Hero = (Attacking unit)
      • Set J_Hero_Loc = (Position of J_Hero)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Juxtapose for J_Hero) Equal to 1
          • (Random integer number between 1 and 100) Greater than 97
        • Then - Actions
          • Unit - Create 1 J_Dummy for (Owner of J_Hero) at J_Hero_Loc facing Default building facing degrees
          • Set J_Dummy = (Last created unit)
          • Hero - Create Wand of Illusion and give it to J_Dummy
          • Hero - Order J_Dummy to use (Last created item) on J_Hero
          • Unit - Remove J_Dummy from the game
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Juxtapose for J_Hero) Equal to 2
              • (Random integer number between 1 and 100) Greater than 94
            • Then - Actions
              • Unit - Create 1 J_Dummy for (Owner of J_Hero) at J_Hero_Loc facing Default building facing degrees
              • Set J_Dummy = (Last created unit)
              • Hero - Create Wand of Illusion and give it to J_Dummy
              • Hero - Order J_Dummy to use (Last created item) on J_Hero
              • Unit - Remove J_Dummy from the game
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Juxtapose for J_Hero) Equal to 3
                  • (Random integer number between 1 and 100) Greater than 91
                • Then - Actions
                  • Unit - Create 1 J_Dummy for (Owner of J_Hero) at J_Hero_Loc facing Default building facing degrees
                  • Set J_Dummy = (Last created unit)
                  • Hero - Create Wand of Illusion and give it to J_Dummy
                  • Hero - Order J_Dummy to use (Last created item) on J_Hero
                  • Unit - Remove J_Dummy from the game
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of Juxtapose for J_Hero) Equal to 4
                      • (Random integer number between 1 and 100) Greater than 88
                    • Then - Actions
                      • Unit - Create 1 J_Dummy for (Owner of J_Hero) at J_Hero_Loc facing Default building facing degrees
                      • Set J_Dummy = (Last created unit)
                      • Hero - Create Wand of Illusion and give it to J_Dummy
                      • Hero - Order J_Dummy to use (Last created item) on J_Hero
                      • Unit - Remove J_Dummy from the game
                    • Else - Actions
      • Custom script: call RemoveLocation(udg_J_Hero_Loc)
 
Level 8
Joined
Nov 21, 2008
Messages
316
  • (Number of units in (Units owned by (Owner of J_Hero) matching (((Matching unit) is an illusion) Equal to True))) Less than or equal to 5
I added the condition u said, i placed it in each "if - condition" after but it makes the trigger not work :(.... is there an error on my part?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
It leaks anyway.

Firstly I adivse getting rid of the multiple selection for formula based code (where by the level is used as an index to look up the chance integer from an array). This would reduce your code complexity by a lot (no multiple selection) and make its execution time independant of ability level.

Secondly you are after keeping track of how many illusions are out. This can be done via counter triggers on the illusion creation and deaths or via the method described above (getting all illusions owned by player and counting them (will remove MUI) and checking if less than 5). Logically you would want to build the count check into the trigger condition (before the actions execute) cause it is pointless running code to make an illusion that can never exist.
 
Level 16
Joined
Jun 24, 2009
Messages
1,409
i made the shorter code for you
  • Juxtapose
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacking unit) has buff Juxtapose ) Equal to True
    • Actions
      • Set J_Hero = (Attacking unit)
      • Set J_Hero_Loc = (Position of J_Hero)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • (Random integer number between 1 and 100) Less than or equal to (3 x (Level of Juxtapose for (Last created unit)))
              • (Number of units in (Units owned by (Owner of J_Hero) matching (((Matching unit) is an illusion) Equal to True))) Less than or equal to 5
        • Then - Actions
          • Unit - Create 1 J_Dummy for (Owner of J_Hero) at J_Hero_Loc facing Default building facing degrees
          • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
          • Hero - Create Wand of Illusion and give it to (Last created unit)
          • Hero - Order (Last created unit) to use (Last created item) on J_Hero
        • Else - Actions
      • Custom script: call RemoveLocation(udg_J_Hero_Loc)
i know the image limit is not MUI but it's MPI ~.~
 
Status
Not open for further replies.
Top