• 🏆 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] Removing Random hero

Status
Not open for further replies.
Level 9
Joined
Jun 7, 2008
Messages
440
Just as it says, How do i remove a randomized hero from the list of random units available in a tavern? I have 3 Taverns, and all of them are available for a random unit. However, when i random the first unit, i need to remove the randomed unit from the list of available units. Is this possible? I know it will set my count down by one. Any Ideas?
 
Level 13
Joined
Sep 14, 2008
Messages
1,407
You will have to trigger the random function.

Create a unit group which inlcudes all your heros and a trigger like this:

Event: Unit uses ability
Condition: Ability = Random
Actions:
Pick random unit from "yourUnitGroup" and do actions:
Create unit of unit type of "picked unit" for owner of triggering unit
remove "picked unit" from "yourUnitGroup"


This requires one hero selector for every player :/

I am not sure if that is good

But i don't know a better solution
 
Level 9
Joined
Jun 7, 2008
Messages
440
When using a random hero select. The tavern requires you to set the unit type in order for a ranomd selection. When getting a random hero, you need to get a random number between the lowest value of your heros, to the max number of heros you want to be randomized. How would i even consider getting those heros into a unit group?
 
Level 9
Joined
Jun 7, 2008
Messages
440
For Sure: ( I have already set ll units that i want to be randomized into an array, so thats done)
  • Events
    • Player X (color) types -random as an exact match
  • Conditions
    • (Unitselect) equal to true
    • Triggering player is an ally of Player 1 Red
  • Actions
    • Set HeroNumber = random integer number between 1 and 95
    • Create 1 RandomUnit [HeroNumber] for triggering player at Loc[1]
    • Set Unit = last created unit
    • // Then i have a bunch of stuff that contiues on for a lil bit.
    • // I did remove the leak.
I mean i could do, if/then/else to see if any ofthe heronumber matches are the same. But I am stuck on how to set a random player with a random number into an array, then checking to see if all other random players, with random numbers - match.:sad:
 
Level 4
Joined
Mar 23, 2008
Messages
87
Couldn't you just:
  • Neutral Building - Remove (Unit-type of (RandomUnit [HeroNumber])) from all marketplaces
???


Edit:
Oh, i understand the problem now nvm the above
Edit2:
Couldn't you just:
  • InitGroup
    • Events
      • Time - Elapsed game time is 0.10 seconds
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 95, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Footman for Neutral Passive at (Center of (Playable map area)) facing Default building facing degrees
          • Unit Group - Add (Last created unit) to group
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Unit - Hide (Picked unit))
  • YourTrigger
    • Events
      • Player X (color) types -random as an exact match
    • Conditions
      • (Unitselect) equal to true
      • Triggering player is an ally of Player 1 Red
    • Actions
      • Set tmpu = (Random unit from group)
      • Unit - Create 1 (Unit-type of tmpu) for (Triggering player) at Loc[1] facing Default building facing degrees
      • Unit Group - Remove tmpu from group
      • Unit - Remove tmpu from the game
???
 
Last edited:
Level 9
Joined
Jun 7, 2008
Messages
440
Each unit is set differently, And wouldnt hiding the 95 units lag the game? I found out how to do it. Using a formula, it works fine and dandy. Setting the picked unit (X), if it doesnt match y/z/c/v/b then create, if it does then re random the pick :p Works like a charm, Thans for the help though +rep
 
Status
Not open for further replies.
Top