System Unit Command System

Fluffball

Well-Known Member
Reaction score
35
Unit Command Spell

Ok, this is a system for a spell, that, when cast will order all units in a (500 + (Level of Upgrade x 100)) radius to attack move the point of the spell being cast. This is useful for a map that has many small units, that will be tiring to order around twelve by twelve. For this System, you will need:
-A Unit Commander unit.
-A Unit Command Ability (Base ability = Shockwave, with 99999 range, 0 damage, you know what i mean. No model, but you can change the caster art to whatever you want.
-A Unit Command Upgrade, which doesn't do anything, so set all the object editor fields to 0, except for the cost, upgrade time, etc, with as many levels as you want, but the more you have, the more the spell will select, and the more lag.
-2 TempPoint Point variables
-1 TempGroup Variable (If you tick automatically create new variables while pasting trigger data you won't need these.

Code:
Command Units
    Events
        Unit - A unit Finishes casting an ability
    Conditions
        (Ability being cast) Equal to Command Units 
    Actions
        Set Temp_Point2 = (Target point of ability being cast)
        Set Temp_Point = (Position of (Casting unit))
        Set Temp_Group = (Units within (500.00 + ((Real((Current research level of Command Units  for (Owner of (Casting unit))))) x 100.00)) of (Position of (Casting unit)))
        Unit Group - Remove (Casting unit) from Temp_Group
        Unit Group - Pick every unit in Temp_Group and do (Actions)
            Loop - Actions
                Unit - Order (Picked unit) to Attack-Move To Temp_Point2
        Custom script:   call RemoveLocation (udg_Temp_Point)
        Custom script:   call RemoveLocation (udg_Temp_Point2)
        Custom script:   call DestroyGroup (udg_Temp_Group)

This is 1 very simple trigger, Please PM me with any bugs (Shouldn't be any, as I have tested this a lot). Feedback, Thank-Yous and +rep are greatly appreciated.

View attachment Fluffball's Unit Commander System.zip
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> CommandUnitLevel

That variable isn't needed. Neither the "upgrade" trigger.
Use "player - current tech level of upgrade" instead...

You also leak a unit group and a point on every cast.
 

AdamGriffith

You can change this now in User CP.
Reaction score
69
It could be better I think if you use group moving.
As in, the units stick to a formation when they move. :)
Just filter the commander unit out when you first add units to the group.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> use group moving.

Well, the idea is good, but there's a small problem there.
"Unit group - Order group to ..." has the same restriction as doing it yourself, i.e. 12 units max at once.
 

Fluffball

Well-Known Member
Reaction score
35
Will that unit group leak? It's only picking them, not putting them into a unit group.
 

Don

Rise with the Fallens!
Reaction score
52
Here is your trigger without leaks, just add the variable and custom text :D

Code:
Command Units
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Command Units 
    Actions
        Set Temp_Point = (Position of (Casting unit))
        Unit Group - Pick every unit in (Units within (500.00 + ((Real((Current research level of Improve your Command Units Spell  for (Owner of (Casting unit))))) x 100.00)) of Temp_Point) and do (Actions)
        Set Temp_Group = (picked unit)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Unit-type of (Picked unit)) Not equal to Unit Commander
                    Then - Actions
                        Unit - Order (Picked unit) to Attack-Move To (Target point of ability being cast)
                    Else - Actions
        Custom script:   call RemoveLocation (udg_Temp_Point)
        Custom script:   call DestroyGroup (udg_Temp_Group)

as easy as that!

PS. i'm not sure about the location of the ''set bla bla = to bla bla bla''
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
How exactly do you set a unit group to a picked unit?
Code:
        Unit Group - Pick every unit in (Units within (500.00 + ((Real((Current research level of Improve your Command Units Spell  for (Owner of (Casting unit))))) x 100.00)) of Temp_Point) and do (Actions)

That's your leaking line. You filter out units creating a new reference to these picked units. This reference is lost if not added to a variable then removed, hence called leak.

Edit:

You even added a point leak to the trigger:

Code:
(Target point of ability being cast)

Which will leak once for each unit picked in the unit group.
 

Fluffball

Well-Known Member
Reaction score
35
1.) Unit Group - Add (Picked Unit) to Unit_Commander unit group variable

And as for the point of ability being cast, i fixed that, making it a variable and removing it
 

AdamGriffith

You can change this now in User CP.
Reaction score
69
@Acehart

Oooooh sorry, I thought the triggers would have magical powers and be able to move more :p
 

Anti-krazy

New Member
Reaction score
5
Hmm perhaps making unit variables for Casting unit, Target of Ability being cast and picked unit?
 

Fluffball

Well-Known Member
Reaction score
35
Bump

Sorry Romek, I thought I fixed that.... Maybe I forgot to save the new version and added the old file to the archive, then uploaded.
 

Romek

Super Moderator
Reaction score
963
Code:
Order (Picked unit) to Attack-Move To (Center of (Playable map area))

Center of map? Why?!
Anf that leaks anyway.

This is hardly a system too. It's more of a spell or a snippet.
 

Fluffball

Well-Known Member
Reaction score
35
Kk thanks for the feedback, will change to Spell (EDIT: even in Adavanced edit, i can't find a way to change the prefix) and will fix the center of map area bug.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top