• 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.

Detecting Illusions

Status
Not open for further replies.
Level 13
Joined
Mar 24, 2013
Messages
1,105
Well I'm trying to detect an illusion so I can add it to a unit group, the trouble is the event I'm using seems to "not be fast enough" or maybe its another issue I have not thought of.

The cooldown of the wand of illusion ability is 0.
A unit enters playable map area did not work at all.

Primary concern is DR Cast 2 and its interaction with DR Cast

  • DR Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Draenei Realm
    • Actions
      • Set DR_MaxIndex = (DR_MaxIndex + 1)
      • Set DR_Caster[DR_MaxIndex] = (Triggering unit)
      • Set TempInteger = 0
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Reality for DR_Caster[DR_MaxIndex]) Equal to 0
        • Then - Actions
          • Unit - Add Reality to DR_Caster[DR_MaxIndex]
        • Else - Actions
      • Custom script: set udg_DR_IllusionGroup[udg_DR_MaxIndex] = CreateGroup()
      • Set DR_Duration[DR_MaxIndex] = DR_SetDuration[(Level of Draenei Realm for DR_Caster[DR_MaxIndex])]
      • Set TempPoint = (Position of DR_Caster[DR_MaxIndex])
      • Unit - Create 1 Dummy for (Owner of DR_Caster[DR_MaxIndex]) at TempPoint facing Default building facing degrees
      • Set TempUnit = (Last created unit)
      • Unit - Add Illusions to TempUnit
      • Unit - Add a 1.00 second Generic expiration timer to TempUnit
      • Set DR_EnemyHeroGroup[DR_MaxIndex] = (Units in (Playable map area) matching (((((Matching unit) is A Hero) Equal to True) and (((Matching unit) is alive) Equal to True)) and (((Matching unit) belongs to an enemy of (Owner of DR_Caster[DR_MaxIndex])) Equal to True)))
      • Trigger - Turn on DR Cast2 <gen> // Having it permanently on does nothing, and I only want it to be adding specific units to a specific group.
      • Unit Group - Pick every unit in DR_EnemyHeroGroup[DR_MaxIndex] and do (Actions)
        • Loop - Actions
          • Set TempUnit2 = (Picked unit)
          • Custom script: call IssueTargetOrderById(udg_TempUnit, 852274, udg_DR_Caster[udg_DR_MaxIndex])
          • Set TempInteger = (TempInteger + 1)
          • Game - Display to (All players) the text: (String(TempInteger)) Shows 1-6
          • Unit Group - Pick every unit in DR_IllusionGroup[DR_MaxIndex] and do (Actions)
            • Loop - Actions
              • Set TempUnit3 = (Picked unit)
              • Game - Display to (All players) the text: (Proper name of TempUnit3) //Nothing Displayed
              • Custom script: call SetUnitX(udg_TempUnit3, GetUnitX(udg_TempUnit2))
              • Custom script: call SetUnitY(udg_TempUnit3, GetUnitY(udg_TempUnit2))
      • Game - Display to (All players) the text: (String((Number of units in DR_IllusionGroup[DR_MaxIndex]))) // Shows 1 unit in group but TempInteger = 6, because I have 6 preplaced units.
      • Trigger - Turn off DR Cast2 <gen>
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DR_MaxIndex Equal to 1
        • Then - Actions
          • Trigger - Turn on DR Loop <gen>
        • Else - Actions
      • Custom script: call RemoveLocation(udg_TempPoint)
  • DR Cast2
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
    • Actions
      • Game - Display to (All players) the text: fire
      • Set TempUnit = (Triggering unit)
      • Custom script: if IsUnitIllusion(udg_TempUnit) == true then
      • Unit Group - Add TempUnit to DR_IllusionGroup[DR_MaxIndex]
      • Unit - Add Illusion Distinguish to TempUnit
      • Game - Display to (All players) the text: fire 2
      • Custom script: endif
      • Cinematic - Ping minimap for (All players) at (Position of (Triggering unit)) for 2 seconds
  • DR Loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • For each (Integer DR_CurrentIndex) from 1 to DR_MaxIndex, do (Actions)
        • Loop - Actions
          • Set DR_Duration[DR_CurrentIndex] = (DR_Duration[DR_CurrentIndex] - 0.05)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DR_Duration[DR_MaxIndex] Less than or equal to 0.00
            • Then - Actions
              • Unit Group - Pick every unit in DR_IllusionGroup[DR_CurrentIndex] and do (Actions)
                • Loop - Actions
                  • Set TempUnit2 = (Picked unit)
                  • Unit - Remove TempUnit2 from the game
              • Custom script: call DestroyGroup(udg_DR_IllusionGroup[udg_DR_CurrentIndex])
              • Custom script: call DestroyGroup(udg_DR_EnemyHeroGroup[udg_DR_CurrentIndex])
              • Set DR_Caster[DR_CurrentIndex] = DR_Caster[DR_MaxIndex]
              • Set DR_Duration[DR_CurrentIndex] = DR_Duration[DR_MaxIndex]
              • Set DR_EnemyHeroGroup[DR_CurrentIndex] = DR_EnemyHeroGroup[DR_MaxIndex]
              • Set DR_IllusionGroup[DR_CurrentIndex] = DR_IllusionGroup[DR_MaxIndex]
              • Set DR_CurrentIndex = (DR_CurrentIndex - 1)
              • Set DR_MaxIndex = (DR_MaxIndex - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DR_MaxIndex Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
              • Unit Group - Pick every unit in DR_EnemyHeroGroup[DR_CurrentIndex] and do (Actions)
                • Loop - Actions
                  • Set TempUnit = (Picked unit)
                  • Set TempPoint = (Position of TempUnit)
                  • Set TempReal = 1000000000.00
                  • Unit Group - Pick every unit in DR_IllusionGroup[DR_CurrentIndex] and do (Actions)
                    • Loop - Actions
                      • Set TempUnit2 = (Picked unit)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (TempUnit2 is alive) Equal to True
                        • Then - Actions
                          • Set TempPoint2 = (Position of TempUnit2)
                          • Set TempReal2 = (Distance between TempPoint and TempPoint2)
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • TempReal2 Less than TempReal
                            • Then - Actions
                              • Set TempReal = TempReal2
                              • Set TempUnit3 = (Picked unit)
                              • Unit - Order TempUnit3 to Attack TempUnit
                            • Else - Actions
                        • Else - Actions
                          • Unit - Remove TempUnit2 from the game
                          • Unit Group - Remove TempUnit2 from DR_IllusionGroup[DR_CurrentIndex]
                      • Custom script: call RemoveLocation(udg_TempPoint2)
                  • Custom script: call RemoveLocation(udg_TempPoint)
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
Try using the item illusion as an ability (if it doesn't work on item use) and use the event a unit spawns a summoned unit.

EDIT: Make sure to use a dedicated variable for that trigger as it will interrupt the trigger firing it:
Code:
create dummy
add illusion ability
cast illusion
-> interrupt, any temp variables you're using will be overwritten if used on the spawn event trigger.
...
more actions
 
Status
Not open for further replies.
Top