[Spell] Triggered Locust Swarm

Chocobo

White-Flower
Reaction score
409
For the thread http://www.thehelper.net/forums/showthread.php?t=45018

I made a Triggered Locust Swarm, in which you can refer to each locust unit using [((((Custom value of (Triggering unit)) x 81) + ((<Xst unit) - 1)) mod 81)], I am currently working to get it to work perfectly.

This ability works at half, dummy units never gets removed at end. Someone knows how to do that?

Here is the triggers required :

Code:
Base Trigger
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Triggered Locust Swarm 
    Actions
        Set CurrentRegister = (CurrentRegister + 1)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                CurrentRegister Equal to 101
            Then - Actions
                Set CurrentRegister = 1
            Else - Actions
        Unit - Set the custom value of (Triggering unit) to CurrentRegister
        Set GetTriggerUnit[CurrentRegister] = (Triggering unit)
        -------- MODIFY WHATEVER NOW --------
        Set SwarmAmount[CurrentRegister] = 20
        Set SwarmDelay[CurrentRegister] = 0.03
        Set SwarmTime[CurrentRegister] = 30.00
        Set LifeStole[CurrentRegister] = 0.75
        Set SwarmUnitId[CurrentRegister] = Infestation
        Set SwarmDistance[CurrentRegister] = 1000.00
        Set UsePreAcquirement[CurrentRegister] = True
        Set AcquirementDistance[CurrentRegister] = 0.00
        Set SeekIfBelow[CurrentRegister] = False
        Set PercentageSeekHp[CurrentRegister] = 0.00
        Set SwarmExplodes[CurrentRegister] = False
        -------- DO NOT MODIFY AFTER --------
        For each (Integer A) from 1 to SwarmAmount[(Custom value of (Triggering unit))], do (Actions)
            Loop - Actions
                Set TrgPos[1] = (Position of (Triggering unit))
                Set RReal[1] = (Random real number between (SwarmDistance[(Custom value of (Triggering unit))] x 0.80) and SwarmDistance[(Custom value of (Triggering unit))])
                Set RReal[2] = (Random real number between 0.00 and 359.99)
                Set TrgPos[2] = (TrgPos[1] offset by RReal[1] towards RReal[2] degrees)
                Unit - Create 1 SwarmUnitId[(Custom value of (Triggering unit))] for (Owner of (Triggering unit)) at TrgPos[1] facing TrgPos[2]
                Unit - Order (Last created unit) to Attack-Move To TrgPos[2]
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        SwarmExplodes[(Custom value of (Triggering unit))] Equal to True
                    Then - Actions
                        Unit - Add a (SwarmTime[(Custom value of (Triggering unit))] - (SwarmDelay[(Custom value of (Triggering unit))] x (Real((Integer A))))) second Generic expiration timer to (Last created unit)
                    Else - Actions
                Set SwarmUnits[(((Custom value of (Triggering unit)) x 81) + ((Integer A) - 1))] = (Last created unit)
                Wait SwarmDelay[(Custom value of (Triggering unit))] game-time seconds
        For each (Integer A) from 1 to (Integer((SwarmTime[(Custom value of (Triggering unit))] - (SwarmDelay[(Custom value of (Triggering unit))] x (Real(SwarmAmount[(Custom value of (Triggering unit))])))))), do (Actions)
            Loop - Actions
                Set TrgPos[3] = (Position of (Triggering unit))
                For each (Integer B) from 1 to SwarmAmount[(Custom value of (Triggering unit))], do (Actions)
                    Loop - Actions
                        Set RReal[3] = (Random real number between (SwarmDistance[(Custom value of (Triggering unit))] - (SwarmDistance[(Custom value of (Triggering unit))] x 2.00)) and SwarmDistance[(Custom value of (Triggering unit))])
                        Set RReal[4] = (Random real number between 0.00 and 359.99)
                        Set TrgPos[4] = (TrgPos[3] offset by RReal[3] towards RReal[4] degrees)
                        Set TrgPos[5] = (Position of SwarmUnits[((((Custom value of (Triggering unit)) x 81) + ((Integer B) - 1)) mod 81)])
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                And - All (Conditions) are true
                                    Conditions
                                        SeekIfBelow[(Custom value of (Triggering unit))] Equal to False
                                        Or - Any (Conditions) are true
                                            Conditions
                                                (Distance between TrgPos[3] and TrgPos[4]) Greater than or equal to SwarmDistance[(Custom value of (Triggering unit))]
                                                (Distance between TrgPos[3] and TrgPos[5]) Greater than or equal to SwarmDistance[(Custom value of (Triggering unit))]
                            Then - Actions
                                Unit - Order SwarmUnits[((((Custom value of (Triggering unit)) x 81) + ((Integer B) - 1)) mod 81)] to Move To TrgPos[3]
                            Else - Actions
                                Unit - Order SwarmUnits[((((Custom value of (Triggering unit)) x 81) + ((Integer B) - 1)) mod 81)] to Attack-Move To TrgPos[4]
                Wait 1.00 game-time seconds
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Triggering unit) is dead) Equal to True
                    Then - Actions
                        For each (Integer B) from 1 to SwarmAmount[(Custom value of (Triggering unit))], do (Actions)
                            Loop - Actions
                                Unit - Kill SwarmUnits[((((Custom value of (Triggering unit)) x 81) + ((Integer B) - 1)) mod 81)]
                        Skip remaining actions
                    Else - Actions
        For each (Integer A) from 1 to SwarmAmount[(Custom value of (Triggering unit))], do (Actions)
            Loop - Actions
                Set TrgPos[6] = (Position of (Triggering unit))
                Set TrgPos[7] = (Position of SwarmUnits[((((Custom value of (Triggering unit)) x 81) + ((Integer B) - 1)) mod 81)])
                Unit - Order SwarmUnits[((((Custom value of (Triggering unit)) x 81) + ((Integer B) - 1)) mod 81)] to Move To TrgPos[6]
                Unit - Remove All buffs from SwarmUnits[((((Custom value of (Triggering unit)) x 81) + ((Integer B) - 1)) mod 81)]
                Unit - Add a ((Distance between TrgPos[6] and TrgPos[7]) / (Current movement speed of SwarmUnits[((((Custom value of (Triggering unit)) x 81) + ((Integer B) - 1)) mod 81)])) second Generic expiration timer to SwarmUnits[((((Custom value of (Triggering unit)) x 81) + ((Integer B) - 1)) mod 81)]

