In the unit flags turn off "Cannot be clicked" then use a trigger on event "Unit is Clicked" to change the owner to the triggering player. That's the simple solution.
A more complex solution is to give your units a "claim neutral" ability of type effect-target, flag it as smart, set up smart validators to check that the unit is claimable, and have the effect apply a permanent behavior that sets the owner to the casting player (Player field under buff behavior.) You can also set a range and cast time when using this method.
The whole triggers page confuses the living hell out of me =(, would someone be nice enough to give me a list of what to click or a general idea where in triggers?
Edit - Found unit is clicked, Built-In - Selection - Clicks and Highlights - Unit is clicked
As of right now, I've gotten my units to be able to claim the clickable unit, however when they claim it, an extra command center spawns at my start point.
Also I have an error when I start up the game
Error is
Trigger Error in 'gt_MeleeInitialization_Func': Event response function 'EventUnit' has no matching event
Finally, when the unit is claimed, its only claimed to player one. I want other players to be able to access it as well, but for now its only going to player 1.
I think I'd know a way, but right now I can only explain my idea and not how to do it in triggers.
So, say that you first set a global variable of a player/player group so that whatever player is in this variable gains control of the neutral unit.
Then, whenever a unit enters a certain distance to the neutral unit, you give control to that player as long as there are no other players in the player group variable. Finally, you could set some kind of either 'unit leaves range of unit' or whatever trigger (or even an ability) to set the unit back to neutral when the player is done with it. The specific use of this kind of trigger would determine what would be the best to use.
Well the basics of my idea is: 3v3 map, 2 levels off the ground, 3 allies bases connected, ramps down into the larger middle area, block off areas of the map with -1 ground level, constant fight to upper middle to destroy a lot of destructible debris to reach the 'godzilla-ish' neutral unit. Team that secures the unit basically wins.
I thought the idea would be interesting considering you'd have to have forces constantly on the debris and trying to hold off the other team from killing your units destroying the debris.
Well the way I described would allow you to have each player have a chance to use the neutral unit. I don't see the need for all the complexity if all the neutral unit does is win the game for you.
I toyed with it a bit, I tried it at 1.0 and from my base it still activated, a decent distance, I tried 0.1 and it activated from that same distance, and tried 50 just to see and it obviously activated, but it also spawned abour 30 extra hatcherys in my base..
Okay, I set it to owner of unit, that fixed the range problem.
However, now I have an error.. it says
'gt_MeleeInitialization_func' Parameter out of bounds in 'unitsetowner' [value 16, min 0, max 15]
Also I sent my 6 drones to go get the unit and it seems when they interacted with the neutral unit, it spawned 3 more hatcherys in my base, and I right clicked on the neutral unit with a drone and it spawned another hatchery..
First off, why did you just smash your trigger and the melee game initialization trigger together? You probably don't want the melee initialization trigger and even if you do, you have to make a new trigger for the monster changing ownership.
Other than that, your trigger should be fine. That melee initialization is probably just screwing it up.
I've been trying for a couple days on getting a neutral unit to 'become mine' when I right click on him with a unit.
Such as, you find a neutral unit out in the world, and you have your unit right click it, and it becomes a part of your team.
Or if there is any other way to make it become part of your team, that works too. This has been killing me, help please? =)
In the unit flags turn off "Cannot be clicked" then use a trigger on event "Unit is Clicked" to change the owner to the triggering player. That's the simple solution.
A more complex solution is to give your units a "claim neutral" ability of type effect-target, flag it as smart, set up smart validators to check that the unit is claimable, and have the effect apply a permanent behavior that sets the owner to the casting player (Player field under buff behavior.) You can also set a range and cast time when using this method.
@RileyStarcraft: Go
The whole triggers page confuses the living hell out of me =(, would someone be nice enough to give me a list of what to click or a general idea where in triggers?
Edit - Found unit is clicked, Built-In - Selection - Clicks and Highlights - Unit is clicked
Im stuck here now >.>
Event: Unit is Clicked
Action: Change Owner
Editing to remove irrelavent information...
As of right now, I've gotten my units to be able to claim the clickable unit, however when they claim it, an extra command center spawns at my start point.
Also I have an error when I start up the game
Error is Trigger Error in 'gt_MeleeInitialization_Func': Event response function 'EventUnit' has no matching event
Finally, when the unit is claimed, its only claimed to player one. I want other players to be able to access it as well, but for now its only going to player 1.
@Durga: Go
bump.. post moved not on first page =(
I think I'd know a way, but right now I can only explain my idea and not how to do it in triggers.
So, say that you first set a global variable of a player/player group so that whatever player is in this variable gains control of the neutral unit.
Then, whenever a unit enters a certain distance to the neutral unit, you give control to that player as long as there are no other players in the player group variable. Finally, you could set some kind of either 'unit leaves range of unit' or whatever trigger (or even an ability) to set the unit back to neutral when the player is done with it. The specific use of this kind of trigger would determine what would be the best to use.
@Shawn91210: Go
Well the basics of my idea is: 3v3 map, 2 levels off the ground, 3 allies bases connected, ramps down into the larger middle area, block off areas of the map with -1 ground level, constant fight to upper middle to destroy a lot of destructible debris to reach the 'godzilla-ish' neutral unit. Team that secures the unit basically wins.
I thought the idea would be interesting considering you'd have to have forces constantly on the debris and trying to hold off the other team from killing your units destroying the debris.
Well the way I described would allow you to have each player have a chance to use the neutral unit. I don't see the need for all the complexity if all the neutral unit does is win the game for you.
Its not for each player to take turns with, the objective of the map is to get to that unit, claim it for yourself, and go wipe out the 3 enemy bases.
@Durga: Go
Well then just set it so that if a unit comes into a certain range, set that unit's owner as the owner of the neutral unit. Yes?
I'm new to the sc2 editor, but if you'd be willing to tell me how to do it / walk me through it, that'd mighty fine of you, sir =)
Something like this:
And then if you have any computer players on the map, you would set it so the computer couldn't take control of the unit.
@Shawn91210: Go
Okay, I've got... Event - Any unit enters a distance of 1.0 from Queen - Queen
Action - Change ownership of (triggering unit) to player 1 and change color
Do I need to specify the action somehow? Seems like it won't know to trigger the queen to me..
Edit - Retested, made the triggering unit the queen. But it seems the queen becomes controllable from quite some distance.. I have it set at 1
@Durga: Go
Well just lower the distance to whatever you like. Play around with it and see what works best. That's half the fun of making a map. ;)
@Shawn91210: Go
I toyed with it a bit, I tried it at 1.0 and from my base it still activated, a decent distance, I tried 0.1 and it activated from that same distance, and tried 50 just to see and it obviously activated, but it also spawned abour 30 extra hatcherys in my base..
@Durga: Go
Really? There is a problem that I'm not seeing then..
I just used that exact code in a test and it worked perfectly and i had to run right up to the unit.
@Shawn91210: Go
Okay, I set it to owner of unit, that fixed the range problem. However, now I have an error.. it says
'gt_MeleeInitialization_func' Parameter out of bounds in 'unitsetowner' [value 16, min 0, max 15]
Also I sent my 6 drones to go get the unit and it seems when they interacted with the neutral unit, it spawned 3 more hatcherys in my base, and I right clicked on the neutral unit with a drone and it spawned another hatchery..
I uploaded the map, if you wnt to take a look
@Durga: Go
First off, why did you just smash your trigger and the melee game initialization trigger together? You probably don't want the melee initialization trigger and even if you do, you have to make a new trigger for the monster changing ownership.
Other than that, your trigger should be fine. That melee initialization is probably just screwing it up.
@Shawn91210: Go
Where should I put it otherwise?