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

[Solved] Unable to remove dummies

Status
Not open for further replies.

Rheiko

Spell Reviewer
Level 26
Joined
Aug 27, 2013
Messages
4,214
So, after a long time not practicing my spell-making skill (Not that it was good to begin with anyway) I decided to make a simple spell which I've planned to upload later in the spell section. Supposedly, the spell summons 3/5/7 units which will then move to the target point and create an explosion, as simple as that. But the problem is, I can't remove the dummy for some reason. Probably because I don't de-index properly or something that I'm not aware of. Be noted that this is still a WIP and there might be still tons of flaws, so please point out which part I did wrong. Your feedback on helping me to improve this trigger will be greatly appreciated. :)



  • StarBurst Config
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set SB_Abil = Star Burst
      • Set SB_DummyType = Dummy1
      • Set SB_DummyType2 = Dummy2
      • Set SB_DummyType3 = Dummy3
      • Set SB_Damage[1] = 150.00
      • Set SB_Damage[2] = 250.00
      • Set SB_Damage[3] = 350.00
      • Set SB_AoE[1] = 500.00
      • Set SB_AoE[2] = 500.00
      • Set SB_AoE[3] = 500.00
      • Set SB_DCount[1] = 3
      • Set SB_DCount[2] = 5
      • Set SB_DCount[3] = 7
      • Set SB_Speed[1] = 5.00
      • Set SB_Speed[2] = 5.00
      • Set SB_Speed[3] = 5.00

  • StarBurst Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to SB_Abil
    • Actions
      • Set SB_Max_Index = (SB_Max_Index + 1)
      • Set SB_Caster[SB_Max_Index] = (Triggering unit)
      • Set SB_Player[SB_Max_Index] = (Triggering player)
      • Set SB_Level[SB_Max_Index] = (Level of SB_Abil for SB_Caster[SB_Max_Index])
      • Set SB_Point[SB_Max_Index] = (Target point of ability being cast)
      • Set SB_Interval[SB_Max_Index] = SB_AoE[SB_Level[SB_Max_Index]]
      • Set SB_Stage[SB_Max_Index] = 1
      • For each (Integer SB_TempINT) from 1 to SB_DCount[SB_Level[SB_Max_Index]], do (Actions)
        • Loop - Actions
          • Unit - Create 1 SB_DummyType3 for SB_Player[SB_Max_Index] at (SB_Point[SB_Max_Index] offset by SB_AoE[SB_Level[SB_Max_Index]] towards ((Real(SB_TempINT)) x (360.00 / (Real(SB_DCount[SB_Level[SB_Max_Index]])))) degrees) facing (Angle from (SB_Point[SB_Max_Index] offset by SB_AoE[SB_Level[SB_Max_Index]] towards ((Real(SB_TempINT)) x (360.00 / (Real(SB_DCount[SB_Level[SB_Max_Index]])))) degrees) to SB_Point[SB_Max_Index]) degrees
          • Set SB_Dummy[SB_Max_Index] = (Last created unit)
          • Unit Group - Add SB_Dummy[SB_Max_Index] to SB_Group[SB_Max_Index]
          • Unit - Add a ((SB_AoE[SB_Level[SB_Max_Index]] / SB_Speed[SB_Level[SB_Max_Index]]) / 100.00) second Generic expiration timer to SB_Dummy[SB_Max_Index]
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SB_Max_Index Equal to 1
        • Then - Actions
          • Trigger - Turn on StarBurst Loop <gen>
        • Else - Actions

  • StarBurst Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer SB_Cur_Index) from 1 to SB_Max_Index, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (SB_Group[SB_Cur_Index] is empty) Equal to False
            • Then - Actions
              • Unit Group - Pick every unit in SB_Group[SB_Cur_Index] and do (Actions)
                • Loop - Actions
                  • Set SB_Dummy[SB_Cur_Index] = (Picked unit)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • SB_Interval[SB_Cur_Index] Not equal to 0.00
                    • Then - Actions
                      • Set SB_TempPoint = (Position of SB_Dummy[SB_Cur_Index])
                      • Set SB_Interval[SB_Cur_Index] = (SB_Interval[SB_Cur_Index] - SB_Speed[SB_Level[SB_Cur_Index]])
                      • Set SB_TempPoint2 = (SB_Point[SB_Cur_Index] offset by SB_Interval[SB_Cur_Index] towards ((Angle from SB_Point[SB_Cur_Index] to SB_TempPoint) + 5.00) degrees)
                      • Custom script: call SetUnitX(udg_SB_Dummy[udg_SB_Cur_Index], GetLocationX(udg_SB_TempPoint2))
                      • Custom script: call SetUnitY(udg_SB_Dummy[udg_SB_Cur_Index], GetLocationY(udg_SB_TempPoint2))
                      • Custom script: call RemoveLocation(udg_SB_TempPoint)
                      • Custom script: call RemoveLocation(udg_SB_TempPoint2)
                    • Else - Actions
                      • Unit - Create 1 SB_DummyType2 for SB_Player[SB_Cur_Index] at SB_Point[SB_Cur_Index] facing Default building facing degrees
                      • Unit - Kill (Last created unit)
                      • Unit - Create 1 SB_DummyType for SB_Player[SB_Cur_Index] at SB_Point[SB_Cur_Index] facing Default building facing degrees
                      • Unit - Kill (Last created unit)
                      • Unit Group - Remove SB_Dummy[SB_Cur_Index] from SB_Group[SB_Cur_Index]
            • Else - Actions
              • Custom script: set bj_wantDestroyGroup = true
              • Unit Group - Pick every unit in (Units within SB_AoE[SB_Level[SB_Cur_Index]] of SB_Point[SB_Cur_Index]) and do (Actions)
                • Loop - Actions
                  • Set SB_TempUnit = (Picked unit)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (SB_TempUnit is alive) Equal to True
                      • (SB_TempUnit belongs to an enemy of SB_Player[SB_Cur_Index]) Equal to True
                      • (SB_TempUnit is Mechanical) Equal to False
                    • Then - Actions
                      • Unit - Cause SB_Caster[SB_Cur_Index] to damage SB_TempUnit, dealing SB_Damage[SB_Level[SB_Cur_Index]] damage of attack type Spells and damage type Normal
                    • Else - Actions
              • Game - Display to (All players) the text: De-Index
              • Set SB_Caster[SB_Cur_Index] = SB_Caster[SB_Max_Index]
              • Set SB_Caster[SB_Max_Index] = No unit
              • Set SB_Dummy[SB_Cur_Index] = SB_Dummy[SB_Max_Index]
              • Set SB_Dummy[SB_Max_Index] = No unit
              • Set SB_Group[SB_Cur_Index] = SB_Group[SB_Max_Index]
              • Set SB_Interval[SB_Cur_Index] = SB_Interval[SB_Max_Index]
              • Set SB_Level[SB_Cur_Index] = SB_Level[SB_Max_Index]
              • Set SB_Cur_Index = (SB_Cur_Index - 1)
              • Set SB_Max_Index = (SB_Max_Index - 1)
              • Set SB_Point[SB_Cur_Index] = SB_Point[SB_Max_Index]
              • Custom script: call RemoveLocation(udg_SB_Point[udg_SB_Max_Index])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • SB_Max_Index Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions

 

