Trigger Lag First Run Only

Dameon

"All the power in the world resides in the eyes"
Reaction score
127
For some reason this trigger is causeing 3 to 4 secound lag the first time it runs, but then after that it dosen't lagg anymore, I tryed out 2 defrent forms of the trigger to stop the lag and I will post them both.

Code:
Ability Builder
    Events
        Unit - A unit Finishes construction
        Unit - A unit Dies
    Conditions
        (Unit-type of (Triggering unit)) Equal to Command Post [Builder-MA]
    Actions
        For each (Integer Main_Interger[0]) from 1 to 12, do (Actions)
            Loop - Actions
                Set Temp_UG = (Units owned by (Owner of (Triggering unit)) of type UT_Builder[Main_Interger[0]])
                Unit Group - Pick every unit in Temp_UG and do (Actions)
                    Loop - Actions
                        Unit - Remove SB_Builder  from (Picked unit)
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Number of living Command Post [Builder-MA] units owned by (Owner of (Triggering unit))) Greater than 0
                            Then - Actions
                                Unit - Add SB_Builder  to (Picked unit)
                                Unit - Set level of Armor Bonus [Builder] for (Picked unit) to (Number of living Command Post [Builder-MA] units owned by (Owner of (Triggering unit)))
                                Unit - Set level of Damage Bonus [Builder] for (Picked unit) to (Number of living Command Post [Builder-MA] units owned by (Owner of (Triggering unit)))
                            Else - Actions
                Custom script:   call DestroyGroup (udg_Temp_UG)

I did this one cause I thought removeing an ability from a unit that dosen't have it yet might be causeing the problim.

Code:
Ability Builder
    Events
        Unit - A unit Finishes construction
        Unit - A unit Dies
    Conditions
        (Unit-type of (Triggering unit)) Equal to Command Post [Builder-MA]
    Actions
        For each (Integer Main_Interger[0]) from 1 to 12, do (Actions)
            Loop - Actions
                Set Temp_UG = (Units owned by (Owner of (Triggering unit)) of type UT_Builder[Main_Interger[0]])
                Unit Group - Pick every unit in Temp_UG and do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                Boolean_Builder[(Player number of (Owner of (Triggering unit)))] Equal to False
                            Then - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        (Number of living Command Post [Builder-MA] units owned by (Owner of (Triggering unit))) Greater than 0
                                    Then - Actions
                                        Unit - Add SB_Builder  to (Picked unit)
                                        Unit - Set level of Armor Bonus [Builder] for (Picked unit) to (Number of living Command Post [Builder-MA] units owned by (Owner of (Triggering unit)))
                                        Unit - Set level of Damage Bonus [Builder] for (Picked unit) to (Number of living Command Post [Builder-MA] units owned by (Owner of (Triggering unit)))
                                    Else - Actions
                                Set Boolean_Builder[(Player number of (Owner of (Triggering unit)))] = True
                            Else - Actions
                                Unit - Remove SB_Builder  from (Picked unit)
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        (Number of living Command Post [Builder-MA] units owned by (Owner of (Triggering unit))) Greater than 0
                                    Then - Actions
                                        Unit - Add SB_Builder  to (Picked unit)
                                        Unit - Set level of Armor Bonus [Builder] for (Picked unit) to (Number of living Command Post [Builder-MA] units owned by (Owner of (Triggering unit)))
                                        Unit - Set level of Damage Bonus [Builder] for (Picked unit) to (Number of living Command Post [Builder-MA] units owned by (Owner of (Triggering unit)))
                                    Else - Actions
                Custom script:   call DestroyGroup (udg_Temp_UG)
 

vypur85

Hibernate
Reaction score
803
Because the ability is being added? WC3 loads the data and causes a short lag.

To avoid this, preload the ability at map init:

Code:
Event
 Map Init
Condition
Actions
 Unit - Create some unit at somewhere for anyone facing anywhere....
 Unit - Add SB_Builder  to (Last created unit)
 Unit - Remove (Last created unit)

Do this for all possible abilities that you think might cause the lag. And the lag duration is proportional to the ability level. The more level it has, the more data it contain, and thus increases lag time.

Edit:
Hmmm... Or you already know these? Not sure, it could be other problems, which I'm not aware of.
 

Dameon

"All the power in the world resides in the eyes"
Reaction score
127
lol yeah I just figured out the lag has something to do with the amount of levels lol, I reduced the abilitys from 100 levels to 25 and now only get 1 to 2 secs of lag. But I am adding your actions to my MI trigger, thanks for your post and help man.
 
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