Just started working with the editor last week, so forgive me if this question is something easy that I’m just not grasping. I've been doing pretty good at finding answers on my own, but this has had me stumped for 24 hours. On my map, at various points during the game, I want to spawn (so they aren’t in the map right away) “boss” battles for the players to fight off.
What I have in my trigger is this:
Unit - Create 1 Ultraling for player 4 at (Random point in regionList[(Random integer between 0 and 5)]) using default facing (No Options)
Unit - Order all units in (Last created units) to ( Attack targeting (Center of Crash Site)) (Replace Existing Orders)
UI - Display boss bar 1 with title "Ultraling", portrait Assets\Textures\btn-unit-zerg-zergling.dds and maximum value 1200 for (Active Players)
UI - Set boss bar 1 boss to (Last created unit) (Do refresh the boss bar)
Now, since this isn’t the end of the map, I’d like to turn off the boss bar when the boss dies and players continue to play. I haven’t attached any different music yet, but if I added music, I’d like to be able to turn off that as well.
I’ve tried setting up a different trigger with an event of “Unit - (Last created unit) dies” to trigger the action “UI - Hide boss bar 1”, but that didn’t work. Seemed to just trigger right away as soon as the boss spawned. I know nothing else died during this period. I’ve tried doing some if/then statements…but those didn’t seem to work right either.
I’ve tried downloading a bunch of maps to see if I could find some code I could reuse that would work for me, but I’m stuck. Anyone have any ideas?
I think you have to save your boss unit somewhere in a variable for your code to properly work.
Try adding a global unit variable "Current Boss", set it as the last created unit after the boss is created command and use the boss variable as a reference in your death trigger.
Just started working with the editor last week, so forgive me if this question is something easy that I’m just not grasping. I've been doing pretty good at finding answers on my own, but this has had me stumped for 24 hours. On my map, at various points during the game, I want to spawn (so they aren’t in the map right away) “boss” battles for the players to fight off. What I have in my trigger is this:
Unit - Create 1 Ultraling for player 4 at (Random point in regionList[(Random integer between 0 and 5)]) using default facing (No Options)
Unit - Order all units in (Last created units) to ( Attack targeting (Center of Crash Site)) (Replace Existing Orders)
UI - Display boss bar 1 with title "Ultraling", portrait Assets\Textures\btn-unit-zerg-zergling.dds and maximum value 1200 for (Active Players)
UI - Set boss bar 1 boss to (Last created unit) (Do refresh the boss bar)
Now, since this isn’t the end of the map, I’d like to turn off the boss bar when the boss dies and players continue to play. I haven’t attached any different music yet, but if I added music, I’d like to be able to turn off that as well.
I’ve tried setting up a different trigger with an event of “Unit - (Last created unit) dies” to trigger the action “UI - Hide boss bar 1”, but that didn’t work. Seemed to just trigger right away as soon as the boss spawned. I know nothing else died during this period. I’ve tried doing some if/then statements…but those didn’t seem to work right either.
I’ve tried downloading a bunch of maps to see if I could find some code I could reuse that would work for me, but I’m stuck. Anyone have any ideas?
@NathiasSkyling: Go
I think you have to save your boss unit somewhere in a variable for your code to properly work. Try adding a global unit variable "Current Boss", set it as the last created unit after the boss is created command and use the boss variable as a reference in your death trigger.
It's working on a test map I just did.
@Moooyaah: Go
That worked perfectly and so simple. Thanks so much!!