• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] Need Help with 2 Problems With Random Hero Select, and the Hero Select Code.

Status
Not open for further replies.
Level 2
Joined
Apr 26, 2009
Messages
11
First the Tavern hero selection fault:
I have made this code, but it doesn't kill the hero selector unit!
Things to know:
-Family Farm = Hero Selection Tavern
-Units are used too select/choose/buy a hero from the tavern

  • Hero Spawn
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • ((Sold unit) is A Hero) Equal to True
          • And - All (Conditions) are true
            • Conditions
              • ((Sold unit) is A Hero) Equal to True
              • (Selling unit) Equal to Family Farm 0001 <gen>
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HeroChosenByPlayer[(Player number of (Owner of (Sold unit)))] Equal to True
        • Then - Actions
          • Unit - Remove (Sold unit) from the game
          • Game - Display to (All players) the text: You have already ch...
        • Else - Actions
          • Set HeroChosenByPlayer[(Player number of (Owner of (Sold unit)))] = True
          • Unit - Move (Sold unit) instantly to (Center of Family Farm Spawn <gen>)
          • Camera - Pan camera for (Owner of (Sold unit)) to (Center of Family Farm Spawn <gen>) over 1.00 seconds
          • Selection - Clear selection for (Owner of (Sold unit))
          • Selection - Add (Sold unit) to selection for (Owner of (Sold unit))

Random Select Problem - It only selects 1 unit, always.
So that isn't random at all.

Things to know:
-I use 3 Heroes in the Tavern

  • Randomise
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • (Unit-type of (Sold unit)) Equal to Randomiser
    • Actions
      • Unit - Remove (Sold unit) from the game
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HeroChosenByPlayer[(Player number of (Owner of (Sold unit)))] Equal to False
        • Then - Actions
          • Unit - Create 1 TavernHeroes[(Random integer number between 1 and 3)] for (Owner of (Sold unit)) at (Center of Family Farm Spawn <gen>) facing Default building facing degrees
          • Set HeroChosenByPlayer[(Player number of (Owner of (Sold unit)))] = True
        • Else - Actions
          • Do nothing
 
Last edited:
Level 5
Joined
May 12, 2008
Messages
77
The first problem is easy: just copy the action "unit - remove (sold unit) from the game", paste it under else actions and swap sold unit with buying unit. this should be all

The second problem: Did you ever start the game via wc3 or did you only use the editor (str f9)? If you only used the shorter way via shortcut then (sorry i do not know the right terms as i do not use the english wc3 editor ;) ) look under presettings. there is an option where you can decide wether the test only uses the same random numbers or if it generates real randoms
 
Status
Not open for further replies.
Top