Hi, I'm relatively new to the mapmaking side of StarCraft. I'm making a 'King of the Hill' map. It's a game where players have to capture an area of the map and hold it for a certain amount of time. I am having a little trouble with the victory conditions, though. I want to make it so that whenever a unit enters a region, it starts a timer, and when that ends, it ends game in victory for the owner of the unit. I also want to make it so that when a unit leaves the region, it aborts the timer and cancels the Victory. The problem is that whenever the unit leaves the region, it doesn't destroy or stop the timer, and it still ends in victory when it expires!
Trigger 1:
Events
-Unit - Any Unit Enters (Hill)
Local Variables
Conditions
-((Unit type of (Triggering unit)) is Hero) == true
-((Triggering unit) is in (Hill)) == true
Actions
-UI - Display "Somebody is King" for (All players) to Subtitle area
-Timer - Start Timer 1 as a One Shot timer that will expire in 20 game time seconds
-Timer - Create timer window for Timer 1 with title 'remaining time'
-Timer - Show Timer 1 Window for (All Players)
-General - Wait for Timer 1 to have 0.0 seconds remaining
-Timer - Destroy timer window for Timer 1
-Game - End game in Victory for player (Owner of (Triggering Unit)) (Show dialogs, show score screen)
Trigger 2:
-Events
-Unit - Any Unit leaves Hill
Local Variables
Conditions
-((Unit type of (triggering unit)) is Hero) == true
-((Triggering unit) is in 'Hill') == false
Actions
-Timer - Destroy Timer 1 Window
-Timer - Hide Timer 1 Window for (All Players)
-UI - Display "The king has abdicated" for (All Players) to Subtitle area
you need 1 more trigger with the event Timer Expires
Make sure that you saved the timer as a global variable. Also, use a boolean variable and set it to true when the unit enters, and false when it leaves, make sure it has an array.
Finally, you are going to need to check whether or not the boolean variable is true when the timer expires.
Side Note: that trigger will fire whenever a unit enters the region, you are going to need to set it up so that more than 1 unit/player cannot be "King of the Hill"
Thanks, it seems to be working now. Although, whenever a unit re-enters a region, it creates a new timer window underneath the one that was told to be destroyed when the unit leaves a region.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hi, I'm relatively new to the mapmaking side of StarCraft. I'm making a 'King of the Hill' map. It's a game where players have to capture an area of the map and hold it for a certain amount of time. I am having a little trouble with the victory conditions, though. I want to make it so that whenever a unit enters a region, it starts a timer, and when that ends, it ends game in victory for the owner of the unit. I also want to make it so that when a unit leaves the region, it aborts the timer and cancels the Victory. The problem is that whenever the unit leaves the region, it doesn't destroy or stop the timer, and it still ends in victory when it expires!
Trigger 1:
Events
-Unit - Any Unit Enters (Hill)
Local Variables
Conditions
-((Unit type of (Triggering unit)) is Hero) == true
-((Triggering unit) is in (Hill)) == true
Actions
-UI - Display "Somebody is King" for (All players) to Subtitle area
-Timer - Start Timer 1 as a One Shot timer that will expire in 20 game time seconds
-Timer - Create timer window for Timer 1 with title 'remaining time'
-Timer - Show Timer 1 Window for (All Players)
-General - Wait for Timer 1 to have 0.0 seconds remaining
-Timer - Destroy timer window for Timer 1
-Game - End game in Victory for player (Owner of (Triggering Unit)) (Show dialogs, show score screen)
Trigger 2:
-Events
-Unit - Any Unit leaves Hill
Local Variables
Conditions
-((Unit type of (triggering unit)) is Hero) == true
-((Triggering unit) is in 'Hill') == false
Actions
-Timer - Destroy Timer 1 Window
-Timer - Hide Timer 1 Window for (All Players)
-UI - Display "The king has abdicated" for (All Players) to Subtitle area
Thanks for the help :D
@UninvitedSC: Go
Screenshots are of inferior quality, post it as text instead.
@caspersc
All done! :)
@UninvitedSC: Go
you need 1 more trigger with the event Timer Expires
Make sure that you saved the timer as a global variable. Also, use a boolean variable and set it to true when the unit enters, and false when it leaves, make sure it has an array.
Finally, you are going to need to check whether or not the boolean variable is true when the timer expires.
Side Note: that trigger will fire whenever a unit enters the region, you are going to need to set it up so that more than 1 unit/player cannot be "King of the Hill"
@Usernameisntworking
Thanks, it seems to be working now. Although, whenever a unit re-enters a region, it creates a new timer window underneath the one that was told to be destroyed when the unit leaves a region.