• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Need help creating trigger

Status
Not open for further replies.
Level 3
Joined
Jul 19, 2008
Messages
36
I need to create a trigger that will allow the players to start with a custom race or the normal ones can somone give me some insight as this is my first try with triggers
 
I don't think there is a way of making a custom race to be chosen like the four. But you can make all your custom race units and buildings and make them act like they are an new race in-game (setting wich building produces wich unit, the buildings that the workers build, etc)

Try experimenting with something like

  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Loop, for every integer A from 1 to X do multiple actions:
      • if-then-else
        • If - Conditions
          • String - Race[(loop integer A)] equal to Barbarians
        • Then - Actions
          • Unit - Create 1 Barbarian Town Hall at player (loop integer A) start location
          • Unit - Create 5 Barbarian Workers at player (loop integer A) start location
        • Else - Actions
Where X is the number of players in your map. You should use some kind of in-game race selection system (that sets Race string variable to it's chosen race). How you will do it is up to you .I recommend sometype of dialog. Also, there are ways of making the 5 workers to be created between the hall and the mine and centering the camera on them, so it looks like melee game, but for now, let's see if you can get the race selection system and the starting units creation.

You must see tutorials on variables. They're simple. If you really can find it for yourself ask for the race selection system and i may write it for you.
 
Last edited:
I would suggest (because I cant make this) that you get a <multiboard?> with five (5) different buttons like so:
Humans
Orcs
Night Elves
Undead
Mycustomrace

Then depending on which race is selected, use something like -SoulBurn 's above trigger to force the game to create the specified races starting town hall and workers.
 
It's not anything hard. -SoulBurn gave you the idea already. Melee maps use the trigger "Create Starting units for All players". Since the creation of the units cannot be controlled in every aspect (hardcoded action), your only bet is to replace those created units with the custom units of yours.
  • Trigger
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (Units in (Playable Map Area) matching (Race of (Matching unit) Equal to Orc) and do (Actions)
      • Loop - Actions
        • If (All conditions are true) then do (Actions) else do (Actions)
          • If - Conditions
            • ((Picked unit) is a Peon-type unit) Equal to True
          • Then - Actions
            • Unit - Replace (Picked unit) with a Beast using the New unit's relative health and mana
          • Else - Actions
            • If (All conditions are true) then do (Actions) else do (Actions)
              • If - Conditions
                • ((Picked unit) is a townhall-type unit) Equal to True
              • Then - Actions
                • Unit - Replace (Picked unit) with a Beast Den using the New unit's relative health and mana
Like I mentioned above, this trigger will replace every worker unit with a "Beast (my custom unit)" and every town hall with a "Beast Den".
A "worker" unit is defined by the object editor, in the field Unit - Unit classification (go to the unit of yours and scroll to this field).
The trigger above contains a "Custom script" action; it's because you will need to remove the leak, created by the Unit Group, you are about to pick (Units classified as workers). Unit Groups, Points, Sounds, Special Effects, Lightnings, Rects, Timers, Player Groups and Strings leak. Strings leak only once (luckily), but there's not much you can do about them.

For more info:
https://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/
 
Status
Not open for further replies.
Back
Top