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.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top