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

[Trigger] Create unit w/ triggers

Status
Not open for further replies.
Level 6
Joined
Jun 8, 2008
Messages
256
I'm working on my boss map, and I've managed to make my first boss which already makes it impossible for tank & spank tactics! :grin:

However, now that I made that, and tested that it works, I want to make a trigger so that you can't go hitting the boss, then going back to town, and attack boss again until he dies. (I've decided to have no health regeneration on bosses)

What this means, is that I need to make it so that, when a unit enters a specific region, the boss is spawned, with included triggers, (also locking the door behind the unit, but I can do that :p) and when either the units die, the gate is opened and the boss despawns. Or the boss dies, the gates open and the boss is despawned.

I'm guessing thats a pretty big trigger, and since I have you guys I'll post it here, and try to get help. Don't worry though, even if I'm still learning, I also have learnt some already. There's just so many options so I'd end up using months on this single trigger :sad:
 
Level 5
Joined
Nov 14, 2007
Messages
161
could u just make a wall of invisible units around the battle? then they couldn't leave.

just trigger once boss is hit, it wakes up and turns on all your other triggers. It creates a blockade of guys with 0 move speed, and a decent collision size. maybe make a region that blocks off the exit and create the max guys you can fit into that region. when the battle is over remove all those units from game.
Another option would be put a triggered door that wont open when all players go in.
 
Level 6
Joined
Jun 8, 2008
Messages
256
Well, the thing is I want the bosses to be replayable, which means that the respawn-trigger would be needed, and to make it the way I explained just seems.. clean IMO :p
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
  • Your trigger
    • Events
      • Unit - A unit enters <BOSS REGION>
    • Conditions
    • Actions
      • Destructible - Close <GATE>
      • Unit - Create 1 <BOSS> for Neutral Hostile at (Center of <BOSS SPAWN REGION>) facing X.XX degrees
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Last created unit) is dead) Equal to True
        • Then - Actions
          • Destructible - Open <GATE>
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is dead) Equal to True
        • Then - Actions
          • Destructible - Open <GATE>
          • Unit - Remove (Last created unit) from the game
        • Else - Actions
          • Do nothing
I think this should work as long as you don't create units with a trigger while this trigger is active, or else the Last created unit will be the wrong target.

Texts like <THIS> are parts you have to fill in yourself with the right stuff.

The part
  • Unit - Create 1 <BOSS> for Neutral Hostile at (Center of <BOSS SPAWN REGION>) facing X.XX degrees
can be changed to what you desire. You can change "Neutral Hostile" to a specific player or make the unit face a specific point instead of a angle.

<BOSS REGION> = Area to enter to make the gate close and boss spawn
<BOSS SPAWN REGION> = One dot of a region on the place where you want the boss to spawn. Just a dot is the easiest, since it has the smallest area, and thus easier to edit the center of that region by moving the entire region.


Hope you can use this stuff! :wink:
 
Level 6
Joined
Jun 8, 2008
Messages
256
There will be more then just 1 unit entering the boss area though, doesn't that trigger make it so that if that unit dies, the boss disappears, while the other players might still be alive?

Maybe I should use levers? Would that make it easier?
 
Level 5
Joined
Nov 14, 2007
Messages
161
i'd say go with avators trigger but set the boss to a variable and also turn on a trigger that has a periodic check to check if all heros are dead to restart the boss fight.
then have another trigger if a unit dies, unit (your boss) is equal to that variable then they win gate opens tada
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
If you want units to join the area, but not leave it, I suggest you use a portal of some kind to let unit in the area, but you don't make a portal in that area to let them out. Instead, you need a trigger that will transport all units in the area to a region outside the area when the boss is dead or all units exept the boss are dead.
 
Level 6
Joined
Jun 8, 2008
Messages
256
Yea, I guess that would work. I'd have to make the portal unable to be reached though, or it could be exploited, but that's really no problem, I'll just include it in the trigger.

However, the boss won't have any triggers, or what? Because if he doesn't, it's all useless.
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
  • Your trigger
    • Events
      • Unit - A unit enters No region
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Random unit from (Units in <BOSS AREA> owned by Neutral Hostile))) Not equal to <BOSS>
        • Then - Actions
          • Unit - Create 1 <BOSS> for Neutral Hostile at (Center of No region) facing X.XX degrees
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Last created unit) is dead) Equal to True
        • Then - Actions
          • Unit Group - Pick every unit in (Units in <BOSS AREA> owned by (Random player from (All allies of (Owner of (Killing unit))))) and do (Unit - Move (Picked unit) instantly to (Random point in <AREA OUTSIDE BOSS AREA>))
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Random unit from (Units in <BOSS AREA> owned by (Random player from (All allies of Player 1 (Red)))))) Not equal to (Unit-type of (Random unit from (Units in <BOSS AREA> owned by (Random player from (All allies of Player 1 (Red))))))
        • Then - Actions
          • Unit - Remove (Last created unit) from the game
        • Else - Actions
          • Do nothing
