• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Base Circle of power System - Early stage phase

Level 13
Joined
May 10, 2009
Messages
868
Hello,

Finally! After a long wait I managed to finish the basic functionality for your system. Currently, with a peasant you are capable of entering a circle of power (medium) and create a new unit in the arena. That means, you won't need to manually create a new region, add trigger -> config event, conditions, actions, in order to make a new unit type available. Even though, you still need to configure a few things:


Registering units in the system:
There is a trigger under Base Circle of Power category called BCS Register Neutral Units responsible for assigning all available units to the system. In that trigger you'll also have to set a "sacrifice cost", and select your unit type. Don't forget to increase the Unit_Max variable.

  • BCS Register Neutral Units
    • Events
    • Conditions
    • Actions
      • -------- These are the units that can be spawned by a circle of power when a sacrifice is complete --------
      • -------- Register the sacrifice cost for each unit type --------
      • Set BCS_Unit_Type[0] = Rifleman
      • Set BCS_Unit_Cost[0] = 1
      • -------- ++++ --------
      • Set BCS_Unit_Type[1] = Commander
      • Set BCS_Unit_Cost[1] = 2
      • -------- ++++ --------
      • Set BCS_Unit_Type[2] = Rifleman
      • Set BCS_Unit_Cost[2] = 2
      • -------- ++++ --------
      • Set BCS_Unit_Type[3] = AWPgunner
      • Set BCS_Unit_Cost[3] = 3
      • -------- ++++ --------
      • Set BCS_Unit_Type[4] = Chaplain
      • Set BCS_Unit_Cost[4] = 1
      • -------- ++++ --------
      • Set BCS_Unit_Type[5] = The trapper
      • Set BCS_Unit_Cost[5] = 5
      • -------- ++++ --------
      • Set BCS_Unit_Type[6] = Arcane Tower
      • Set BCS_Unit_Cost[6] = 1
      • -------- ++++ --------
      • Set BCS_Unit_Type[7] = Guard Tower
      • Set BCS_Unit_Cost[7] = 1
      • -------- ++++ --------
      • Set BCS_Unit_Max = 7
If your unit is not included in that list, they won't work with the system. I did this in order to avoid conflicts when a circle of power attempts to store a new unit type to it.
For now, those units must be preplaced next to a circle of power, and their player must be Neutral Passive.

There's also a "classification" ability that is added to certain unit types. For example, towers can't/won't spawn next to your main building, I needed a way to distinguish infantry/air units from towers - I'm also taking into consideration those future spell abilities.

So, there are three abilities:
  • BCS - Classification: Anti-Air
  • BCS - Classification: Anti-Infantry
  • BCS - Classification: Spell Caster

The first ones were added to two different towers for now as test purposes: Arcane Tower and Guard Tower; Guard Tower is classified as Anti-Infantry, and Anti-Air for Arcane Tower.

After giving those abilities to your towers, you just need to preplace one next to a circle of power (medium), and a player will be able to spawn it.


Tower Placement:
About their locations; where are they going to be placed?
Well, there are 2 dummy towers in the object editor, and their names are BCS Anti-Aircraft and BCS Anti-Infantry; under Custom Units -> Human -> Melee -> Buildings category. Those towers are what define the amount of towers a team can have, and their respective locations. When placing those towers, don't forget to set their owners as the color of the players that are in a specific base.
  • Team 1: Red or Blue
  • Team 2: Teal or Purple
  • Team 3: Yellow or Orange
  • Team 4: Green or Pink
There's a simple pattern for tower location priority, the game will always try to pick the closest tower to the center of arena. This might change in the future, because I don't really know how the game flows yet - should I spawn towers close to main building when my base is in danger? More or less like that idea.

Also, don't worry about those dummy towers. Players won't see them, because they get removed when the system loads.


