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

How to make a hero swapping spell between different players?

Status
Not open for further replies.
How to make this kind of spell? I have a problem with switching the player id of each player.
Thanks a lot.

What do you mean switching the player id of each player?
This doesn't work?

  • Actions
    • Unit - Change ownership of (Target unit of ability being cast) to (Owner of (Triggering unit)) and Change color
    • Unit - Change ownership of (Triggering unit) to (Owner of (Target unit of ability being cast)) and Change color
 
Level 11
Joined
Oct 11, 2012
Messages
711
What do you mean switching the player id of each player?
This doesn't work?

  • Actions
    • Unit - Change ownership of (Target unit of ability being cast) to (Owner of (Triggering unit)) and Change color
    • Unit - Change ownership of (Triggering unit) to (Owner of (Target unit of ability being cast)) and Change color

After the creation of each hero, I store it in a unit array. Moreover, all my spells are made based on that array, such as the damage of the spell. After the swapping, it seems that array is unchanged and all my triggered spells do not work. :(
I do not know how to fix this.....
 
After the creation of each hero, I store it in a unit array. Moreover, all my spells are made based on that array, such as the damage of the spell. After the swapping, it seems that array is unchanged and all my triggered spells do not work. :(
I do not know how to fix this.....

You can try something like this

  • Actions
    • Set HeroArray[(Player Number of (Target unit of ability being cast))] = (Triggering unit)
    • Set HeroArray[(Player Number of (Triggering Unit))] = (Target unit of ability being cast)
    • Unit - Change ownership of (Target unit of ability being cast) to (Owner of (Triggering unit)) and Change color
    • Unit - Change ownership of (Triggering unit) to (Owner of (Target unit of ability being cast)) and Change color
You could also store (Triggering Unit) and (Target unit of ability being cast) in the beginning of the trigger to avoid so many function calls.
 
Level 11
Joined
Oct 11, 2012
Messages
711
You can try something like this

  • Actions
    • Set HeroArray[(Player Number of (Target unit of ability being cast))] = (Triggering unit)
    • Set HeroArray[(Player Number of (Triggering Unit))] = (Target unit of ability being cast)
    • Unit - Change ownership of (Target unit of ability being cast) to (Owner of (Triggering unit)) and Change color
    • Unit - Change ownership of (Triggering unit) to (Owner of (Target unit of ability being cast)) and Change color
You could also store (Triggering Unit) and (Target unit of ability being cast) in the beginning of the trigger to avoid so many function calls.
Thanks a lot.
Could you switch that trigger into context or Jass? I am using the following, which does not work:
JASS:
 set udg_HeroOwner[GetUnitPointValue(udg_Swap_Hero[1])]=GetConvertedPlayerId(udg_Swap_Player[2])
I have been working on this all day -_-

Edit:
I think you are right, im working on it now...
 
Status
Not open for further replies.
Top