Game - End game in Defeat for player 1 (show dialogs, Show score screen)
When I click save I get:
# Error
1 Expected boolean expression
I'm obviously missing something. But I'm not sure what. I've spent 2 days surfing through Google to find a solution and no one is spefically talking about this type of trigger.
It's a standard defend against waves map. And I want the game to end in Defeat when the hero dies.
(While I'm here I may aswell ask: how do I set the victory condition for when all waves are completed? there are 240 waves)
Picked units must be defined first. You should use any unit(or if you have only one hero that is placed on them, use it az a fix value) in the events or as you did earlier define it in the condition instead of the event but not as 'picked unit', but 'triggering unit'. the action you did shouldwork if you change the event and the conditions from 'picked unit' to 'triggering unit'
So if you have one hero that you already placed in the map. You can reference him directly.
Events Unit -Cargo Truck (Trailer) [127.83, 146.06] dies Local Variables Conditions Actions Game -End game in Defeat for player (Owner of (Triggering unit)) (Show dialogs, Show score screen)
you can use fix player instead of owner of triggering unit if you woud like. but usually the hero owner loses the match, so that'why I created the code this way :). Also with this you can copy the trigger for another unit with another owner player, you just reselect the other hero en the other event, and you can copy the action from the previously created one without modify the player manualy :).
Maybe it was more complex for other uses. For example I would like to suggest to put your hero into a variable, so if you accedently remove it from edit, you can replace it with one selection. If you remove the direct referenced unit, all trigger that uses it, will be disabled(however the editor warn you about this so if you read the question, not just press yes withou reading you will be notified). It it happens, you must change the trigger to the newly placed unit. But if you store it in a variable and delete it, only the variable lost it's value, but the triggers dont. So you have to redefine the variable only and not your entire code.
For the question: That will be a more comlex answer, and in there you must definitly use variable, at least for the wave couning, and unit counting. So the basic idea that you store every existing and later spawned unit to a unitgroup(as variable). And a integer variable for count the waves. So with them count the untis in the unit group and if it is reaches the 0 then increase the wave counter by 1. When the integer reaches the maximum number and all unit in the unit group dies the player wins. There are multiple trigger options for that :).
If you need technical help feel free to contact me on the sc2mapster discord channel (Iam not admin or something just a member,) it is easyier to asnwer specific questions or just send an example file :). I can answer you here too, but it would be wall of text :). If I write the explanations too, not just the clean code :).
Hey thanks is for the information. It made sense but was alot of work, so I simplified it, I just made a timed trigger victory. The the victory timer does work, however I can't seem to get it to display properly.
I started the timer
Created a window for last started timer
Showed the window
Showed the progress bar
Showed the border
It displays, even with the name, but the numbers stay 00:00 I sat and waited the entire 60 minutes to victory, and the victory trigger does work but the timer never changes...
There were only two options to "show timer"
Time remaining and time elapsed.
I don't want to show time elapsed I want to show time remaining, but I did try both option, but they both didn't change the 00:00 display
you will need 2 global variables Timer = (New timer) <Timer> TimerWindow = No Timer Window <Timer Window> and a trigger like below. Queue in the actions are important.
Events Game -Map initialization Local Variables Conditions Actions Timer -Create a timer window for Timer, with the title "Timer", using Remaining time (initially Visible) Variable -Set TimerWindow = (Last created timer window) Timer -Show TimerWindow for (All players) Timer -Set timer for TimerWindow to Timer Timer -Start Timer as a One Shot timer that will expire in 60.0 Game Time seconds
you will need 2 global variables Timer = (New timer) <Timer> TimerWindow = No Timer Window <Timer Window> and a trigger like below. Queue in the actions are important.
Events Game -Map initialization Local Variables Conditions Actions Timer -Create a timer window for Timer, with the title "Timer", using Remaining time (initially Visible) Variable -Set TimerWindow = (Last created timer window) Timer -Show TimerWindow for (All players) Timer -Set timer for TimerWindow to Timer Timer -Start Timer as a One Shot timer that will expire in 60.0 Game Time seconds
Events
Unit -(Picked unit) dies
Conditions
(Picked unit) == Penumbra Singra - (Hero) [22.60, 41.08]
Actions
Game - End game in Defeat for player 1 (show dialogs, Show score screen)
When I click save I get:
# Error
1 Expected boolean expression
I'm obviously missing something. But I'm not sure what. I've spent 2 days surfing through Google to find a solution and no one is spefically talking about this type of trigger.
It's a standard defend against waves map. And I want the game to end in Defeat when the hero dies.
(While I'm here I may aswell ask: how do I set the victory condition for when all waves are completed? there are 240 waves)
Picked units must be defined first.
You should use any unit(or if you have only one hero that is placed on them, use it az a fix value) in the events
or as you did earlier define it in the condition instead of the event but not as 'picked unit', but 'triggering unit'.
the action you did shouldwork if you change the event and the conditions from 'picked unit' to 'triggering unit'
So if you have one hero that you already placed in the map. You can reference him directly.
Events
Unit -Cargo Truck (Trailer) [127.83, 146.06] dies
Local Variables
Conditions
Actions
Game -End game in Defeat for player (Owner of (Triggering unit)) (Show dialogs, Show score screen)
you can use fix player instead of owner of triggering unit if you woud like. but usually the hero owner loses the match, so that'why I created the code this way :). Also with this you can copy the trigger for another unit with another owner player, you just reselect the other hero en the other event, and you can copy the action from the previously created one without modify the player manualy :).
In reply to ragadozo88:
Wow. That was much simpler that what I was shown thanks.
Btw any idea on my other question?
In reply to oosnowwulfoo:
Maybe it was more complex for other uses. For example I would like to suggest to put your hero into a variable, so if you accedently remove it from edit, you can replace it with one selection. If you remove the direct referenced unit, all trigger that uses it, will be disabled(however the editor warn you about this so if you read the question, not just press yes withou reading you will be notified). It it happens, you must change the trigger to the newly placed unit. But if you store it in a variable and delete it, only the variable lost it's value, but the triggers dont. So you have to redefine the variable only and not your entire code.
For the question: That will be a more comlex answer, and in there you must definitly use variable, at least for the wave couning, and unit counting. So the basic idea that you store every existing and later spawned unit to a unitgroup(as variable). And a integer variable for count the waves. So with them count the untis in the unit group and if it is reaches the 0 then increase the wave counter by 1. When the integer reaches the maximum number and all unit in the unit group dies the player wins. There are multiple trigger options for that :).
If you need technical help feel free to contact me on the sc2mapster discord channel (Iam not admin or something just a member,) it is easyier to asnwer specific questions or just send an example file :). I can answer you here too, but it would be wall of text :). If I write the explanations too, not just the clean code :).
In reply to ragadozo88:
Hey thanks is for the information. It made sense but was alot of work, so I simplified it, I just made a timed trigger victory. The the victory timer does work, however I can't seem to get it to display properly.
I started the timer
Created a window for last started timer
Showed the window
Showed the progress bar
Showed the border
It displays, even with the name, but the numbers stay 00:00 I sat and waited the entire 60 minutes to victory, and the victory trigger does work but the timer never changes...
There were only two options to "show timer"
Time remaining and time elapsed.
I don't want to show time elapsed I want to show time remaining, but I did try both option, but they both didn't change the 00:00 display
In reply to oosnowwulfoo:
you will need 2 global variables
Timer = (New timer) <Timer>
TimerWindow = No Timer Window <Timer Window>
and a trigger like below. Queue in the actions are important.
Events
Game -Map initialization
Local Variables
Conditions
Actions
Timer -Create a timer window for Timer, with the title "Timer", using Remaining time (initially Visible)
Variable -Set TimerWindow = (Last created timer window)
Timer -Show TimerWindow for (All players)
Timer -Set timer for TimerWindow to Timer
Timer -Start Timer as a One Shot timer that will expire in 60.0 Game Time seconds
Awesome thanks. I feel retarded. 😂🤣
I'm not able to find it
In reply to oosnowwulfoo:
I was Send it in private messege. I was joined with that invite link.