Hey guys, first off, this site is a godsend, solved about ten kajillion billion problems that I've had so far by using the search function here but I didn't find anything for this particular one, so I'm going to see if anyone's done it before. Here goes:
I'm creating a Robin Hood map. Basically, there will be 3 players:
1&2 are Human controlled, 3 is an AI.
Robin Hood and his Merry Men (human)
The Duke of Nottingham (human)
The citizens of Nottingham (AI)
Alright, so players 1 and 3 use units of the same model and color so they are indistinguishable to the eye. This way, Robin Hood's men can sneak in to Nottingham by looking like regular citizens (who the AI sends in regularly).
However, Nottingham's men would automatically attack Robin Hood's men if they weren't invulnerable, so I set Robin Hood's men to be invulnerable. Now, Robin Hood has to be allied by default to the Duke or else his guys would attack the guard as they tried to sneak into the city and give their position away. So if you're following, Robin Hood is allied to the Duke but the Duke is an enemy of Robin Hood.
If Player 2 clicks on one of Robin Hood's men (remember, they look like the citizens so this isn't easy to do, involves a lot of clicking) then they suddenly change color and lose their invulnerability. The loss of their invulnerability causes nearby Nottingham men to attack them, because they'er unallied. That part is all good but the problem is that Robin Hood's discovered men won't attack back. Robin Hood can't unally or his other guys in the city will start attacking and give themselves away so I want JUST THE DISCOVERED UNITS to unally the Duke. Is this possible?
I don't believe you can set individual unit alliances, no.
You could:
Keep everyone as neutral. Players would have to attack manually.
or
Make triggers that give attack commands wherever you need them (would likely be quite complex).
or
Set up a new player, lets call him, "Discovered!". Give any discovered units to this shared control dummy player.
Okay so after being changed to player 5, all is good except that it happens in certain other circumstances as well (that would give the unit away) and when it happens, it ends the current order. So one of these conditions is attacking. If I set one of them to attack something, it changes teams and then doesn't attack. I need to repeat the order.
I'm in a bit of a rush now and haven't used this myself yet, but it should work. Store the order of the unit before you change ownership and then re-issue the order afterwards. I'm not sure, but I guess the index refers to the units order queue. So if you want all queued orders to transfer, store them all and re-order them one at a time. Again, not sure since i never used it, but the function "Unit - Unit Order Count" probably returns the number of orders queued up on a unit.
Edit:
This would probably be a useful thing to do in a custom function with two parameters, the unit you want ownership to change for, and the player number to change to. I could try to set one up for you later if you need.
I'm actually a bit surprised this isn't an event already: Change ownership and retain orders. (workers being given to the player in the campaign could really have used this as they often started mining during a cut-scene and then stopped after being given to the player).
Really? I tried doing the save order thingy, both the entire queue and only the current order. Didn't work for some reason. Guess I messed up somewhere.
Hey guys, first off, this site is a godsend, solved about ten kajillion billion problems that I've had so far by using the search function here but I didn't find anything for this particular one, so I'm going to see if anyone's done it before. Here goes:
I'm creating a Robin Hood map. Basically, there will be 3 players: 1&2 are Human controlled, 3 is an AI.
Alright, so players 1 and 3 use units of the same model and color so they are indistinguishable to the eye. This way, Robin Hood's men can sneak in to Nottingham by looking like regular citizens (who the AI sends in regularly).
However, Nottingham's men would automatically attack Robin Hood's men if they weren't invulnerable, so I set Robin Hood's men to be invulnerable. Now, Robin Hood has to be allied by default to the Duke or else his guys would attack the guard as they tried to sneak into the city and give their position away. So if you're following, Robin Hood is allied to the Duke but the Duke is an enemy of Robin Hood.
If Player 2 clicks on one of Robin Hood's men (remember, they look like the citizens so this isn't easy to do, involves a lot of clicking) then they suddenly change color and lose their invulnerability. The loss of their invulnerability causes nearby Nottingham men to attack them, because they'er unallied. That part is all good but the problem is that Robin Hood's discovered men won't attack back. Robin Hood can't unally or his other guys in the city will start attacking and give themselves away so I want JUST THE DISCOVERED UNITS to unally the Duke. Is this possible?
I don't believe you can set individual unit alliances, no.
You could:
Keep everyone as neutral. Players would have to attack manually.
or
Make triggers that give attack commands wherever you need them (would likely be quite complex).
or
Set up a new player, lets call him, "Discovered!". Give any discovered units to this shared control dummy player.
@Berrala: Go
Hey thanks so much for the prompt reply. I love option 2, I'll give it a go. Thank you very much.
Okay so after being changed to player 5, all is good except that it happens in certain other circumstances as well (that would give the unit away) and when it happens, it ends the current order. So one of these conditions is attacking. If I set one of them to attack something, it changes teams and then doesn't attack. I need to repeat the order.
Is there a workaround?
I'm in a bit of a rush now and haven't used this myself yet, but it should work. Store the order of the unit before you change ownership and then re-issue the order afterwards. I'm not sure, but I guess the index refers to the units order queue. So if you want all queued orders to transfer, store them all and re-order them one at a time. Again, not sure since i never used it, but the function "Unit - Unit Order Count" probably returns the number of orders queued up on a unit.
Edit:
This would probably be a useful thing to do in a custom function with two parameters, the unit you want ownership to change for, and the player number to change to. I could try to set one up for you later if you need.
I'm actually a bit surprised this isn't an event already: Change ownership and retain orders. (workers being given to the player in the campaign could really have used this as they often started mining during a cut-scene and then stopped after being given to the player).
@Berrala: Go
Man, thank you so much for the help. I got it :D
Really? I tried doing the save order thingy, both the entire queue and only the current order. Didn't work for some reason. Guess I messed up somewhere.
@Berrala: Go
My first action in the trigger was to: I set my CURRENTORDER order variable to the triggering units order at index 0.
Then I'd change the team and any other attributes I'd want to change then my last action in the trigger was to:
Order triggering unit to CURRENTORDER and replace existing orders.
Yeah, that's what I did, or thought I did at least. Didn't save the test-map. Whatever, if it works, great. :-)