• 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.

Last Hidden/Unhidden Unit

Status
Not open for further replies.
Level 4
Joined
Dec 6, 2007
Messages
78
  • Level 1 Spawn Rate
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Unhide (Random unit from (Units of type Mole))
      • Wait 10.00 seconds
      • Set Unhidden = No unit
      • Unit - Hide No unit
Basically, what I'm trying to do is set the unit variable Unhidden to the last unhidden unit. I'm making a map called Whack-A-Mole, and what I'm aiming for is a different spawn rate for each level. So basically what I'm doing is keeping 1 mole in every hole all the time, only the ones that aren't being used are hidden with the 'Unit - Hide' action. Every so often, a random Mole is Unhidden and waits to be whacked. But I need to make it so that if you don't attack the mole within, say for example, 5 seconds, then they become hidden again. Only problem is, there's no 'Last Unhidden Unit' option. Also just so you know, to keep from running out of moles, every time a mole is killed, another is spawned in the spot of the dying one and instantly hidden. Is there any way I can get a trigger to do what I need?
 
Level 28
Joined
Jun 4, 2007
Messages
1,480
Use the Unit - Set Custom Value action to set the custom value of each mole to something different from the others. Like 1(mole1), 2(mole2), 3 etc. Then you open your Unhidden variable and check the array box. And in the Set Variable action you set the "[Index]" (that shows up after the variable name) to custom value of (Random unit from (units of type Mole))
Now create the action Unit - Unhide Unhidden[random number between 1 and (whatever number of moles you have)]
 
Level 4
Joined
Dec 6, 2007
Messages
78
  • Set Unhidden[(Custom value of (Random unit from (Units of type Mole)))] = No unit
Sorry but I think you forgot to specify what I put where it says 'No unit'. Also, this only unhides them. I can do that easily. What I'm looking for is a trigger that re-hides the exact one(s) that were just unhidden after a certain amount of time and not some random other one(s).
 
Level 12
Joined
Mar 16, 2006
Messages
992
  • Set Unhidden[(Custom value of (Random unit from (Units of type Mole)))] = No unit
Sorry but I think you forgot to specify what I put where it says 'No unit'. Also, this only unhides them. I can do that easily. What I'm looking for is a trigger that re-hides the exact one(s) that were just unhidden after a certain amount of time and not some random other one(s).

You need a trigger that unhides a random Mole unit.
You need a trigger that hides a random Mole unit.
And a trigger that keeps track of which Mole is hidden/unhidden.

How does the map work? What do you want the trigger to do? How do the moles spawn? Do they spawn in hidden? Etc. Seriously.
 
Level 4
Joined
Dec 6, 2007
Messages
78
I already specified what I'm trying to do; keep the moles hidden with the Unit - Hide action when they are not in use. I already have a trigger that unhides them, I only need to add on to that trigger in a way that it hides the same unit(s) if it is not attacked within an amount of time.

How does the map work?
- Depending on the difficulty of the level, a random mole will spawn in one of the 48 holes (24 for each team). When the mole spawns, you attack it to whack it.
What do I want the trigger to do?
- Keep track of which mole(s) has just been unhidden so it can rehide it within a certain amount of time if it remains alive.
How do the moles spawn?
- When a mole is killed, a trigger creates one in the same spot that it died and instantly hides it. Another trigger randomly unhides one every so often.

I hope that's enough information. If any more is needed, just ask. I've also posted the map so if you like, you can take a look at the triggers and stuff yourself.
 

Attachments

  • Whack-A-Mole 0.50.w3x
    422.6 KB · Views: 42
Status
Not open for further replies.
Top