So this sort of plays off an earlier post I made regarding hero respawns. Storing the player and hero information in the local variables using the event "Any unit dies" then creating the local variables using "owner of dying unit" and "triggering unit"
But here is the dilemma.
Lets say you have a hero with a mind control ability similar to Nova's domination. It uses a behavior that changes the owner of unit to the unit which cast the mind control ability. It has a limited duration, around 5 seconds. So it eventually goes back to the original owner.
There is a similar ability in League of Legends I believe.
Here is tricky part, at least for me. How can I, outside of using a bunch of global variables, or an insane # of triggers, create a situation in which the mind controlling unit gains control of the unit and all its abilities without actually being its owner.
Being the owner of the unit causes problems for trigger respawns. If the mind controlled unit dies, it would respawn for the unit that mind controlled it. But what you want is for the unit to die and then respawn for the original owner. This won't work using local variables since the dying unit is referenced as being owned by the player who mind controlled it. Likewise, if it died, the player who mind controlled it should get credit for the kill. But that wouldn't happen either, instead, the player who get penalized.
As you can see this game mechanic causes all sorts of problems.
Unit groups of heroes for both teams, check to see what unit group it is in. As for the mind control issue, create an array for unit variables with size = # of players. When each player selects/gets a hero, set playerunit[player] = unit. Then you just simply check which unit in the array it is, and if it matches you revive it for that player.
But how would you set the kill announcement and penalty for the proper player. If you use "Pick each integer loop" its easy to find the original owner of the hero and respawn him, but when the hero dies, while being mind controlled, the player who mind controlled him would still be penalized and also not get credit for the kill if someone else killed him.
I want to create it so the player who mind controlled him, would get credit for the kill and the appropriate compensation.
I'm sorry I've been trying to do this with player teams and variables but I just don't understand it. The problem is, even if you store all the required information in arrays or check the player teams, when you go to respawn the hero, you still have to use, create 1 hero for player "Owner of Hero". The last owner when the hero died was the person who mind controlled the hero. The only way to get this to work is to reference the original owner information, and I'm just having trouble figuring it out.
EventsUnit-AnyUnitdiesLocalVariablestimer=(Newtimer)<Timer>DeadHero=(Unittypeof(Triggeringunit))<GameLink-Unit>ConditionsActionsGeneral-Pickeachintegerfrom1to13,anddo(Actions)ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)If(Triggeringunit)==HeroArray[(Pickedinteger)]ThenUI-Display((Text(Nameofplayer(Ownerof(Killingunit)))withcolor(Color((Currentplayer(Ownerof(Killingunit))color))))+(" has killed "+(Text(NameofplayerOwnerofHeroArray[(Pickedinteger)])withcolor(Color((CurrentplayerOwnerofHeroArray[(Pickedinteger)]color))))))for(Allplayers)toChatareaUI-Display("You have been killed! You have lost..."+((Text(((PlayerOwnerofHeroArray[(Pickedinteger)]Minerals)/6)))+(" minerals and…"+((Text(((PlayerOwnerofHeroArray[(Pickedinteger)]Vespene)/6)))+" gas."))))for(Playergroup(OwnerofHeroArray[(Pickedinteger)]))toSubtitleareaPlayer-ModifyplayerOwnerofHeroArray[(Pickedinteger)]Minerals:Subtract((PlayerOwnerofHeroArray[(Pickedinteger)]Minerals)/6)Player-ModifyplayerOwnerofHeroArray[(Pickedinteger)]Vespene:Subtract((PlayerOwnerofHeroArray[(Pickedinteger)]Minerals)/6)Variable-ModifyDeathCounterArray[(Pickedinteger)]:+3Dialog-SetHealthBarsizeto(1,15)for(Playergroup(OwnerofHeroArray[(Pickedinteger)]))Dialog-SetShieldBarsizeto(1,18)for(Playergroup(OwnerofHeroArray[PickedInteger]))Dialog-SetEnergyBarsizeto(1,18)for(Playergroup(OwnerofHeroArray[(Pickedinteger)]))Timer-Createatimerwindowfortimer,withthetitle((Nameofplayer(Ownerof(Triggeringunit)))+(" "+((Text(TutorialChoiceArray[(Pickedinteger)]))+" Respawning in…"))),usingRemainingtime(initiallyVisible)Timer-StarttimerasaOneShottimerthatwillexpireinDeathCounterArray[(Pickedinteger)]RealTimesecondsTimer-Anchor(Lastcreatedtimerwindow)totheBottomLeftofthescreen,offsetby(0,0)General-WaitDeathCounterArray[(Pickedinteger)]RealTimesecondsCheckTeamandRespawnherofromtheArrayonappropriateteam!
Okay! I think I made progress from my last post! I updated this code but I'm still having one problem. The hero respawns correclty and the original owner is punished appropriately by losing money, but the owner of the killing unit, regardless of who kills the unit still gains money from a seperate trigger. (I know they should be in the same one) Anyway, just trying to wrestle through how I can make it so allied players on the same team as the mind controlled unit do not gain money by killing their own teammate while he/she is mind controlled.
Like I said, add the heroes into unit groups for each team, if the killing unit is in the same team as the killed unit, do not award money, if not on the same team, award money.
Unit in unit group, if ((killed unit) is in team 1 unit and (attacking unit) is in team 1 units) or ((killed unit) is in team 2 unit and (attacking unit) is in team 2 units)
then don't give money else give money
Just wanted to thank you for the help. The problem seems to be fixed! I had to do some digging turns out there was another issue as well preventing it from working, but the triggers are working perfectly.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
So this sort of plays off an earlier post I made regarding hero respawns. Storing the player and hero information in the local variables using the event "Any unit dies" then creating the local variables using "owner of dying unit" and "triggering unit"
But here is the dilemma.
Lets say you have a hero with a mind control ability similar to Nova's domination. It uses a behavior that changes the owner of unit to the unit which cast the mind control ability. It has a limited duration, around 5 seconds. So it eventually goes back to the original owner.
There is a similar ability in League of Legends I believe.
Here is tricky part, at least for me. How can I, outside of using a bunch of global variables, or an insane # of triggers, create a situation in which the mind controlling unit gains control of the unit and all its abilities without actually being its owner.
Being the owner of the unit causes problems for trigger respawns. If the mind controlled unit dies, it would respawn for the unit that mind controlled it. But what you want is for the unit to die and then respawn for the original owner. This won't work using local variables since the dying unit is referenced as being owned by the player who mind controlled it. Likewise, if it died, the player who mind controlled it should get credit for the kill. But that wouldn't happen either, instead, the player who get penalized.
As you can see this game mechanic causes all sorts of problems.
Unit groups of heroes for both teams, check to see what unit group it is in. As for the mind control issue, create an array for unit variables with size = # of players. When each player selects/gets a hero, set playerunit[player] = unit. Then you just simply check which unit in the array it is, and if it matches you revive it for that player.
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)
@willuwontu: Go
@willuwontu: Go
But how would you set the kill announcement and penalty for the proper player. If you use "Pick each integer loop" its easy to find the original owner of the hero and respawn him, but when the hero dies, while being mind controlled, the player who mind controlled him would still be penalized and also not get credit for the kill if someone else killed him.
I want to create it so the player who mind controlled him, would get credit for the kill and the appropriate compensation.
@onlyleviathan: Go
I'm sorry I've been trying to do this with player teams and variables but I just don't understand it. The problem is, even if you store all the required information in arrays or check the player teams, when you go to respawn the hero, you still have to use, create 1 hero for player "Owner of Hero". The last owner when the hero died was the person who mind controlled the hero. The only way to get this to work is to reference the original owner information, and I'm just having trouble figuring it out.
@onlyleviathan: Go
Okay! I think I made progress from my last post! I updated this code but I'm still having one problem. The hero respawns correclty and the original owner is punished appropriately by losing money, but the owner of the killing unit, regardless of who kills the unit still gains money from a seperate trigger. (I know they should be in the same one) Anyway, just trying to wrestle through how I can make it so allied players on the same team as the mind controlled unit do not gain money by killing their own teammate while he/she is mind controlled.
Like I said, add the heroes into unit groups for each team, if the killing unit is in the same team as the killed unit, do not award money, if not on the same team, award money.
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)
@willuwontu: Go
Thanks for the help I do appreciate it. What Comparison Type would you use?
Player in Player group? I understand the concept, I think I'm just not sure which functions to use to carry it out.
Unit in unit group, if ((killed unit) is in team 1 unit and (attacking unit) is in team 1 units) or ((killed unit) is in team 2 unit and (attacking unit) is in team 2 units) then don't give money else give money
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)
@willuwontu: Go
I've tried this.... Still not working.... Not sure where I've gone wrong.
Try this
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)
@willuwontu: Go
Just wanted to thank you for the help. The problem seems to be fixed! I had to do some digging turns out there was another issue as well preventing it from working, but the triggers are working perfectly.