can't figure out how to contest the hill. i came up with something that is a lot of king of the hill but different, and i don't even know if it would work
i've pretty much hit "map maker's block" which is kinda like writer's block, and i don't know what to do
here are the triggers:
The Hill Timer Expires
Events
Timer - timerScore expires
Local Variables
Conditions
Actions
Dialog - Set score[3] text to (Text(numberOfHillUnits)) for (All players)
Unit Group - Pick each unit in (Any units in TheHill owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Owner of (Picked unit)) <= 5
numberOfHillUnits <= 5
Then
Variable - Modify teamOnePoints: + 1.0
Dialog - Set score[1] text to (Text(teamOnePoints) with Any Precision decimal places) for (All players)
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Owner of (Picked unit)) >= 6
numberOfHillUnits <= 5
Then
Variable - Modify teamTwoPoints: + 1.0
Dialog - Set score[2] text to (Text(teamTwoPoints) with Any Precision decimal places) for (All players)
Else
Unit Enters Hill
Events
Unit - Any Unit Enters TheHill
Local Variables
Conditions
Actions
Variable - Set leaver[(Owner of (Triggering unit))] = (Triggering unit)
Variable - Modify numberOfHillUnits: + 1
Unit Leaves Hill
Events
Unit - leaver[(Owner of (Triggering unit))] Leaves TheHill
Local Variables
Conditions
Actions
Variable - Modify numberOfHillUnits: - 1
I'm looking over your trigger right now. I have 2 questions: What is the trigger supposed to do? And what is the trigger doing right now? Basically, what is it doing that it's not supposed to be doing?
EDIT: I think I spotted the problem. In the "Unit Leaves Hill" trigger, you have an event that says "Unit - leaver[(Owner of (Triggering unit))] Leaves TheHill". The problem with this is the event is registered when the map loads. At that time, I would assume all elements of the leaver[] array equal to "No Unit". The event is not associated with the variable itself, but with the unit it references at the time its registered. On top of that, "Triggering Unit" during the map load is "No Unit", so "Owner of (Triggering Unit)" would equal 0.
Right now the last two triggers add and subtract from the number of units in the hill. The number of units in the hill determines whether or not points can be gained by players inside of the hill. If the number of units in the hill is <= 5, then points can be added to any unit's team if that unit is in the hill. If the number of units in the hill >= 6, then no one in the hill allocates points for their team. I couldn't figure out how to contest the hill so I decided to this instead. My problem is that I am having trouble contesting the hill. These triggers have nothing to do with contesting the hill. I posted these triggers to let you see what I am working with and if I need to change anything to help implement a contest the hill feature.
thanks it seems to work now, here are the triggers:
Periodic Check
Events
Timer - Every 1.0 seconds of Real Time
Local Variables
Conditions
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
And
Conditions
Number of Team 1 Units > 0
Number of Team 2 Units > 0
Then
UI - Display "Hill is Contested!!!" for (All players) to Subtitle area
Else
General - Pick each integer from 1 to 10, and do (Actions)
Actions
Unit Group - Pick each unit in (Any units in Hill owned by player (Picked integer) matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Picked integer) <= 5
Then
UI - Display ((Text((Picked integer))) + " owns the hill") for (All players) to Subtitle area
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Picked integer) >= 6
Then
UI - Display ((Text((Picked integer))) + " owns the hill") for (All players) to Subtitle area
Else
Unit Enters Hill
Events
Unit - Any Unit Enters Hill
Local Variables
Conditions
Actions
General - Pick each integer from 1 to 2, and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Owner of (Triggering unit)) <= 5
Then
Variable - Set Unit That Enters/Leaves[(Picked integer)] = (Triggering unit)
Variable - Modify Number of Team 1 Units: + 1
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Owner of (Triggering unit)) >= 6
Then
Variable - Set Unit That Enters/Leaves[(Picked integer)] = (Triggering unit)
Variable - Modify Number of Team 2 Units: + 1
Else
Unit Leaves Hill
Events
Unit - Any Unit Leaves Hill
Local Variables
Conditions
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Triggering unit) == Unit That Enters/Leaves[1]
Then
Variable - Modify Number of Team 1 Units: - 1
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Triggering unit) == Unit That Enters/Leaves[2]
Then
Variable - Modify Number of Team 1 Units: - 1
Else
I recommend removing the Periodic event and replacing it with an infinite While loop. While loops don't lag as much as a constantly firing event. It will still work, but the more events you have going off at once the more laggy your map will become, regardless of conditions or actions.
can't figure out how to contest the hill. i came up with something that is a lot of king of the hill but different, and i don't even know if it would work
i've pretty much hit "map maker's block" which is kinda like writer's block, and i don't know what to do
here are the triggers:
The Hill Timer Expires
Events
Timer - timerScore expires
Local Variables
Conditions
Actions
Dialog - Set score[3] text to (Text(numberOfHillUnits)) for (All players)
Unit Group - Pick each unit in (Any units in TheHill owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Owner of (Picked unit)) <= 5
numberOfHillUnits <= 5
Then
Variable - Modify teamOnePoints: + 1.0
Dialog - Set score[1] text to (Text(teamOnePoints) with Any Precision decimal places) for (All players)
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Owner of (Picked unit)) >= 6
numberOfHillUnits <= 5
Then
Variable - Modify teamTwoPoints: + 1.0
Dialog - Set score[2] text to (Text(teamTwoPoints) with Any Precision decimal places) for (All players)
Else
Unit Enters Hill
Events
Unit - Any Unit Enters TheHill
Local Variables
Conditions
Actions
Variable - Set leaver[(Owner of (Triggering unit))] = (Triggering unit)
Variable - Modify numberOfHillUnits: + 1
Unit Leaves Hill
Events
Unit - leaver[(Owner of (Triggering unit))] Leaves TheHill
Local Variables
Conditions
Actions
Variable - Modify numberOfHillUnits: - 1
edit: got rid of the victory part
@Dalemil: Go
I'm looking over your trigger right now. I have 2 questions: What is the trigger supposed to do? And what is the trigger doing right now? Basically, what is it doing that it's not supposed to be doing?
EDIT: I think I spotted the problem. In the "Unit Leaves Hill" trigger, you have an event that says "Unit - leaver[(Owner of (Triggering unit))] Leaves TheHill". The problem with this is the event is registered when the map loads. At that time, I would assume all elements of the leaver[] array equal to "No Unit". The event is not associated with the variable itself, but with the unit it references at the time its registered. On top of that, "Triggering Unit" during the map load is "No Unit", so "Owner of (Triggering Unit)" would equal 0.
@SentryIII:
Right now the last two triggers add and subtract from the number of units in the hill. The number of units in the hill determines whether or not points can be gained by players inside of the hill. If the number of units in the hill is <= 5, then points can be added to any unit's team if that unit is in the hill. If the number of units in the hill >= 6, then no one in the hill allocates points for their team. I couldn't figure out how to contest the hill so I decided to this instead. My problem is that I am having trouble contesting the hill. These triggers have nothing to do with contesting the hill. I posted these triggers to let you see what I am working with and if I need to change anything to help implement a contest the hill feature.
Create an if/then branch.
If
Number of units owned by player 1 in region "The Hill" > 0
Number of units owned by player 2 in region "The Hill" > 0
Then
(Whatever you want to happen while the hill is contested)
Else
(Whatever you want to happen while one person controls the hill)
@BasharTeg
thanks it seems to work now, here are the triggers:
Periodic Check
Events
Timer - Every 1.0 seconds of Real Time
Local Variables
Conditions
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
And
Conditions
Number of Team 1 Units > 0
Number of Team 2 Units > 0
Then
UI - Display "Hill is Contested!!!" for (All players) to Subtitle area
Else
General - Pick each integer from 1 to 10, and do (Actions)
Actions
Unit Group - Pick each unit in (Any units in Hill owned by player (Picked integer) matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Picked integer) <= 5
Then
UI - Display ((Text((Picked integer))) + " owns the hill") for (All players) to Subtitle area
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Picked integer) >= 6
Then
UI - Display ((Text((Picked integer))) + " owns the hill") for (All players) to Subtitle area
Else
Unit Enters Hill
Events
Unit - Any Unit Enters Hill
Local Variables
Conditions
Actions
General - Pick each integer from 1 to 2, and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Owner of (Triggering unit)) <= 5
Then
Variable - Set Unit That Enters/Leaves[(Picked integer)] = (Triggering unit)
Variable - Modify Number of Team 1 Units: + 1
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Owner of (Triggering unit)) >= 6
Then
Variable - Set Unit That Enters/Leaves[(Picked integer)] = (Triggering unit)
Variable - Modify Number of Team 2 Units: + 1
Else
Unit Leaves Hill
Events
Unit - Any Unit Leaves Hill
Local Variables
Conditions
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Triggering unit) == Unit That Enters/Leaves[1]
Then
Variable - Modify Number of Team 1 Units: - 1
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Triggering unit) == Unit That Enters/Leaves[2]
Then
Variable - Modify Number of Team 1 Units: - 1
Else
I recommend removing the Periodic event and replacing it with an infinite While loop. While loops don't lag as much as a constantly firing event. It will still work, but the more events you have going off at once the more laggy your map will become, regardless of conditions or actions.
@BasharTeg:
Ok. how do i make an infinite while loop?
Step 1: Create a local boolean variable in your trigger. Name it TRUE. Set the default of this variable to "true".
Step 2:
If your trigger doesn't have any events, proceed to step 3. Otherwise, you're done.
Step 3: Use the action "Run Trigger" from some other trigger (typically your initialization trigger) to run the trigger containing your While loop.
@BasharTeg:
thanks!