• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Share Control of Single Unit

Status
Not open for further replies.
Level 8
Joined
Oct 12, 2011
Messages
483
The problem is as stated in the title. I would like a MUI method to give Player A control of a single unit from Player B, while having the unit still look like it is owned by Player B, for all other players.

Some things I have tried:
1. Using the "Select Unit" ability, but was accessible to all players, even without patron.

2. Using GetLocalPlayer to change ownership, but creates desync.
 
Level 15
Joined
Aug 7, 2013
Messages
1,338
Well I know of a naive solution. If you're not strapped for computer players, you can just have a shared computer player for the unit. Then just use the native/trigger to set the unit's color to the color of the player you want.

Or does the unit have to be owned by one of the players?

In any case, there's a native that does it for you.
 
Level 8
Joined
Oct 12, 2011
Messages
483
Well I know of a naive solution. If you're not strapped for computer players, you can just have a shared computer player for the unit. Then just use the native/trigger to set the unit's color to the color of the player you want.

Or does the unit have to be owned by one of the players?

In any case, there's a native that does it for you.

I was thinking of using that, but it would limit the maximum number of players to 7, with no computer players.
 
Level 15
Joined
Aug 7, 2013
Messages
1,338
Well in any case I believe a unit must have an owner.

Besides rolling your own unit order system, I do not know another way to do this. But my knowledge is limited, so hopefully someone else can provide insight into this.
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
Is it retaining the original owners name when highlighted or is it changing to the new owner but retaining color? if it needs to retain the original owners name then I think the following will work for you.

Have a hashtable of all units being shared. give player A and B full control of each other's units and just force them to deselect units that are not "shared".

Or
If the owners name is not important and you could have a single computer player and grant and deny vision of its units to the necessary players and upon selection change ownership to the triggering player

Or

Maybe for each shareable unit, you have two units, when player A selects player Bs unit, hide. B's and unhide A's grant and deny vision as necessary.

I think I have rambled a little too much but hopefully my ideas work or spark your own.
 
Level 25
Joined
May 11, 2007
Messages
4,650
In the Editor, can't you just use one of the Player Hostile, Player Neutral, Player Victim, Player Extra and then give them shared control to the players with their team colour set?
Players.png


You will probably need to tweak alliance settings, etc for all players but it should work.
 
Level 8
Joined
Oct 12, 2011
Messages
483
Is it retaining the original owners name when highlighted or is it changing to the new owner but retaining color? if it needs to retain the original owners name then I think the following will work for you.

Have a hashtable of all units being shared. give player A and B full control of each other's units and just force them to deselect units that are not "shared".

Or
If the owners name is not important and you could have a single computer player and grant and deny vision of its units to the necessary players and upon selection change ownership to the triggering player

Or

Maybe for each shareable unit, you have two units, when player A selects player Bs unit, hide. B's and unhide A's grant and deny vision as necessary.

I think I have rambled a little too much but hopefully my ideas work or spark your own.

I do want to retain the Player name when highlighted, but the problem is that deselecting a unit has a short delay, and I don't want the other player getting in any orders in that time.

In the Editor, can't you just use one of the Player Hostile, Player Neutral, Player Victim, Player Extra and then give them shared control to the players with their team colour set?
Players.png


You will probably need to tweak alliance settings, etc for all players but it should work.

This was suggested by sethmachine with computers as well, but I want to leave this as a last resort, as it would limit my number of players to 7
 
Level 11
Joined
Nov 15, 2007
Messages
800
The only workable system as already stated is having every player given a computer controlled counterpart for the shared unit - which still wouldn't be MUI assuming multiple players will be able to control a single player's units. I.E. if both player 2 and player 3 control one of player 1's units, they'd both be able to control both units.

Sharing all units and deselecting ones that aren't tagged as being shared wouldn't work either, because the selection event has a delay meaning you'd still have time to issue an order before the unit is forcibly deselected.
 
Status
Not open for further replies.
Top