[System] Capture System Help.

cleeezzz

The Undead Ranger.
Reaction score
268
Code:
Player Colors
    Events
        Time - Elapsed game time is 0.10 seconds
    Conditions
    Actions
        Set Player_Colors[1] = |c00ff0000
        Set Player_Colors[2] = |c000033ff
        Set Player_Colors[3] = |c0000ffff
        Set Player_Colors[4] = |c009900ff
        Set Player_Colors[5] = |c00ffff00
        Set Player_Colors[6] = |c00ff9900
        Set Player_Colors[7] = |c0000ff00
        Set Player_Colors[8] = |c00ff66ff
        Set Player_Colors[9] = |cff959697
        Set Player_Colors[10] = |cff7ebff1
        Set Player_Colors[11] = |cff106246
        Set Player_Colors[12] = |cff4e2a04
Code:
Setup
    Events
        (Run from another Trigger, this does work btw, i tested it)
    Conditions
    Actions
        Set Capture_String = llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
        Unit Group - Pick every unit in (Units in (Playable map area) matching (((Unit-type of (Matching unit)) is A structure) Equal to True)) and do (Actions)
            Loop - Actions
                Set i = (i + 1)
                Unit Group - Add (Picked unit) to Building_Group
                Unit - Set the custom value of (Picked unit) to i
                Set Owner[i] = (Owner of (Picked unit))
                Set Capture_Time[i] = ((Integer((Max life of (Picked unit)))) / 10)
                Floating Text - Create floating text that reads (Player_Colors[(Player number of (Owner of (Picked unit)))] + (Substring(Capture_String, 1, Capture_Time[i]))) above (Picked unit) with Z offset 0.00, using font size 4.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                Set Capture_Bar[i] = (Last created floating text)
                Set Capture_Progress[i] = 0
Picks all structures and creates bar and sets varables
Code:
Setup 2
    Events
        Unit - A unit Finishes construction
    Conditions
    Actions
        Set i = (i + 1)
        Unit Group - Add (Constructed structure) to Building_Group
        Unit - Set the custom value of (Constructed structure) to i
        Set Owner[i] = (Owner of (Constructed structure))
        Set Capture_Time[i] = ((Integer((Max life of (Constructed structure)))) / 10)
        Floating Text - Create floating text that reads (Player_Colors[(Player number of (Owner of (Constructed structure)))] + (Substring(Capture_String, 1, Capture_Time[i]))) above (Constructed structure) with Z offset 0.00, using font size 4.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
        Set Capture_Bar[i] = (Last created floating text)
        Set Capture_Progress[i] = 0
Creates bar and sets variables when a structure is built
Code:
Death
    Events
        Unit - A unit Dies
    Conditions
        ((Triggering unit) is A structure) Equal to True
    Actions
        Floating Text - Destroy Capture_Bar[(Custom value of (Triggering unit))]
        Unit Group - Remove (Triggering unit) from Building_Group
Destroys bar when a structure dies
Code:
Fog Hide
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in Building_Group and do (Actions)
            Loop - Actions
                Set Temp_Point = (Position of (Picked unit))
                Player Group - Pick every player in (All players) and do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                Or - Any (Conditions) are true
                                    Conditions
                                        (Temp_Point is fogged for (Picked player)) Equal to True
                                        (Temp_Point is masked for (Picked player)) Equal to True
                            Then - Actions
                                Floating Text - Hide Capture_Bar[(Custom value of (Picked unit))] for (Player Group (Picked Player))
                            Else - Actions
                Custom script:   call RemoveLocation(udg_Temp_Point)
