ally/unally triggers

Stretch

New Member
Reaction score
0
Hey everyone, what I want is fairly simple, just that when players type -ally red they are allied to red, I know a long way of putting this in place but I was just hoping one of you know a faster way of doing it without me having to do tons of triggers ^^

clear example:

player 1 types -ally blue
player 1 is allied to blue with shared vision but blue isnt allied to red
player 2 types -ally red
player 2 is allied to red with shared vision

sorry if there is a tutorial for this I couldn't find one personally

thanks in advance :)

edit: could it please be for players 1-10 (red to lightblue)
 

Stretch

New Member
Reaction score
0
hmm quite a few views and no replies, is there actually no shorter way doing it than making many triggers?
 

Inflicted

Currently inactive
Reaction score
63
does it have to ask the player if they want to be? or does it just make them your ally? do they treat you as ally aswel?
 

gaskell

Member
Reaction score
0
make the command "-ally 1" or "-ally 8" instead of "-ally blue" or "-ally pink" or whatever.
Trigger:
  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) types a chat message containing -ally as A substring
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Entered chat string) Equal to (-ally + (String((Integer A))))
            • Then - Actions
              • Player - Make Player 1 (Red) treat (Player((Integer A))) as an Ally with shared vision
            • Else - Actions

I'm pretty noobish at triggers but that should work. Well at least till someone with more knowledge comes along.
Only thing to check here is whether the array needs to be set to "1" or " 1" (with or without the space). If you want it to be "-ally1" or "-ally 1".
 

Inflicted

Currently inactive
Reaction score
63
note that it does not ask the player if they want to be allied in your method, but kinda forces them to be.

but that might be what he/she wants, idk..
 

Stretch

New Member
Reaction score
0
sorry for not being more specific, it would not require asking the other player if they want to be allies neither does it force them both to be allies.

if player 1 types -ally blue (or 2 as shown above) player 1 shares his vision with player 2 and has classed him as an ally but player 2 still has player 1 listed as an enemy and is not sharing his vision with player 1

if this is not clear enough please ask and I will try explain better.

although if its possible to make it so it asks the other player to be allies that would be great, i'm not too sure if that was possible or not ^^
 

Ashlebede

New Member
Reaction score
43
Please do not post twice in a row in the same thread without at least 24 hours' interval.

You should use a "SubString" to get a "part" of the string. In a string, every character is "counted". For instance, in the following string :

Code:
-ally blue

The characters will have the following indexes :

Code:
1234567890
-ally blue

0 being 10. To get the "parameter" of the command, you should make a substring from 7 to somewhere past the string, such as 20. If that substring is equal to, say, blue, then you should execute actions for Player 2.

Trigger:
  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) types a chat message containing -ally as A substring
      • Player - Player 2 (Blue) types a chat message containing -ally as A substring
      • Player - Player 3 (Teal) types a chat message containing -ally as A substring
      • {And so on...}
    • Conditions
    • Actions
      • Set myStringVariable = (Substring((Entered chat string), 7, 20))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • myStringVariable Equal to red
          • (Triggering player) Not equal to Player 1 (Red)
        • Then - Actions
          • Player - Make (Triggering player) treat Player 1 (Red) as an Ally with shared vision
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • myStringVariable Equal to blue
              • (Triggering player) Not equal to Player 2 (Blue)
            • Then - Actions
              • Player - Make (Triggering player) treat Player 2 (Blue) as an Ally with shared vision
            • Else - Actions
              • {And so on...}


That should work. It requires a [ljass]string[/ljass]-type variable declared using CTRL+B in the Trigger Editor. We have to check who the Triggering Player is, since allying a player to themselves will take away control from their own units. You could use that as a trick to take away unit control from a player, that should be a good idea for some game...
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
you should maybe change this:
Trigger:
  • Set myStringVariable = (Substring((Entered chat string), 7, 20))

to this:
Trigger:
  • Set myStringVariable = (Substring((Entered chat string), 7, (Length of (Entered Chat String))))

would work either ways but the second looks more professional.

and by the way, you dont have to check for:
Trigger:
  • (Triggering player) Not equal to Player 1 (Red)

because it doesnt matter if player 1 will change the alliance towards himself. such a function would just do nothing at all.

and maybe the whole trigger would look much more structured by using a hashtable to retrieve the player connected with the string for his colour.
 

Stretch

