How to Make the Heroes Revert Back

Dymetreus

New Member
Reaction score
1
A friend of mine has made a map which has a very detailed boss fight which includes switching the heroes around. There will be up to 7 heroes, and they shall be switched around randomly with their heroes. In other words, Player 1 may get Player 2's hero, or he may get Player 3 or 4's.

They shall be reverted back to their old state, each player getting their old hero back after the fight is done. But how can this be accomplished through triggers? Me and my friend thought if each one was saved and made into a variable and the actions would refer to those saved variables to get those heroes back. But we wouldn't know how to do that if there is a path to do it that way.

All help is appreciated.
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
Trigger:
  • Return Owner
    • Events
      • Unit - A unit Changes owner
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Custom script: local player PrevOwner = GetChangingUnitPrevOwner()
      • Wait until (BossFightOver Equal to True), checking every 3.00 seconds
      • Trigger - Turn off (This trigger)
      • Custom script: call SetUnitOwner( GetTriggerUnit(), PrevOwner, true )
      • Trigger - Turn on (This trigger)
      • Custom script: set PrevOwner = null


All you need is to use the normal Change Owner action, and a boolean variable BossFightOver. This should be initially False, then set to True when the boss fight ends. The Wait interval can be shorter or longer, but is 3.00 seconds for optimum efficiency and delay. You might also want to select and pan cameras for the changed units.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top