Code:
Required Trigger 1
    Events
        Time - Elapsed game time is 0.01 seconds
    Conditions
    Actions
        Custom script: set bj_wantDestroyGroup = true
        Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
            Loop - Actions
                Trigger - Add to Required Trigger 3 <gen> the event (Unit - (Picked unit) Takes damage)
                Unit - Set the custom value of (Picked unit) to 1
        Trigger - Destroy (This trigger)

Code:
Required Trigger 2
    Events
        Unit - A unit enters (Entire map)
    Conditions
        And - All (Conditions) are true
            Conditions
                (Custom value of (Triggering unit)) Equal to 0
                (Unit-type of (Triggering unit)) Not equal to SwarmUnitId[(Custom value of (Triggering unit))]
    Actions
        Trigger - Add to Required Trigger 3 <gen> the event (Unit - (Triggering unit) Takes damage)
        Unit - Set the custom value of (Triggering unit) to 1

Code:
Required Trigger 3
    Events
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Unit-type of (Damage source)) Equal to SwarmUnitId[(Custom value of (Damage source))]
            Then - Actions
                Unit - Set life of GetTriggerUnit[(Custom value of (Damage source))] to ((Life of GetTriggerUnit[(Custom value of (Damage source))]) + ((Damage taken) x LifeStole[(Custom value of (Triggering unit))]))
            Else - Actions

A file is attached to the post so you can download it.

The Triggered Locust Swarm is able to handle 100 casters, each having a capacity of 81 locust units.
 

Attachments

  • [Spell] Triggered Locust Swarm.w3x
    107.2 KB · Views: 170

SFilip

Gone but not forgotten
Reaction score
634
Uh please make it so that it doesn't require WEU. :rolleyes:
 

Sim

Forum Administrator
Staff member
Reaction score
534
And - All (Conditions) are true
Conditions
(Custom value of (Triggering unit)) Equal to 0
(Unit-type of (Triggering unit)) Not equal to SwarmUnitId[(Custom value of (Triggering unit))]

Conditions up there are already considered "And" conditions. You can remove the "and" part.
 

Chocobo

White-Flower
Reaction score
409
And - All (Conditions) are true
Conditions
(Custom value of (Triggering unit)) Equal to 0
(Unit-type of (Triggering unit)) Not equal to SwarmUnitId[(Custom value of (Triggering unit))]

Conditions up there are already considered "And" conditions. You can remove the "and" part.

Ok, didn't see I wrote And in normal conditions.


For that line :

Code:
                Unit - Add a ((Distance between TrgPos[6] and TrgPos[7]) / (Current movement speed of SwarmUnits[((((Custom value of (Triggering unit)) x 81) + ((Integer B) - 1)) mod 81)])) second Generic expiration timer to SwarmUnits[((((Custom value of (Triggering unit)) x 81) + ((Integer B) - 1)) mod 81)]

Do you know what the problem in it? It never worked.



Uh please make it so that it doesn't require WEU

Hmm? I didn't use WEU. I only used WE Helper without the LikeWEU.dll. :nuts: Or am I wrong?


Anyway it looks nice. I didn' t get it why there were two Locust Swarms.. then I realized it was for comparing, silly me Nice work !

Two locust swarms : One for Triggered, one for Normal. See the big differance between them, but this works REALLY fine. Need to fix the duration problem for locust units.
 

SFilip

Gone but not forgotten
Reaction score
634
> Or am I wrong?
Either that or something is seriously wrong with my editor.
weuhf2.jpg

Well if you simply disabled LikeWEU then that's not enough, vexorian figured out that disabling one plugin results in disabling something else...could be fixed in 1.6 though.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top