Hiding bars that are in fog of war
Code:
Capture
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in Building_Group and do (Actions)
            Loop - Actions
                Set Enemy = False
                Set Allied = False
                Set Enemy_Allied = False
                Set Enemy_Enemy = False
                Player Group - Remove all players from Player_Group
                Set Temp_Point = (Position of (Picked unit))
                Set Capture_Group = (Units within 512.00 of Temp_Point matching (((Matching unit) Not equal to (Picked unit)) and ((((Matching unit) is A structure) Equal to False) and (((Matching unit) is alive) Equal to True))))
                Unit Group - Pick every unit in Capture_Group and do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Owner of (Picked unit)) is in Player_Group) Equal to False
                            Then - Actions
                                Player Group - Add (Owner of (Picked unit)) to Player_Group
                            Else - Actions
                Set Rate = (Number of units in Capture_Group)
                Custom script:   call DestroyGroup(udg_Capture_Group)
                Custom script:   call RemoveLocation(udg_Temp_Point)
                Set Temp_Player = (Random player from Player_Group)
                Player Group - Pick every player in Player_Group and do (Actions)
                    Loop - Actions
                        Set Picked_Player = (Picked player)
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Picked player) is an enemy of (Owner of (Picked unit))) Equal to True
                            Then - Actions
                                Set Enemy = True
                                Player Group - Pick every player in Player_Group and do (Actions)
                                    Loop - Actions
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                (Picked_Player is an ally of (Picked player)) Equal to True
                                            Then - Actions
                                                Set Enemy_Allied = True
                                            Else - Actions
                                                Set Enemy_Enemy = True
                            Else - Actions
                                Set Allied = True
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Enemy Equal to True
                        Allied Equal to False
                        Enemy_Allied Equal to True
                        Enemy_Enemy Equal to False
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Capturer[(Custom value of (Picked unit))] is in Player_Group) Equal to False
                            Then - Actions
                                Set Capturer[(Custom value of (Picked unit))] = Temp_Player
                            Else - Actions
                        Set Capture_Progress[(Custom value of (Picked unit))] = (Capture_Progress[(Custom value of (Picked unit))] + Rate)
                        Floating Text - Destroy Capture_Bar[(Custom value of (Picked unit))]
                        Floating Text - Create floating text that reads (((((Player_Colors[(Player number of Capturer[(Custom value of (Picked unit))])] + (Substring(Capture_String, 1, Capture_Progress[(Custom value of (Picked unit))]))) + |r) + Player_Colors[(Player number of Owner[(Custom value of (Picked unit))])]) + (Substrin above (Picked unit) with Z offset 0.00, using font size 4.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                        Set Capture_Bar[(Custom value of (Picked unit))] = (Last created floating text)
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                Capture_Progress[(Custom value of (Picked unit))] Greater than or equal to Capture_Time[(Custom value of (Picked unit))]
                            Then - Actions
                                Unit - Change ownership of (Picked unit) to Capturer[(Custom value of (Picked unit))] and Change color
                                Set Owner[(Custom value of (Picked unit))] = Capturer[(Custom value of (Picked unit))]
                                Set Capture_Progress[(Custom value of (Picked unit))] = 0
                                Floating Text - Destroy Capture_Bar[(Custom value of (Picked unit))]
                                Floating Text - Create floating text that reads (Player_Colors[(Player number of (Owner of (Picked unit)))] + (Substring(Capture_String, 1, Capture_Time[(Custom value of (Picked unit))]))) above (Picked unit) with Z offset 0.00, using font size 4.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                                Set Capture_Bar[(Custom value of (Picked unit))] = (Last created floating text)
                            Else - Actions
                    Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                Enemy Equal to False
                                Allied Equal to True
                                Capture_Progress[(Custom value of (Picked unit))] Greater than 0
                            Then - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        Capture_Progress[(Custom value of (Picked unit))] Less than 0
                                    Then - Actions
                                        Set Capture_Progress[(Custom value of (Picked unit))] = 0
                                        Floating Text - Destroy Capture_Bar[(Custom value of (Picked unit))]
                                        Floating Text - Create floating text that reads (Player_Colors[(Player number of (Owner of (Picked unit)))] + (Substring(Capture_String, 1, Capture_Time[(Custom value of (Picked unit))]))) above (Picked unit) with Z offset 0.00, using font size 4.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                                        Set Capture_Bar[(Custom value of (Picked unit))] = (Last created floating text)
                                    Else - Actions
                                        Set Capture_Progress[(Custom value of (Picked unit))] = (Capture_Progress[(Custom value of (Picked unit))] - Rate)
                                        Floating Text - Destroy Capture_Bar[(Custom value of (Picked unit))]
                                        Floating Text - Create floating text that reads (((((Player_Colors[(Player number of Capturer[(Custom value of (Picked unit))])] + (Substring(Capture_String, 1, Capture_Progress[(Custom value of (Picked unit))]))) + |r) + Player_Colors[(Player number of Owner[(Custom value of (Picked unit))])]) + (Substrin above (Picked unit) with Z offset 0.00, using font size 4.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                                        Set Capture_Bar[(Custom value of (Picked unit))] = (Last created floating text)
                            Else - Actions
Capture trigger, detects units that are close and fills up the bar

for some reason, after a few mins or so, a lot of the bars disappear. its supposed to create bars above every structure, and if a enemy unit gets near, it fills the bar up, when its full, its captured.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top