Help with spell

S

Scroller

Guest
Hi I have a problem with a spell. It works somewhat. I get the desired effect but the spell spawns like a gazillion dummy units and lags up the whole map. Here's the trigger.
Code:
Restoration
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to Restoration 
    Actions
        Set AlliedG = (Units in (Playable map area))
        Unit Group - Pick every unit in AlliedG and do (Actions)
            Loop - Actions
                Unit Group - Pick every unit in AlliedG and do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (((Picked unit) is A Hero) Equal to True) and (((Picked unit) belongs to an ally of (Owner of (Casting unit))) Equal to True)
                            Then - Actions
                                Set Playerpt = (Position of (Casting unit))
                                Unit - Create 1 Dummyunit for (Owner of (Casting unit)) at (Position of (Casting unit)) facing Default building facing degrees
                                Unit - Add Dummyrest  to (Last created unit)
                                Unit - Set level of Dummyrest  for (Last created unit) to (Level of Restoration  for (Casting unit))
                                Unit - Order (Last created unit) to Human Paladin - Holy Light (Picked unit)
                                Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
                                Custom script:   call RemoveLocation(udg_Playerpt)
                            Else - Actions
                                Do nothing
        Custom script:   call DestroyGroup(udg_AlliedG)
Any help would be greatly apprecitated. Will +rep those who solve the problem.
 

I_RULE_YOU

New Member
Reaction score
34
Well, perhaps you could give a description of your spell?



EDIT: Hmm well I'm not as smart trigger wise as most of the people on this forum, but in your loop, your picking every unit in the entire map, which can cause lag, and your doing it twice, which would cause even more lag.

Heres a solution off the top of my head...after you Set AlliedG do this:

Code:
Set AlliedX = (Units in AlliedG matching unit is a hero and matching unit belongs to an ally of casting unit)

Then pick every unit in AlliedX and do your actions, not AlliedG

Should decrease your lag tenfold if im not mistaken.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top