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

Needs fix this spell

Status
Not open for further replies.
Level 18
Joined
May 11, 2012
Messages
2,103
Well, the problem is like this: When I learn the ability, the illusion summoning works ok until I reach the limit of 10 illusions. After that, it just doesn't works anymore.

The first Trigger:
  • Illusions Init
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set IllusionCount = (Last created hashtable)
Second:
  • Illusions
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Level of Illusionate (Neutral Hostile 1) for (Attacking unit)) Greater than 0
    • Actions
      • Set Attacker = (Attacking unit)
      • Set AttackerId = (Key (Attacking unit))
      • Set TempPoint = (Position of Attacker)
      • Custom script: set udg_IsIllusion = (LoadInteger(udg_IllusionCount, 2, udg_AttackerId) != null)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Attacker is an illusion) Equal to True
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IsIllusion Equal to True
              • (Random integer number between 1 and 100) Less than or equal to (7 x (Level of Illusionate (Neutral Hostile 1) for Attacker))
              • (Load 0 of (Load 2 of AttackerId from IllusionCount) from IllusionCount) Less than 10
            • 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 Dummy Illusionate to (Last created unit)
              • Hashtable - Save (Load 2 of AttackerId from IllusionCount) as 1 of (Key (Last created unit)) in IllusionCount
              • Custom script: call IssueTargetOrderById(GetLastCreatedUnit(), 852274, udg_Attacker)
              • Hashtable - Save ((Load 0 of (Load 2 of AttackerId from IllusionCount) from IllusionCount) + 1) as 0 of (Load 2 of AttackerId from IllusionCount) in IllusionCount
            • Else - Actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Attacker is A Hero) Equal to True
              • (Random integer number between 1 and 100) Less than or equal to (10 x (Level of Illusionate (Neutral Hostile 1) for Attacker))
              • (Load 0 of AttackerId from IllusionCount) Less than 10
            • Then - Actions
              • Unit - Create 1 Dummy 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 Dummy Illusionate to (Last created unit)
              • Hashtable - Save AttackerId as 1 of (Key (Last created unit)) in IllusionCount
              • Custom script: call IssueTargetOrderById(GetLastCreatedUnit(), 852274, udg_Attacker)
              • Hashtable - Save ((Load 0 of AttackerId from IllusionCount) + 1) as 0 of AttackerId in IllusionCount
            • Else - Actions
      • Custom script: call RemoveLocation (udg_TempPoint)
Third:
  • Illusions Summon
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoning unit)) Equal to Dummy illusion
    • Actions
      • Hashtable - Save (Load 1 of (Key (Summoning unit)) from IllusionCount) as 2 of (Key (Summoned unit)) in IllusionCount
      • Hashtable - Clear all child hashtables of child (Key (Summoning unit)) in IllusionCount
Fourth:
  • Illusions Remove
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is an illusion) Equal to True
    • Actions
      • Hashtable - Save ((Load 0 of (Load 2 of (Key (Triggering unit)) from IllusionCount) from IllusionCount) - 1) as 0 of (Load 2 of (Key (Triggering unit)) from IllusionCount) in IllusionCount
      • Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in IllusionCount
      • Unit - Remove (Triggering unit) from the game
Fifth:
  • Illusions Remove Dummy
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Dummy illusion
    • Actions
      • Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in IllusionCount
      • Unit - Remove (Triggering unit) from the game
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Because in the illusion die trigger, you should load the data from Attacker, not from the Illusion, therefore it will load null value (0).

How to load data from a unit that is not related to the trigger-response at all ?
Simple, just save the unit to the illusion (this time, illusion holds data to the Attacker unit).

And when the illusion dies, load unit from the illusion and once you have loaded the Attacker unit from the illusion, load the illusion count from the Attacker.

Therefore, the data is safely transferred.

I hope you can do it, as it will increase your trigger experience if you do it yourselves, try first, then I'll post a demo map if you really can't.
 
Level 18
Joined
May 11, 2012
Messages
2,103
gosh, I dont understand a single fuck there xD.

what should I do in here? :
  • Illusions Remove
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is an illusion) Equal to True
    • Actions
      • Hashtable - Save ((Load 0 of (Load 2 of (Key (Triggering unit)) from IllusionCount) from IllusionCount) - 1) as 0 of (Load 2 of (Key (Triggering unit)) from IllusionCount) in IllusionCount
      • Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in IllusionCount
      • Unit - Remove (Triggering unit) from the game
 
Status
Not open for further replies.
Top