I'm trying to find some way so that when player 1 has a Barracks selected, he can train Marines, but not Marauders and vice versa for Player 2 (can not build Marines, but can build Marauders) While the Interact ability allows for both players to build from the Barracks, you can only build units based on whoever owns the Barracks and not based on who is trying to use it (ie: If player 1 owns the Barracks, both Player 1 and Player 2 can build Marines. If Player 2 owns the Barracks, both Player 1 and Player 2 can build Marauders). Not to mention, this has another problem that I haven't been able to solve of allowing Player 1 and Player 2 to build from enemy Barracks, which is highly unwanted.
I'm now assuming that this can't be done in the Data Editor and am looking for a trigger solution. Is there any way to manipulate the command card with triggers or will I need to use dialog buttons for this? I'm a dialog button noob, so if I use dialog buttons, can you arrange them in a way where it appears that they're on the command card even if they're not explicitly attached to the command card? Or if anyone has an alternative I haven't considered, I'm all ears.
Well, this is a hasty solution to your problem, but have you considered duplicating the barracks?
I.E:
Barracks Type 1 can only produce marines
Barracks Type 2 can only produce marauders
etc...
And then you change the barracks according to which players owns it. If it's player 1, then you replace the building with a Type 1, if it's player 2, well you get the point !
Yeah, I considered alternatives with multiple Barracks, though I couldn't see how to get that behavior to work when both Player 1 and Player 2 are selecting the Barracks at the same time, especially given at the beginning of the game, all Players will be using the Barracks and there can be up to 5 players using a Barracks at a time (To simplify the original post, I only mentioned two players).
Why don't you put a usage/show requirement on the barracks individual abilities?
Say, for example,
train marine has the requirement Blank Upgrade 01 completed
while
train marauder has the requirement Blank Upgrade 02 completed
And then at the start of the map, set Blank Upgrade 01 level to 1 for player 1
and Blank Upgrade 02 level to 1 for player 2.
Just to be clear, though, that requires the building to be selected by only one player a time. But then how is it even possible that single building is controlled by multiple players at the exact same instant?
I tried this, however, the ability requirements depends on the owner of the Barracks and not the person who is trying to use the ability. This is what led to the situation I described in the first post where if Player 1 owns the Barracks, both players can train Marines, but not Marauders and when Player 2 owns the Barracks, both players can train Marauders, but not Marines.
In order to allow multiple people to use the Barracks, I gave the Barracks an interact ability so that everyone nearby can use it. With 5 players who may be trying to use the Barracks simultaneously, I don't think switching control of the Barracks to one player at a time would work for this.
edit (59 minutes after post): hmm.. I wonder if I can create an invisible unit for every player, which would have the same radius as the Barracks and and be located on top of the Barracks. Then I could make a trigger so that when a player selects the Cerebrate, it will select the invisible unit instead. I can transfer the upgrades over to the invisible unit and because everyone has their own copy of it, the Upgrade thing would work.
So, I did manage to found one possible solution:
Create an ability launching a dummy effect (Cf. Riley's tutorial on effect hook).
Make it so that your Barrack has only one button linked to this dummy effect/ability, and then use the following Trigger:
(In my example I used the scan sweep of an other building, as I was too lazy to create the dummy ability :p).
This will launch the creation of the marauder. The added resources should also be subtracted from the player calling the trigger. Note that if you don't add those resources to the player owning the barrack, the training will not launch! You also should manage supply in the same light.
The trained Marauder will be owned by the owner of the barrack, but you can change that with the following:
make 2 dummy buildings invisible right on top of the barracks. each one owned by each player and can build w/e units you want.
make dummy buildings flagged 'unselectable'
trigger when you select neutral building it autoselects the appropriated invisible actor building you made unselectable (triggers will select it, though you cant click / drag select it)
make the selection radius equal to the neutral building. so when it autoselects your dummy building it appears you have the neutral building selected.
i hate triggers, but its a workaround. i see no problem why this wouldn't work. sorry to suggest such a barbaric method, but itll get you there i beleive.
@Moooyaah:
I recall reading the tutorial on hooks, but at the time I didn't really understand their use. I'll have to go back and look at it again.
@ezybeats:
This is the solution that I started considering last night. If the hook method can't be implemented for some unforeseeable reason, this is probably what I'll end up doing.
I have a final exam tonight, so I probably won't be able to implement anything until tomorrow, I'll let you know how it goes then!
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I'm trying to find some way so that when player 1 has a Barracks selected, he can train Marines, but not Marauders and vice versa for Player 2 (can not build Marines, but can build Marauders) While the Interact ability allows for both players to build from the Barracks, you can only build units based on whoever owns the Barracks and not based on who is trying to use it (ie: If player 1 owns the Barracks, both Player 1 and Player 2 can build Marines. If Player 2 owns the Barracks, both Player 1 and Player 2 can build Marauders). Not to mention, this has another problem that I haven't been able to solve of allowing Player 1 and Player 2 to build from enemy Barracks, which is highly unwanted.
I'm now assuming that this can't be done in the Data Editor and am looking for a trigger solution. Is there any way to manipulate the command card with triggers or will I need to use dialog buttons for this? I'm a dialog button noob, so if I use dialog buttons, can you arrange them in a way where it appears that they're on the command card even if they're not explicitly attached to the command card? Or if anyone has an alternative I haven't considered, I'm all ears.
@Azkit: Go
Well, this is a hasty solution to your problem, but have you considered duplicating the barracks? I.E:
And then you change the barracks according to which players owns it. If it's player 1, then you replace the building with a Type 1, if it's player 2, well you get the point !
Yeah, I considered alternatives with multiple Barracks, though I couldn't see how to get that behavior to work when both Player 1 and Player 2 are selecting the Barracks at the same time, especially given at the beginning of the game, all Players will be using the Barracks and there can be up to 5 players using a Barracks at a time (To simplify the original post, I only mentioned two players).
@Azkit:
Why don't you put a usage/show requirement on the barracks individual abilities?
Say, for example,
train marine has the requirement Blank Upgrade 01 completed
while
train marauder has the requirement Blank Upgrade 02 completed
And then at the start of the map, set Blank Upgrade 01 level to 1 for player 1
and Blank Upgrade 02 level to 1 for player 2.
Just to be clear, though, that requires the building to be selected by only one player a time. But then how is it even possible that single building is controlled by multiple players at the exact same instant?
@xenrathe:
I tried this, however, the ability requirements depends on the owner of the Barracks and not the person who is trying to use the ability. This is what led to the situation I described in the first post where if Player 1 owns the Barracks, both players can train Marines, but not Marauders and when Player 2 owns the Barracks, both players can train Marauders, but not Marines.
In order to allow multiple people to use the Barracks, I gave the Barracks an interact ability so that everyone nearby can use it. With 5 players who may be trying to use the Barracks simultaneously, I don't think switching control of the Barracks to one player at a time would work for this.
edit (59 minutes after post): hmm.. I wonder if I can create an invisible unit for every player, which would have the same radius as the Barracks and and be located on top of the Barracks. Then I could make a trigger so that when a player selects the Cerebrate, it will select the invisible unit instead. I can transfer the upgrades over to the invisible unit and because everyone has their own copy of it, the Upgrade thing would work.
@Azkit: Go
So, I did manage to found one possible solution: Create an ability launching a dummy effect (Cf. Riley's tutorial on effect hook). Make it so that your Barrack has only one button linked to this dummy effect/ability, and then use the following Trigger:
(In my example I used the scan sweep of an other building, as I was too lazy to create the dummy ability :p).
This will launch the creation of the marauder. The added resources should also be subtracted from the player calling the trigger. Note that if you don't add those resources to the player owning the barrack, the training will not launch! You also should manage supply in the same light.
The trained Marauder will be owned by the owner of the barrack, but you can change that with the following:
I do not guarantee the bug free coding, but It should get you started !
a cheesy workaround;
make the barracks;
make 2 dummy buildings invisible right on top of the barracks. each one owned by each player and can build w/e units you want.
make dummy buildings flagged 'unselectable'
trigger when you select neutral building it autoselects the appropriated invisible actor building you made unselectable (triggers will select it, though you cant click / drag select it)
make the selection radius equal to the neutral building. so when it autoselects your dummy building it appears you have the neutral building selected.
i hate triggers, but its a workaround. i see no problem why this wouldn't work. sorry to suggest such a barbaric method, but itll get you there i beleive.
@Moooyaah:
I recall reading the tutorial on hooks, but at the time I didn't really understand their use. I'll have to go back and look at it again.
@ezybeats:
This is the solution that I started considering last night. If the hook method can't be implemented for some unforeseeable reason, this is probably what I'll end up doing.
I have a final exam tonight, so I probably won't be able to implement anything until tomorrow, I'll let you know how it goes then!