Welp, the title says it all. Here's what I got so far:
Enemies
Events
Unit - Any Unit starts attacking with Any Weapon
Actions
Player - Make player (Owner of (Triggering unit)) and player (Owner of (Damaging unit)) treat each other as Enemy.
Well I know that (Owner of (Triggering unit)) is correct but im not so sure about (Owner of (Damaging unit)) since I don't know very well what it returns.
I think it's returning the same unit right? xD
------------------------------------------
Allies
Events
Game - Player Any Player types a chat message containing ("-ally " + (Handle of player (triggering player))), matching Exactly
Well, the goal here is that if you unally someone, say player 2 and you are player 1.
Then you should type "-ally 2" and you will ally player 2, I thought Handle of player was the number of player, but I don't think it works, cus it returns a battlenet identifier if I understand correctly.
"Player - Make player (Owner of (Triggering unit)) and player (Owner of (Damaging unit)) treat each other as Enemy.
Well I know that (Owner of (Triggering unit)) is correct but im not so sure about (Owner of (Damaging unit)) since I don't know very well what it returns. I think it's returning the same unit right? xD"**
The damaging unit isn't returning any unit because it can't be used with that event. If it did, then yeah, it would be the same unit.
The event "unit is attacked" will make it so both the attacking unit and the being attacked unit can be returned.
"Game - Player Any Player types a chat message containing ("-ally " + (Handle of player (triggering player))), matching Exactly"
You can't put functions or variables in an event.
So it should look like this: ...containing ("-ally "), matching PARTIALLY.
And in your conditions, you should have something that looks like this:
(Integer((Word 2 of (Entered chat string)))) != 0
1. If there is no word two of the string, it will return 0. It might give an error, but I don't think so. That'll make sure that a player was specified in the string.
2. Handle of Player will return the string ID number of a player, which looks something like 1-S-##, like you said. There's no way to get a players name in string form, only text, which can't be used for this purpose. So you have to have the players use an integer in the string, (i.e. "-ally 2")
okay, player (Owner of (Triggering unit)) and player (Owner of (Damaging unit)) are the same person since the attacking unit is the triggering unit.
Game - Player Any Player types a chat message containing ("-ally " + (Handle of player (triggering player)))
here Player 1 would have to write "-ally 1", then it would ally himself.
I'm not very good with the editor myself, I see the problems, I can't really fix 'em. Hope it helps anyway
Forgot to mention, "The damaging unit isn't returning any unit because it can't be used with that event. "
You can see what event related return functions (triggering player, damaging player, triggering unit, damaging effect, etc.) are available for which events in the notes of each trigger (which you see when you click on an action/function in the function browser).
Yeah, I was thinking of something like that, but thought I could do it all in the events part, got kind of lazy. :P putting the "-ally " then in actions put the rest, but I wanted to figure it out all in events, if it could be done in events.
"(Integer ((Word 2 of (Entered chat string)))) <= (Number of players in (Active Players))"
Number of players in the player group Active Players is going to give you the number of players in the game. This won't work, because if you have two players playing, one is player 1, and the other is player 5, the player 5 is going to be more than the maximum 2 (the number of players in the game).
"For the enemies one, still need help :), I just don't know how to return the one that is being damaged. Thanks again, friends!"
If you use Attacking Unit and Triggering Unit with the event Unit is Attacked, the owners of those two units will be the players you're trying to return.
I don't have the editor in front of me, but I think there is an "Unit is attacked" event where "Triggering unit" is the attacked unit and "Attacking unit" is the attacking unit. Generally, with events like this, there is a tip on the bottom detailing it.
So it would be like:
EVENT
Any unit is attacked
ACTION
Make owner of triggering unit and owner of attacking unit enemies.
Welp, the title says it all. Here's what I got so far:
Enemies
Events
Unit - Any Unit starts attacking with Any Weapon
Actions
Player - Make player (Owner of (Triggering unit)) and player (Owner of (Damaging unit)) treat each other as Enemy.
Well I know that (Owner of (Triggering unit)) is correct but im not so sure about (Owner of (Damaging unit)) since I don't know very well what it returns. I think it's returning the same unit right? xD
------------------------------------------Allies
Events
Game - Player Any Player types a chat message containing ("-ally " + (Handle of player (triggering player))), matching Exactly
Well, the goal here is that if you unally someone, say player 2 and you are player 1. Then you should type "-ally 2" and you will ally player 2, I thought Handle of player was the number of player, but I don't think it works, cus it returns a battlenet identifier if I understand correctly.
@joemart06: Go
"Player - Make player (Owner of (Triggering unit)) and player (Owner of (Damaging unit)) treat each other as Enemy.
Well I know that (Owner of (Triggering unit)) is correct but im not so sure about (Owner of (Damaging unit)) since I don't know very well what it returns. I think it's returning the same unit right? xD"**
The damaging unit isn't returning any unit because it can't be used with that event. If it did, then yeah, it would be the same unit.
The event "unit is attacked" will make it so both the attacking unit and the being attacked unit can be returned.
"Game - Player Any Player types a chat message containing ("-ally " + (Handle of player (triggering player))), matching Exactly"
You can't put functions or variables in an event.
So it should look like this: ...containing ("-ally "), matching PARTIALLY.
And in your conditions, you should have something that looks like this:
(Integer((Word 2 of (Entered chat string)))) != 0
1. If there is no word two of the string, it will return 0. It might give an error, but I don't think so. That'll make sure that a player was specified in the string.
2. Handle of Player will return the string ID number of a player, which looks something like 1-S-
#
#, like you said. There's no way to get a players name in string form, only text, which can't be used for this purpose. So you have to have the players use an integer in the string, (i.e. "-ally 2")@joemart06: Go
okay, player (Owner of (Triggering unit)) and player (Owner of (Damaging unit)) are the same person since the attacking unit is the triggering unit.
Game - Player Any Player types a chat message containing ("-ally " + (Handle of player (triggering player))) here Player 1 would have to write "-ally 1", then it would ally himself. I'm not very good with the editor myself, I see the problems, I can't really fix 'em. Hope it helps anyway
@PillowFort: Go
"then it would ally himself."
Also, true.
Forgot to mention, "The damaging unit isn't returning any unit because it can't be used with that event. "
You can see what event related return functions (triggering player, damaging player, triggering unit, damaging effect, etc.) are available for which events in the notes of each trigger (which you see when you click on an action/function in the function browser).
@Charysmatic: Go
<3
@PillowFort: Go
Yeah, I was thinking of something like that, but thought I could do it all in the events part, got kind of lazy. :P putting the "-ally " then in actions put the rest, but I wanted to figure it out all in events, if it could be done in events.
Pulled it off!
Events
Game - Player Any Player types a chat message "-ally ", matching exactly
Conditions
And
-> (Integer ((Word 2 of (Entered chat string)))) <= (Number of players in (Active Players))
-> (Integer ((Word 2 of (Entered chat string)))) >= 1
Actions
If (Word 2 of (Entered chat string )) == "1"
Then Player- Make Player (Triggering player) treat player 1 as Ally
If (Word 2 of (Entered chat string )) == "2"
Then Player- Make Player (Triggering player) treat player 2 as Ally
And so on
For the enemies one, still need help :), I just don't know how to return the one that is being damaged. Thanks again, friends!
@joemart06: Go
"(Integer ((Word 2 of (Entered chat string)))) <= (Number of players in (Active Players))"
Number of players in the player group Active Players is going to give you the number of players in the game. This won't work, because if you have two players playing, one is player 1, and the other is player 5, the player 5 is going to be more than the maximum 2 (the number of players in the game).
"For the enemies one, still need help :), I just don't know how to return the one that is being damaged. Thanks again, friends!"
If you use Attacking Unit and Triggering Unit with the event Unit is Attacked, the owners of those two units will be the players you're trying to return.
@Charysmatic: Go
"(Integer ((Word 2 of (Entered chat string)))) <= (Number of players in (Active Players))"
Ah right, I heard that in game the number of players gets mixed up. Well, how to solve this then? Divide everyone by teams?
@Charysmatic: Go
Hm, so changing events, changes the possible actions you may have? Im learning, im learning! :D
I don't have the editor in front of me, but I think there is an "Unit is attacked" event where "Triggering unit" is the attacked unit and "Attacking unit" is the attacking unit. Generally, with events like this, there is a tip on the bottom detailing it.
So it would be like:
EVENT Any unit is attacked
ACTION Make owner of triggering unit and owner of attacking unit enemies.
@EivindL: Go
Yep something like that:
Events
Unit - Any Unit is attacked with Any Weapon
Actions
Player - Make player (Owner of (Triggering unit)) and player (Owner of (Attacking Unit)) treat each other as Enemy
Well it IS that, actually. xD