M
Macintuss
Guest
Hi. Thanks for reading. This might be hard to explain and/or read, I'll try my best to make it clear.
My Goal: When a unit enters region "center" starts a 30 second timer/display for owner of triggering unit. If that unit leaves it clears the timer/display. If another players unit enters while someone else is in the "center" it will pause until there is only one person in the "center". When a players timer reaches 0 for being in the center it will create 1 unit (somewhere doesn't matter) and then restart the timer for 30 seconds again.
My Current Triggers For This: (only triggered for red and blue for now) Warning: You will laugh at how primative my coding skill is & there are 7 triggers here
Problem With My Code: When player 1 Red goes in the region everything works perfect like a charm (so far). But when Player 2 Blue enters it just shows the window and no timer is going, also when blue leaves the region it keeps the timer window and doesn't destroy it, red cannot enter the middle and start a timer after blue has been in it
Solution: Find the problem in my code (if you have the time to read it) or if your super cool you could find a easier way to code this and post it for me. Either way suggestions are wanted and answers are rep'd. Thanks.
My Goal: When a unit enters region "center" starts a 30 second timer/display for owner of triggering unit. If that unit leaves it clears the timer/display. If another players unit enters while someone else is in the "center" it will pause until there is only one person in the "center". When a players timer reaches 0 for being in the center it will create 1 unit (somewhere doesn't matter) and then restart the timer for 30 seconds again.
My Current Triggers For This: (only triggered for red and blue for now) Warning: You will laugh at how primative my coding skill is & there are 7 triggers here
Code:
UnitEntersCenter
Events
Time - Every 1.00 seconds of game time
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MiddleOwned Equal to 1
ismiddlered Equal to 1
Redtimeractive Equal to 0
Then - Actions
Set Redtimeractive = 1
Countdown Timer - Start Kingofthehilltimer[(Player number of Player 1 (Red))] as a One-shot timer that will expire in 30.00 seconds
Countdown Timer - Create a timer window for Kingofthehilltimer[(Player number of Player 1 (Red))] with title ((Name of Player 1 (Red)) + Middle:)
Set KingOfHillWindow[(Player number of Player 1 (Red))] = (Last created timer window)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MiddleOwned Equal to 1
ismiddleblue Equal to 1
Bluetimeractive Equal to 0
Then - Actions
Set Bluetimeractive = 1
Countdown Timer - Start Kingofthehilltimer[(Player number of Player 2 (Blue))] as a One-shot timer that will expire in 30.00 seconds
Countdown Timer - Create a timer window for Kingofthehilltimer[(Player number of Player 2 (Blue))] with title ((Name of Player 2 (Blue)) + Middle:)
Set KingOfHillWindow[(Player number of Player 2 (Blue))] = (Last created timer window)
Else - Actions
Do nothing
Code:
UnitExitsCenter
Events
Time - Every 1.00 seconds of game time
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
ismiddlered Equal to 0
Then - Actions
Countdown Timer - Pause Kingofthehilltimer[(Player number of Player 1 (Red))]
Countdown Timer - Destroy KingOfHillWindow[(Player number of Player 1 (Red))]
Set Redtimeractive = 0
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
ismiddleblue Equal to 0
Then - Actions
Countdown Timer - Pause Kingofthehilltimer[(Player number of Player 2 (Blue))]
Countdown Timer - Destroy KingOfHillWindow[(Player number of Player 2 (Blue))]
Set Bluetimeractive = 0
Else - Actions
Do nothing
Code:
Own Middle
Events
Time - Every 1.00 seconds of game time
Conditions
MiddleOwned Equal to 1
Actions
Unit Group - Pick every unit in (Units in Center <gen>) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Owner of (Picked unit)) Equal to Player 1 (Red)
Then - Actions
Set ismiddlered = 1
Else - Actions
Set ismiddlered = 0
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Owner of (Picked unit)) Equal to Player 2 (Blue)
Then - Actions
Set ismiddleblue = 1
Else - Actions
Set ismiddleblue = 0
Code:
Own Middle2
Events
Time - Every 1.00 seconds of game time
Conditions
MiddleOwned Equal to 0
Actions
Set ismiddlered = 0
Set ismiddleblue = 0
Code:
AnyoneInMiddle
Events
Time - Every 1.00 seconds of game time
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in (Units in Center <gen> matching ((Life of (Matching unit)) Greater than or equal to 1.00))) Less than 1
Then - Actions
Set MiddleOwned = 0
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in (Units in Center <gen> matching ((Life of (Matching unit)) Greater than or equal to 1.00))) Greater than or equal to 1
Then - Actions
Set MiddleOwned = 1
Else - Actions
Code:
TimerExpiresRed
Events
Time - Kingofthehilltimer[(Player number of Player 1 (Red))] expires
Conditions
Actions
Countdown Timer - Destroy KingOfHillWindow[(Player number of Player 1 (Red))]
Set Redtimeractive = 0
Game - Display to (All players) the text: ((Name of Player 1 (Red)) + Has Achieved King of The Hill!)
Unit - Create 1 Golem Part for Player 1 (Red) at (Random point in GolemPartsSpawn1 <gen>) facing Default building facing degrees
Sound - Play KingoftheHill <gen>
Special Effect - Create a special effect at (Random point in Center <gen>) using Abilities\Spells\Human\Resurrect\ResurrectCaster.mdl
Special Effect - Destroy (Last created special effect)
Special Effect - Create a special effect at (Random point in Center <gen>) using Abilities\Spells\Human\Resurrect\ResurrectCaster.mdl
Special Effect - Destroy (Last created special effect)
Special Effect - Create a special effect at (Random point in Center <gen>) using Abilities\Spells\Human\Resurrect\ResurrectCaster.mdl
Special Effect - Destroy (Last created special effect)
Special Effect - Create a special effect at (Random point in Center <gen>) using Abilities\Spells\Human\Resurrect\ResurrectCaster.mdl
Special Effect - Destroy (Last created special effect)
Code:
TimerExpiresBlue
Events
Time - Kingofthehilltimer[(Player number of Player 2 (Blue))] expires
Conditions
Actions
Countdown Timer - Destroy KingOfHillWindow[(Player number of Player 2 (Blue))]
Set Bluetimeractive = 0
Game - Display to (All players) the text: ((Name of Player 2 (Blue)) + Has Achieved King of The Hill!)
Unit - Create 1 Golem Part for Player 2 (Blue) at (Random point in GolemPartsSpawn1 <gen>) facing Default building facing degrees
Sound - Play KingoftheHill <gen>
Special Effect - Create a special effect at (Random point in Center <gen>) using Abilities\Spells\Human\Resurrect\ResurrectCaster.mdl
Special Effect - Destroy (Last created special effect)
Special Effect - Create a special effect at (Random point in Center <gen>) using Abilities\Spells\Human\Resurrect\ResurrectCaster.mdl
Special Effect - Destroy (Last created special effect)
Special Effect - Create a special effect at (Random point in Center <gen>) using Abilities\Spells\Human\Resurrect\ResurrectCaster.mdl
Special Effect - Destroy (Last created special effect)
Special Effect - Create a special effect at (Random point in Center <gen>) using Abilities\Spells\Human\Resurrect\ResurrectCaster.mdl
Special Effect - Destroy (Last created special effect)
Problem With My Code: When player 1 Red goes in the region everything works perfect like a charm (so far). But when Player 2 Blue enters it just shows the window and no timer is going, also when blue leaves the region it keeps the timer window and doesn't destroy it, red cannot enter the middle and start a timer after blue has been in it
Solution: Find the problem in my code (if you have the time to read it) or if your super cool you could find a easier way to code this and post it for me. Either way suggestions are wanted and answers are rep'd. Thanks.