• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

GetConvertedPlayerId?

Status
Not open for further replies.
Level 3
Joined
Jul 26, 2008
Messages
58
This problem occured when I was trying to make Anachron's Inventory System to work. The problem is that: for example, after certain actions of Player 1, the trigger is used to Player 2 instead of Player 1, and as well, when Player 2 makes an action, trigger action is used to Player 3 and so on. The trigger itself:
  • Events:
  • Unit - A unit starts the effect of an ability
    • Conditions:
  • (Unit-type of (Triggering unit)) equal to X
    • Or - Any (Conditions) are true:
      • (Ability being cast) equal to Y
      • (Ability being cast) equal to Z
      • (Ability being cast) equal to C
    • Actions:
  • Custom script: local unit fakeInv = null
  • Custom script: local unit hero = null
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Ability being cast) equal to Y
    • Then - Actions
      • Custom script: set fakeInv = CreateInventoryUnit(Player(GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))), 'h000')
      • Custom script: set hero = CreateUnit(Player(GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))), 'H00B', 0., 0., 0.)
      • Custom script: call CreateInventoryUI(hero, fakeInv)
So, it works perfect, BUT... Just for the NEXT player, not for current. What's messed up with it?
 
Goddamnit, after reading your post, I realised that I tried to make [Inventory unit - 1] before, not [Player - 1] >_<
So thanks, you've guided my way :)
 
JASS:
CreateUnit(Player(GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))), 'H00B', 0., 0., 0.)

This is so bad it's good XD

JASS:
CreateUnit(GetTriggerPlayer(), 'H00B', 0., 0., 0.)

GetSpellAbilityUnit() is best as GetTriggerUnit(), but for every spell-trigger you make, "Owner of Triggering Unit" can ALWAYS be substituted for "Triggering Player". Therefore, instead of converting the player from the player id from the owner of the triggering unit (whyyyyy did you do it like that?), you just use GetTriggerPlayer().

Also, like Pharaoh said and you found, you used GetConvertedPlayerId() in your JASS code to return the player, so you actually blocked yourself on that one. You return Player 2(Blue) if you use that method when Player 1(Red)'s unit casts a spell.
 
Status
Not open for further replies.
Back
Top