Probably simple, but major hold-up.

MedievalD

New Member
Reaction score
0
So I'm trying to make a trigger that goes as such:

- If player (Red, etc...) enters a region and there is no other player/NH there (I have 6 players), he/she will gain control of that "Territory", gaining more income.
- If player (Red, etc...) enters a region and there is another player/NH there, he/she must kill that players/NH units to gain control of the region/Territory.
- If player (Red, etc...) leaves controlled region/Territory, he/she will lose control and income bonus.

There is also messages that will pop up, telling all players that that player has gained control over that specific region/Territory, as well as telling individual players.

I'll put what I have then explain the problem:

Code:
Events
   Unit - A unit enters Red Shop Territory <gen>
Conditions
   (Owner of (Triggering unit)) Equal to Player 1 (Red)
Actions
   If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
         RedShopT[2] Equal to 0
         RedShopT[3] Equal to 0
         RedShopT[4] Equal to 0
         RedShopT[5] Equal to 0
         RedShopT[6] Equal to 0
         RedShopT[7] Equal to 0
      Then - Actions
         Set RedShopT[1] = 1
         Set Income[1] = (Income[1] + 50)
         Game - Display to (All players) the text: Red has...
      Else - Actions
         Set RedShopT[1] = 0
         Game - Display to Player Group - Player 1 (Red) the text: You must...

I was going to put what I had tried to do if Blue was killed/left the region, but every time it failed.

When I would test it, I would have a Blue unit go into region (I did this same Trigger for Blue), which would put RedShopT[2] at 1; have a Red unit try to go into the region. On the Red players screen it displayed "You must.." like it should have, but when I killed the Blue unit of course nothing would happen because that Trigger is set up for "If unit enters Region" not "If unit is in region", which oddly enough doesn't exist to my knowledge (which clearly isn't very extensive regarding WE). So I would take the Red unit out, and run it back in, and even though I had it set so that if the Blue unit left that region, RedShopT[2] = 0, it still showed the message "You must...".

If anyone could help me out with this, that'd be great.
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
Why don't you do something like...
Event
Unit is killed
Action
If
Unit is owned by player 2 = true
Then
set RedShopT[2] Equal to 0
Set RedShopT[player number of owner of killing unit] = 1
Set Income[player number of owner of killing unit] = (Income[player number of owner of killing unit] + 50)

But this is only for player 2. So you can use integer A loop.

Event
Unit is killed
Actions
Integer A 1 to 6
If
Unit is owned by player[integer a]
Then
Set RedshopT[integerA] equal to 0
Set RedShopT[player number of owner of killing unit] = 1
Set Income[player number of owner of killing unit] = (Income[player number of owner of killing unit] + 50)
 

Ryushi

"I will stand, or I will fall. I will not sit."
Reaction score
59
Skyblader

What if there are three units battling in a region? If one of them kills another, they become the 'owner' of the region, and will remain so for the duration they are battling with the other unit. It may be a minor issue, but something that I wouldn't overlook.

What I would do would be:
Trigger:
  • trigger
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to Number of Regions, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in (Units in RegionArray[(Integer A)])) Equal to 0
            • Then - Actions
              • Set RegionOwner[(Integer A)] = 0
            • Else - Actions
          • For each (Integer B) from 1 to 6, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in (Units in RegionArray[(Integer A)] owned by (Player((Integer B))))) Greater than 0
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in (Units in RegionArray[(Integer A)])) Equal to (Number of units in (Units in RegionArray[(Integer A)] owned by (Player((Integer B)))))
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • RegionOwner[(Integer A)] Not equal to (Integer B)
                        • Then - Actions
                          • Set RegionOwner[(Integer A)] = (Integer B)
                          • Game - Display to (All players) the text: Player has taken ow...
                        • Else - Actions
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • RegionOwner[(Integer A)] Not equal to 7
                        • Then - Actions
                          • Set RegionOwner[(Integer A)] = 7
                          • Game - Display to (All players) the text: You must defeat all...
                        • Else - Actions
                • Else - Actions

Store all your regions in the variable RegionArray, which is of course a Region Array. Then base income off of the number of values in RegionOwner equal to the player number.

I haven't tested the trigger, but I think it would work.
 

MedievalD

New Member
Reaction score
0
@skyblader: I'm just trying to figure the Integers out as I go. Do I need to predetermine a variable for such, or do I just go with a loop. Like For Each (Integer A) from 1 to 6, do (Do nothing)? The part with just the second player I get.

@Ryushi: I'm guessing that's to add onto, skyblader's one, and I did look it over because you are right about multiple players in the same region battling for it. So with that said after I figure out this Integer stuff, I'm going to look harder.

I'm gonna focus on this again tomorrow, been working on this map for 2 days straight and now that I've run into a block my brain is like woah, break time... First map I've attempted with semi-complicated (to me) triggers, but I'm competent, so your time is not wasted.

Thanks.
 

Ryushi

"I will stand, or I will fall. I will not sit."
Reaction score
59
The trigger was meant to be separate from Skyblader's triggers, and should hopefully work correctly, as long as my logic is right.
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
Just go with the loop. You don't need a variable to use the Integer A loop.
For 1 to 6 means it'll do it 6 times,

So it'll be like

For 1 to 6 do
Loop - actions
Create 1 unit at point

It actually does

Create 1 unit at point
Create 1 unit at point
Create 1 unit at point
Create 1 unit at point
Create 1 unit at point
Create 1 unit at point

You can also manipulate it, like how I did it. Say, you want to do it 6 times, but for 6 different players. So it'll be something like

For 1 to 6 do
Loop - actions
Create unit at point for Player[integer A]

This is actually doing

Create unit at point for Player[1]
Create unit at point for Player[2]
Create unit at point for Player[3]
Create unit at point for Player[4]
Create unit at point for Player[5]
Create unit at point for Player[6]

The Player is not a variable, but rather converting player index to player. One of the options from the drop down list.

And, good luck for your map :thup:
 

MedievalD

New Member
Reaction score
0
Ok, I'm understanding this now. But one other quick, related question was that if I have the 6 players, and use integers for their player number, but the players in the Player Properties active are 1, 2, 4, 5, 6, 7... Will it count 4, 5, 6, 7 as 3, 4, 5, 6?
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
What do you mean? Whatever players you want, you can just change the number according to what you want. Integer A from 2 to 7, is still doing it 6 times, but for players 2 to 7.
 

MedievalD

New Member
Reaction score
0
That's what I'm saying though, I got players 1-2, then 4-7. I skip 3 because I require the colors of Red, Blue, Purple, Yellow, Orange, and Green. So what you're saying is if it reads 1-6 then the triggers I want to be active for Green simply wouldn't work.

Could I simply put 1-7, and ignore 3?
 

Ryushi

"I will stand, or I will fall. I will not sit."
Reaction score
59
I'm pretty sure you can't ignore the 3. If you can't then for a loop that would initally run from 1 to 6, you'll need to have it run from 1 to 7. Then add an if statement to check if it's running for number 3, and if it is, skip all the actions in the loop for that run.

Again, I'm not 100% sure that you can't ignore 3, I've never tested it.
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
Then you'll have to make for integer A 1-2 and 4-7, otherwise you can check

Player[IntegerA] = player [3]
Then
Do nothing
Else
Put all the actions here

So this will check, if it's 3, it'll skip.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top