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

Maximum number of illusions

Status
Not open for further replies.
Level 18
Joined
May 11, 2012
Messages
2,103
How can i set maxium number of created illusions to 10?

  • [TRIGGER]Illusions
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Level of Iilusionate for (Attacking unit)) Greater than 0
    • Actions
      • Set Attacker = (Attacking unit)
      • Set TempPoint = (Position of Attacker)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Attacker is Summoned) Equal to True
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 1 and 100) Less than or equal to (3 x (Level of Iilusionate for Attacker))
            • Then - Actions
              • Unit - Create 1 Dummy illusion for (Owner of Attacker) at TempPoint facing Default building facing degrees
              • Unit - Hide (Last created unit)
              • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
              • Unit - Add Illusion (dummy) to (Last created unit)
              • Custom script: call IssueTargetOrderById(GetLastCreatedUnit(), 852274, udg_Attacker)
            • Else - Actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 1 and 100) Less than or equal to (3 x (Level of Iilusionate for Attacker))
            • Then - Actions
              • Unit - Create 1 Dummy illusion for (Owner of Attacker) at TempPoint facing Default building facing degrees
              • Unit - Hide (Last created unit)
              • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
              • Unit - Add Illusion (dummy) to (Last created unit)
              • Custom script: call IssueTargetOrderById(GetLastCreatedUnit(), 852274, udg_Attacker)
            • Else - Actions
      • Custom script: call RemoveLocation (udg_TempPoint)
[/TRIGGER]
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
You might need a saving method on that, I suggest Hashtable.
Each time illusion is created, increase IllusionCount by 1, and always perform check before making illusions, if it's greater than 10, do nothing (not to add this function, I mean just leave it blank)
Else, create the illusion and increase it by 1.
Remember to decrease the IllusionCount counter by 1 when illusion is found dead (make sure the illusion is from that spell casted, not any other illusion-based ability you have.
Put them in Unit Group or something to differentiate your Illusion is unique to other Illusion.
 
Level 18
Joined
May 11, 2012
Messages
2,103
I've imported all triggers and variables but it didn't work. I want you to properly import those triggers you made and variables to work

And what do you mean by ''hacked''?

ofc it's my map. Do you think that because of the big init trigger? I made it first time when creating hero siege map and converted it in custom text and just copied it on this new map
 
Level 10
Joined
Jun 6, 2007
Messages
392
It should work now. The problem was that illusions from mirror image messed up the counter. I also changed it so that it removes dummy units from the game.

You had only imported Illusions - trigger, probably because you can only copy one trigger/category at a time.

Edit: Removed attachment.
 
Last edited:
Status
Not open for further replies.
Top