Settings (misc)
One last thing, you can change the unit who will be sacrificed in exchange for new units; It's also possible to change the circle of power (medium) as the indicator for the sacrifices. You'll find those settings in this trigger:
  • BCS Register Circle of Power
    • Events
      • Time - Elapsed game time is 0.50 seconds
    • Conditions
    • Actions
      • -------- The unit type which will indicate where units should convert themselves --------
      • Set BCS_Circle = Circle of Power (medium)
      • -------- The unit to be converted --------
      • Set BCS_ConversionUnit = Peasant
      • -------- Below, you'll see the custom classifications. They are abilities in the object editor, and are used for distinguishing certain unit types.For example: Anti-Air towers, Anti-Infantry towers, or even forcing a player to cast a spell --------
      • -------- Units that do not have those custom abilities will be classified as infantry - Either Flying or Ground units. --------
      • Set BCS_Classification[0] = BCS - Classification: Anti-Air
      • Set BCS_Classification[1] = BCS - Classification: Anti-Infantry
      • Set BCS_Classification[2] = BCS - Classification: Spell Caster
      • -------- Preplaced towers with this ability will be removed when map starts --------
      • Set BCS_Placeholder = BCS - Placeholder tower
      • -------- Initialize Tabe - Base Circle of Power --------
      • Hashtable - Create a hashtable
      • Set BCS_Table = (Last created hashtable)
      • -------- Register the sacrifice cost for each unit type --------
      • Trigger - Run BCS Register Neutral Units <gen> (ignoring conditions)
      • Custom script: call BCS_RegisterSacrificeCost()
      • -------- Register the sacrifice cost for each unit type --------
      • -------- Number of teams --------
      • Set BCS_Teams = 4
      • -------- StepTrigger is used within BCS_RegisterCircleOfPower function, which is declared in the BCS Extra Functions trigger --------
      • Set BCS_StepOffTrigger = BCS Stepping off CoP <gen>
      • Set BCS_StepOnTrigger = BCS Stepping on CoP <gen>
      • -------- Avoid leaks. Destroy forces generated by the editor --------
      • Custom script: call DestroyForce(udg_BCS_Forces[0])
      • Custom script: call DestroyForce(udg_BCS_Forces[1])
      • -------- Create Forces, and assign players to it --------
      • -------- First, loop through all teams --------
      • For each (Integer BCS_Loop) from 1 to BCS_Teams, do (Actions)
        • Loop - Actions
          • -------- For each team, we will create a new force, and assign players to it with the help of another loop --------
          • Custom script: set udg_BCS_Forces[udg_BCS_Loop] = CreateForce()
          • -------- Since this map has 8 players, and 4 teams, we'll have 2 players per team. --------
          • -------- Example: --------
          • -------- First Loop = BCS_Loop = 1 (Team A) -> tmpInt = 1 * 2 = 2 -> Second Loop = BCS_PlayerID between (2 - 1) and 2 -> Add Player 1 and 2 to Team 1. --------
          • Set tmp_int = (BCS_Loop x 2)
          • For each (Integer BCS_PlayerID) from (tmp_int - 1) to tmp_int, do (Actions)
            • Loop - Actions
              • Set tmp_player = (Player(BCS_PlayerID))
              • -------- Store in the table this player's team number --------
              • Hashtable - Save BCS_Loop as 0 of BCS_PlayerID in BCS_Table
              • -------- If players are playing... --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (tmp_player slot status) Equal to Is playing
                • Then - Actions
                  • -------- Add players to their respective teams --------
                  • Player Group - Add tmp_player to BCS_Forces[BCS_Loop]
                • Else - Actions
      • -------- The center of the arena; The intersection among bases. This is where the system will look for placing towers --------
      • Set BCS_CenterOfArena = Region 033 <gen>
      • -------- From the center of arena, what's the range the game will use to look for towers --------
      • Set BCS_SearchTowerArea = 4000.00
      • -------- Do note that the following function needs to know the number of created forces (GetHandleId in use for each force), and also the hashtable must have been initialized at this point. --------
      • -------- Otherwise, the system will fail when attempting to store data to the table --------
      • Custom script: call BCS_RegisterTowerPlacement()
      • -------- Enumerate all circles of power --------
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Set tmp_unit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of tmp_unit) Equal to BCS_Circle
            • Then - Actions
              • -------- Create a region on each enumerated circle of power, and add them to Stepping on CoP trigger. It also returns the region's id. --------
              • Custom script: set udg_BCS_HandleId = BCS_RegisterCircleOfPower(udg_tmp_unit)
              • -------- Get the closest unit that belongs to Neutral Passive, and add its unit type to the table in order to spawn more of it when the number of sacrificed units is met --------
              • Custom script: call BCS_StoreClosestNeutralUnitType(udg_tmp_unit, udg_BCS_HandleId)
            • Else - Actions
As you can see, there are a bunch of things you don't even need to touch. So, I'll probably organize those triggers better in the future.

I'm open for suggestions, so we can make it better and easy for future mapping.

Attachments

  • hilltop-wars.w3x
    773.7 KB · Views: 12
Last edited:
Top