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

[Solved] Race setup

Status
Not open for further replies.
Level 9
Joined
Jun 10, 2013
Messages
473
Hi all >:D Hope your mothers had a good mother's day weekend. I'm trying to set up a system where if any player is human their townhall and peasants are replaced by my custom ones. Here's what i've got:

  • Free Peoples Race Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Group1 = (Units owned by (Picked player) of type Peasant)
      • Set Group2 = (Units owned by (Picked player) of type Town Hall)
      • 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
              • (Race of (Picked player)) Equal to Human
            • Then - Actions
              • Unit Group - Pick every unit in Group1 and do (Actions)
                • Loop - Actions
                  • Unit - Replace (Picked unit) with a Worker - War Mode using The old unit's relative life and mana
              • Unit Group - Pick every unit in Group2 and do (Actions)
                • Loop - Actions
                  • Unit - Replace (Picked unit) with a Stronghold Level 1 using The old unit's relative life and mana
            • Else - Actions
      • Custom script: call DestroyGroup (udg_Group1)
      • Custom script: call DestroyGroup (udg_Group2)
 

Jampion

Code Reviewer
Level 15
Joined
Mar 25, 2016
Messages
1,327
You can use (Picked player) only inside a player group, so you want to move them inside the player group.
Other than that it should be fine.

Make sure though, that the units that are replaced exist. The action, that creates them (Melee - Create Starting units ....) must run before this trigger.
 
Level 9
Joined
Jun 10, 2013
Messages
473
You can use (Picked player) only inside a player group, so you want to move them inside the player group.
Other than that it should be fine.

Make sure though, that the units that are replaced exist. The action, that creates them (Melee - Create Starting units ....) must run before this trigger.
Alright so i made the player group (don't know if i need to destroy it after?) and changed the event but, I still can't get the units to be replaced

  • Free Peoples Race Setup
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Set Group1 = (Units owned by (Picked player) of type Peasant)
      • Set Group2 = (Units owned by (Picked player) of type Town Hall)
      • Set PlayerGroup = (All players)
      • 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
              • (Race of (Picked player)) Equal to Human
            • Then - Actions
              • Unit Group - Pick every unit in Group1 and do (Actions)
                • Loop - Actions
                  • Unit - Replace (Picked unit) with a Worker - War Mode using The old unit's relative life and mana
              • Unit Group - Pick every unit in Group2 and do (Actions)
                • Loop - Actions
                  • Unit - Replace (Picked unit) with a Stronghold Level 1 using The old unit's relative life and mana
            • Else - Actions
      • Custom script: call DestroyGroup (udg_Group1)
      • Custom script: call DestroyGroup (udg_Group2)
///EDIT///Sorry, i forgot to put the updated code.

///EDIT 2//// Got it to work, thanks for the help! However, if there are leaks please do tell.

  • Free Peoples Human Race Setup
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Set PlayerGroup = (All players)
      • 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
              • (Race of (Picked player)) Equal to Human
            • Then - Actions
              • Set Group1 = (Units owned by (Picked player) of type Peasant)
              • Unit Group - Pick every unit in Group1 and do (Actions)
                • Loop - Actions
                  • Unit - Replace (Picked unit) with a Worker - War Mode using The old unit's relative life and mana
              • Set Group2 = (Units owned by (Picked player) of type Town Hall)
              • Unit Group - Pick every unit in Group2 and do (Actions)
                • Loop - Actions
                  • Unit - Replace (Picked unit) with a Stronghold Level 1 using The old unit's relative life and mana
            • Else - Actions
      • Custom script: call DestroyGroup (udg_Group1)
      • Custom script: call DestroyGroup (udg_Group2)
 
Last edited:
Status
Not open for further replies.
Top