New Member
Reaction score
0
thank you for the help guys but i cannot get the -unally to work, i did simply just copy and past the ally one but change the entered chat to -unally and for it to treat them as enemy but it doesnt seem to work

see my trigger for it below :)

Trigger:
  • Unally
    • Events
      • Player - Player 1 (Red) types a chat message containing -unally as A substring
      • Player - Player 2 (Blue) types a chat message containing -unally as A substring
      • Player - Player 3 (Teal) types a chat message containing -unally as A substring
      • Player - Player 4 (Purple) types a chat message containing -unally as A substring
      • Player - Player 5 (Yellow) types a chat message containing -unally as A substring
      • Player - Player 6 (Orange) types a chat message containing -unally as A substring
      • Player - Player 7 (Green) types a chat message containing -unally as A substring
      • Player - Player 8 (Pink) types a chat message containing -unally as A substring
      • Player - Player 9 (Gray) types a chat message containing -unally as A substring
      • Player - Player 10 (Light Blue) types a chat message containing -unally as A substring
    • Conditions
    • Actions
      • Set stringvariable = (Substring((Entered chat string), 7, (Length of (Entered chat string))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • stringvariable Equal to red
        • Then - Actions
          • Player - Make (Triggering player) treat Player 1 (Red) as an Enemy
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • stringvariable Equal to blue
            • Then - Actions
              • Player - Make (Triggering player) treat Player 2 (Blue) as an Enemy
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • stringvariable Equal to teal
                • Then - Actions
                  • Player - Make (Triggering player) treat Player 3 (Teal) as an Enemy with shared vision
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • stringvariable Equal to purple
                    • Then - Actions
                      • Player - Make (Triggering player) treat Player 4 (Purple) as an Enemy
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • stringvariable Equal to yellow
                        • Then - Actions
                          • Player - Make (Triggering player) treat Player 5 (Yellow) as an Enemy
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • stringvariable Equal to orange
                            • Then - Actions
                              • Player - Make (Triggering player) treat Player 6 (Orange) as an Enemy
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • stringvariable Equal to green
                                • Then - Actions
                                  • Player - Make (Triggering player) treat Player 7 (Green) as an Enemy
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • stringvariable Equal to pink
                                    • Then - Actions
                                      • Player - Make (Triggering player) treat Player 8 (Pink) as an Enemy
                                    • Else - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • stringvariable Equal to gray
                                        • Then - Actions
                                          • Player - Make (Triggering player) treat Player 9 (Gray) as an Enemy
                                        • Else - Actions
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • stringvariable Equal to lightblue
                                            • Then - Actions
                                              • Player - Make (Triggering player) treat Player 10 (Light Blue) as an Enemy
                                            • Else - Actions
                                              • Do nothing
 

laxperson808

New Member
Reaction score
9
u didnt change the substring #s..
1234567890
-ally red
-unally red
see the differnce? the # changes when you add the 2 letters un
 

laxperson808

New Member
Reaction score
9
also if you wanted to ask some1 about being allies for intsance
player 1 types -ally blue
on blues screed he gets
Player 1 would like to ally you
(yes)
(no)
would require a dialog along with dialog varibles and if u wanted the trigger i could make it fore you
 

Stretch

New Member
Reaction score
0
ah yes i didnt notice thanks lax it works now :)

and if you could make up the trigger for me that would be fantastic :D
 

Ashlebede

New Member
Reaction score
43
you should maybe change this:
Trigger:
  • Set myStringVariable = (Substring((Entered chat string), 7, 20))

to this:
Trigger:
  • Set myStringVariable = (Substring((Entered chat string), 7, (Length of (Entered Chat String))))

would work either ways but the second looks more professional.

and by the way, you dont have to check for:
Trigger:
  • (Triggering player) Not equal to Player 1 (Red)

because it doesnt matter if player 1 will change the alliance towards himself. such a function would just do nothing at all.


and maybe the whole trigger would look much more structured by using a hashtable to retrieve the player connected with the string for his colour.

Once upon a time, when I was making modes for my HLW map, I made the mistake of letting a player ally themselves. The result was that I couldn't control my own units, as though they were one of my allies'.
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
as far as i know allieing yourself doesnt do anything at all. i tested stuff like that several times.
 

Ashlebede

New Member
Reaction score
43
Allright, we ain't going to argue there. Maybe it was the JASS version that doesn't check for that and the GUI one does. Maybe not. But it did that for my map. Maybe it didn't for yours.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/

      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