• 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.

Odd request - Switching units to another team

Status
Not open for further replies.
Level 3
Joined
Jan 30, 2009
Messages
26
What I'd like to do is be able to switch units to another team during an acutal game. What I'm looking to do is be able to produce my own units and if I need/want to be able to have them switch sides and join another team. Is this possiable? Thank you.
 
Level 11
Joined
May 11, 2008
Messages
830
would it have to be a custom ability?

No it could simply just by entering a Circle of Power for example. You could use a custom ability if you want.

I'm sure you know that there's a trigger called Unit- Change Owner.

You'll be needing that and possibly a Unit variable to make sure that it doesn't lag.

If you want a bunch of units to change team however, it requires some advanced triggers.

Well for the single unit what you can do is this.

  • SwitchTeam
    • Events
      • Unit - A unit comes within 1.00 of Circle of Power 0121 <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Actions
      • Unit - Change ownership of (Triggering unit) to Player 2 (Blue) and Change color
Now that's just the simple way of doing it. I am not sure if this can cause leaks or not.
 
Level 11
Joined
Nov 15, 2007
Messages
800
For all intents and purposes, unit leaks (that can be prevented/fixed) do not exist, so do whatever you want with units. It's groups and locations you have to watch out for mostly.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
They do and I have tested them. Unless a patch was released in the last year and a bit which solved them they should still exist.

Creating a location, group, trigger or force and removing it resulted in no noticable memory increase.

Creating a unit and removing it via any means resulted in a continious linear memory increase.

Testing was done in windowed mode with camera locked and repeated atleast 3 times with different code configurations that produced the same results.
 
Level 3
Joined
Jan 30, 2009
Messages
26
Thanks for the help. I did the circle of power but how would I make it an ability? I don't know much about triggers and the like. I've been trying to customize possession to make it work but I can't seem to do it.
 
Level 15
Joined
Jul 6, 2009
Messages
889
You'll need a spell with no target, such as Roar or Channel.

The trigger should look like this:

  • ChangeTeam
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Change Team
    • Actions
      • Unit - Change ownership of (Triggering unit) to Player 2 (Blue) and Change color
So when the unit casts the ability, voila, they change teams. That's the basics of it.
 
Level 11
Joined
Nov 15, 2007
Messages
800
They do and I have tested them. Unless a patch was released in the last year and a bit which solved them they should still exist.

Creating a location, group, trigger or force and removing it resulted in no noticable memory increase.

Creating a unit and removing it via any means resulted in a continious linear memory increase.

Testing was done in windowed mode with camera locked and repeated atleast 3 times with different code configurations that produced the same results.



For all intents and purposes, unit leaks (that can be prevented/fixed) do not exist, so do whatever you want with units. It's groups and locations you have to watch out for mostly.

^ I know that.
 
Status
Not open for further replies.
Top