Attachments

  • Star Burst.w3x
    33.1 KB · Views: 43
Last edited:
Level 28
Joined
Mar 25, 2008
Messages
2,955
  • Set temppoint1 = Position of Triggering Unit
  • Set temppoint2 = Position of Target unit of ability being cast
  • Set distance = Distance between temppoint 1 and temppoint 2
  • Set speed = Movement speed in units
  • Unit - Create unit X
  • Unit - Add a (distance/speed) seconds expiration timer to unit X
  • Stuff
  • Custom script: call RemoveLocation(udg_temppoint1)
  • Custom script: call RemoveLocation(udg_temppoint2)
>should< work - I typed this without wc3 open.
 

Rheiko

Spell Reviewer
Level 26
Joined
Aug 27, 2013
Messages
4,214
  • Set temppoint1 = Position of Triggering Unit
  • Set temppoint2 = Position of Target unit of ability being cast
  • Set distance = Distance between temppoint 1 and temppoint 2
  • Set speed = Movement speed in units
  • Unit - Create unit X
  • Unit - Add a (distance/speed) seconds expiration timer to unit X
  • Stuff
  • Custom script: call RemoveLocation(udg_temppoint1)
  • Custom script: call RemoveLocation(udg_temppoint2)
>should< work - I typed this without wc3 open.
Since I couldn't find any other workaround, I tried your suggestion and it does work. One problem left, it's not MUI yet. (or at least how it seems)
Updated the first post.
 
    • Set SB_Point[SB_Cur_Index] = SB_Point[SB_Max_Index]
    ^This should be before you decrement Cur_Index & Max_Index (you will also need to move the RemoveLocation() custom script and change it to Cur_Index

  • Your index/deindex are correct, so it's most likely the unit group arrays. You will need to manually intialize them on cast:
    • Custom script: if udg_SB_Group[udg_SB_Max_Index] == null then
    • Custom script: set udg_SB_Group[udg_SB_Max_Index] = CreateGroup()
    • Custom script: endif
    Then on deindex:
    • Custom script: call DestroyGroup(udg_SB_Group[udg_SB_Cur_index]
    • Set SB_Group[udg_SB_Cur_Index] = SB_Group[SB_Max_Index]
    • Custom script: set udg_SB_Group[udg_SB_Max_Index] = null
 
Status
Not open for further replies.
Top