• 🏆 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] Select a hero

Status
Not open for further replies.
Level 13
Joined
Oct 12, 2016
Messages
769
I recommend setting a unit variable for the hero:
1) Make a trigger with the "Generic Unit" event: a unit is sold.
2) Then, make a boolean condition to check if it's a hero.
3) For the actions, set an arrayed unit variable (based on player number) to the sold unit, then hide the sold unit until 50 seconds have passed.
4) After 50 seconds, move the sold unit (stored as a variable to the player number) to its start location and unhide it for the player.
 
Last edited:
Level 13
Joined
Oct 12, 2016
Messages
769
  • join.gif
    unit.gif
    Unit - Hide (Sold unit)
  • empty.gif
    join.gif
    zzz.gif
    Wait 55.00 seconds
  • empty.gif
    join.gif
    sound.gif
    Sound - Play VarimathrasReady1 <gen>
  • empty.gif
    join.gif
    unit.gif
    Unit - Move (Sold unit) instantly to (Center of 009 Spawn Vampires <gen>)
Here "sold unit" can be any sold unit, and you can't use "triggering unit," so use the variable again.
If you want all players to wait 55 seconds regardless of time, then that would work.

Otherwise I recommend using a separate "elapsed time" event for that 55 seconds, then loop and call each unit variable for the last actions.
You can even set a default or random hero using this method when the elapsed time is up. Just check in the loop if Unit_Vampires[Player#] is equal to "no unit."

Also, are the players only Player 11 and Player 12? You may want to try "player number of (owner of buying unit)" with that dummy unit of yours.
You may also need a dummy unit for all players that you want to buy a hero.

When in doubt, use debug messages to check if something is working:
  • Game - Display to (All players) the text: debug message thingy
You can use a message like that to even display integers, such as player numbers.
 
Last edited:
Level 20
Joined
Oct 21, 2006
Messages
3,231
DO NOT USE THE "WAIT" ACTION. If you have more units and players it just usually does not work unless you can use the (Triggering Unit) but that is not always possible.

When game starts create a timer.
  • Game Start
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Countdown Timer - Start VampireSpawnTimer as a One-shot timer that will expire in 10.00 seconds
      • Countdown Timer - Create a timer window for VampireSpawnTimer with title Vampires Spawn in
When player buys a Hero hide it and put it into an unit variable.
  • Vampire Pick
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • ((Sold unit) is A Hero) Equal to True
    • Actions
      • Unit - Hide (Sold unit)
      • Hero - Set (Sold unit) Hero-level to 3, Hide level-up graphics
      • Set Hero[(Player number of (Owner of (Buying unit)))] = (Sold unit)
When the timer expires unhide and move those stored units. Replace P1 and P2 with P11 and P12 in your map.
  • Vampire Spawn
    • Events
      • Time - VampireSpawnTimer expires
    • Conditions
    • Actions
      • Countdown Timer - Destroy (Last created timer window)
      • Camera - Pan camera for Player 1 (Red) to (Center of (Playable map area)) over 0.00 seconds
      • Camera - Pan camera for Player 2 (Blue) to (Center of (Playable map area)) over 0.00 seconds
      • Unit - Move Hero[1] instantly to (Center of (Playable map area))
      • Unit - Move Hero[2] instantly to (Center of (Playable map area))
      • Unit - Unhide Hero[1]
      • Unit - Unhide Hero[2]
      • Selection - Select Hero[1] for Player 1 (Red)
      • Selection - Select Hero[2] for Player 2 (Blue)
I dont know if you can understand. You english no very good. I uploaded a testmap below so you can see how it works. Actually why am I even posting in THW after almost 6 years of inactivity AAAAAAARGH
 

Attachments

  • vamptest.w3x
    15.2 KB · Views: 25
Status
Not open for further replies.
Top