• 🏆 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!

4V4 Commanders - Commander selection trigger?

Status
Not open for further replies.
Level 2
Joined
Dec 23, 2019
Messages
4
So, I’ve been working on a custom map / game mode for a while. It’s basically supposed to feel like a regular 4v4 Warcraft 3 mode which uses the standard maps (Goldrush to begin with) except instead of picking between Alliance / Horde / Scourge / Sentinel, you pick a commander rather like the commanders in Starcraft 2. These commanders have bonus units, upgrades and abilities that fit into their flavor but they also come with draw backs such as missing units, which is why it’s going to be a 4v4 mode, so that allies can fill in the gaps in army compositions.

This also means that players will be able to enjoy all the cool campaign factions such as blood elves, draenei, satyr, demons, fel orcs, goblins, ogres ect-ect.

So, I’ve made great progress in the areas that I’m comfortable with. That’s creating and balancing the commanders. These are:

Uther, Muradin, Kael’thas, Jaina, Chen, Jennalla, Grom, Thrall, Cairne, Vol’jin, Gazlowe, Arthas, Kel’thuzard, Mal’ganis, Anub’arak, Magtheridon, Sylvanas, Malfurion, Tyrande, Maiev, Illidan, Akama and Vashj.

Anyway, my current trigger/script issue is how do I allow players to pick their commander easily / cleanly? Sounds simple? I thought so too, but I’m having trouble with it. If anyone can provide a solution I’d be very thankful.

Currently I have removed starting units/buildings for all players and replaced them with an indestructible farm which has training buttons for the commanders. After 60 seconds I enforce defeat/victory conditions and remove the farm, which should give absent players or players who took too long to pick, the defeat popup.

So, for the commander picker buttons, I have the following trigger.

Events:
Player - Button for Research Uther the Lightbringer pressed.

Conditions:
(Triggering player) Equal to Player 1 (Red)

Actions:
Unit - Remove Commander Selection from the game.
Wait 1.00 Seconds
Unit - Create 1 Townhall (Uther) for Player 1 (Red) at Center of Red Start) (ect)
Unit - Create 5 Peasant (Uther) for Player 1 (Red) at Center of Red Start) (ect)

Obviously, this doesn’t work, probably because the game doesn’t recognise the triggering player as the person who pressed the button.

My first question is, is this even the best approach for doing this sort of thing? I have many commanders and only a limited number of button slots in the building, so if I do this approach, I’m going to have to have several of these commander selection farm buildings for each player. Is there a way to have more “pages” of buttons which you can cycle through?

My second question is, how do I make this work as intended?

My third question is, is there a better solution?

I have since considered having a zone where players walk onto pads to select the commanders, however that involves editing and expanding the actual map. I could do this, but ideally I wanted to be able to leave the vanilla maps (such as Goldrush) as they are, without adding an extra area on the side for commander selection. It's not the end of the world if I have to do that, but I wonder if there's a "cleaner" way?
 
Level 9
Joined
Jul 30, 2018
Messages
445
After 60 seconds I enforce defeat/victory conditions and remove the farm, which should give absent players or players who took too long to pick, the defeat popup.

Though not really about your problem, but is this the best option? Maybe just force them a random commander if they have not picked anything?
Player - Button for Research Uther the Lightbringer pressed.

What event is this? Use Channel as the base ability to make a dummy ability for each commander and then you can use the event "Unit - A unit Starts the effect of an ability" and that gives you access to Triggering Player (owner of the Farm).

My first question is, is this even the best approach for doing this sort of thing?

It depends. If you want to write a lot of information about the commanders, it's easy to write this on an ability's tooltip. If so much information is not required, doing a dialog window might be a bit more sleek and "professional"-looking.

Is there a way to have more “pages” of buttons which you can cycle through?

It is a bit tricky, but doable. One could just use the "Unit - Replace unit" actions, but it is not ideal, because I think it leaks. Other one is to make multiple buildings on top of each other and make the other buildings invisible (remove shadows and ground textures and make them small enough so they hide inside the first Farm, also you have to remove all pathing requirements so they can be placed at the same spot). Then use triggers to select Farm Page 2 for Triggering Player upon clicking a "Next Page" button (casting the dummy commander ability).

My third question is, is there a better solution?

Well, I think you're on the right track. But I wouldn't make own triggers for all players and all commanders. Instead, in your Map Initialization trigger, set all the starting locations and regions to a variable arrays linked to each player. I.e. Player[1] is player one, StartLocation[1] is player 1's start location and WorkerZone[1] is player 1's location for workers: the point is that the array number is always unique for each player.

Also, you could add the commander dummy abilities to arrays as well, so you don't have to make own trigger for each commander. I.e. Commander[1] = Uther Ability, StartBuilding[1] = Uther's Town Hall and Workers[1] = Uther's Peasant. Commander[2] = Muradin Ability, StartBuilding[2] = Muradin's Town Hall, Workers[2] = Muradin's Peasant, etc.

Then you can just loop through all the players and all the commanders in one trigger when someone chooses their commander. For example:
  • Choose Commander
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • For each (Integer LoopIntegerPlayer) from 1 to AmountOfPlayers, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Triggering unit)) Equal to Player[LoopIntegerPlayer]
            • Then - Actions
              • For each (Integer LoopIntegerCommander) from 1 to AmountOfCommanders, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Ability being cast) Equal to Commander[LoopIntegerCommander]
                    • Then - Actions
                      • Unit - Remove (Triggering unit) from the game
                      • Unit - Create 1 StartingBuilding[LoopIntegerCommander] for Player[LoopIntegerPlayer] at StartingLocation[LoopIntegerPlayer] facing Default building facing degrees
                      • Unit - Create 5 Workers[LoopIntegerCommander] for Player[LoopIntegerPlayer] at WorkerZone[LoopIntegerPlayer] facing Default building facing degrees
                    • Else - Actions
            • Else - Actions
Edit: I added an example map of the multi-page buildings.
 

Attachments

  • Multi-PageBuildings.w3x
    18.4 KB · Views: 15
Last edited:
Status
Not open for further replies.
Top