Man, I've been working on this thing for over an hour, becouse it's nearly exploding my brains! It took so long becouse I had a lot of thinking at
  • (Unit-type of (Random unit from (Units in <BOSS AREA> owned by (Random player from (All allies of Player 1 (Red)))))) Not equal to (Unit-type of (Random unit from (Units in <BOSS AREA> owned by (Random player from (All allies of Player 1 (Red))))))
A real brain buster...

In addition to the information of my previous trigger:
<AREA OUTSIDE BOSS AREA> = The area where you want to send all units to when the boss is dead. Make sure this area is big enough for all units to be moved to.


There is a good chance that
  • (Unit-type of (Random unit from (Units in <BOSS AREA> owned by (Random player from (All allies of Player 1 (Red)))))) Not equal to (Unit-type of (Random unit from (Units in <BOSS AREA> owned by (Random player from (All allies of Player 1 (Red))))))
does not work correctly. If there is somebody who knows a better way to write this Condition, please do so.
The Condition is made to check if there are any units of thesame team in the region. (I know it's hard to read that in the Condition I made)
 
Level 6
Joined
Jun 8, 2008
Messages
256
Alright, through some magic movements I've done, I've fixed so that I won't need to teleport all units outside, they'll be able to walk quietly out the door when they feel like it, and have killed the boss. However, I need to have triggers for the boss unit enabled! :cry:


Also, sorry that your 1 hour of work wasn't that useful :p But you did teach me a lot by those triggers.
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
I guess your increase of trigger knowledge should be enough for me then :p

If you have made the boss with a "Create Unit" Action, you can make triggers for your boss that are referring to "Last created unit" (which will be your boss then). But then again, you have to watch out that no other units are being created due to a trigger which this trigger is active. If there is another unit created this way, the rest of your boss trigger will have all its "Last created unit" Actions referred to the wrong unit.


Good luck!
 
Level 5
Joined
Nov 14, 2007
Messages
161
well ive got a general 3 triggers that could work or at least set up the whole thing:


I've assumed the enemy player is 12, if not choose the correct player
  • Boss spawns
    • Events
      • Unit - A unit enters BOSS AREA <gen>
    • Conditions
      • ((Triggering unit) belongs to an enemy of Player 12 (Brown)) Equal to True
    • Actions
      • Unit - Create 1 BigAssBossDude for Player 12 (Brown) at (Center of BOSS AREA <gen>) facing Default building facing degrees
      • Set UnitVar = (Last created unit)
      • -------- close gates --------
      • -------- turn on boss triggers --------
      • Trigger - Turn on check for players alive <gen>
      • -------- whatever else you need to do when the heros enter --------
here you create the boss and set it to a variable so you can check later if it dies. Also, set up everything for the start of the boss fight. maybe add a condition that all players must be in the region before it triggers.


  • check for players alive
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
      • (All units of (Units in BOSS AREA <gen> matching (((Matching unit) belongs to an enemy of Player 12 (Brown)) Equal to True)) are dead) Equal to True
    • Actions
      • -------- everything you need to do to reset the boss event --------
      • -------- such as set hp to 100% for the boss and any other triggers --------
this is initially off but when the boss starts it will check to see if the hero's are all dead and if so you re-set the boss fight. spawn the heros set boss hp etc.


  • Boss Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • Dying unit is Equal to UnitVar
    • Actions
      • -------- do stuff after boss dies --------
      • Trigger - Turn off check for players alive <gen>
      • Set UnitVar = No unit
Boss dies so turn off the checker and open the gates etc.



hopefully that helps.
YO_MA_MA
 
Last edited:
Level 6
Joined
Jun 8, 2008
Messages
256
Great! :D Thanks a lot, I'll probably use it, unless I encounter some problem, but I doubt I will, now that I even know how to make unit variable! (I have big learning curves! :p)
 
Level 5
Joined
Nov 14, 2007
Messages
161
now that I even know how to make unit variable! (I have big learning curves! :p)
its that bright yellow X that i use to think was a delete button lol or press Ctrl + B. call it what u want and make sure it's a unit variable because your boss is a unit.
 
Status
Not open for further replies.
Top