Hero Steal?

-=Swift=-

New Member
Reaction score
2
I am trying to make a new custom hero that can steal control of a Hero as his ultimate, like the banshee possession. But I want it only for like 30 Seconds then the hero switches back. During the time of the hero possession he gets the level and can learn all the skills himself.. Think that Is possible? I know it is but how?
 
G

Gojhin

Guest
well. you'd want a random dummy spell that lasts 0 seconds, like faerie fire. then, make a trigger like this k? (if you need help understanding it I'll be on all day.)
Code:
EXAMPLE
    Events
        Unit - A unit Finishes casting an ability
    Conditions
        (((Target unit of ability being cast) is A Hero) Equal to True) and ((Ability being cast) Equal to Faerie Fire)
    Actions
        Unit - Change ownership of (Target unit of ability being cast) to (Owner of (Casting unit)) and Change color
        Wait 30.00 seconds
        Unit - Change ownership of (Target unit of ability being cast) to (Previous owner) and Change color
 

MoonSlinger

I Love using Cheap Tricks... only Results matters
Reaction score
74
If it is simply taking over control of units, then I would suggest to change unit owner. However, since you are going to take over a HERO, that would be very different. You need to take into consideration the items held, skills learn and such.

I would suggest you "hide" the target Hero, then create a new Hero of the same type, same amount of exp, duplicate items, in its place. When the time is up, just replace the "Possessed Hero" and destroy all duplicate items.

You need:
Item variable array of 6 StolenItems[6]
Unit variable StolenHero
Unit variable MissingHero

Steps:
- Create a new Hero in place of the possessed Hero
- Set the new Hero's Health/Mana/Experience to the correct value
- Hide the possessed Hero
- Replicate the items

Code:
Untitled Trigger 001
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Animate Dead
    Actions
        -------- Replace Hero --------
        Set MissingHero = (Target unit of ability being cast)
        Set TempPosition = (Position of MissingHero)
        Unit - Create 1 (Unit-type of MissingHero) for (Owner of (Triggering unit)) at TempPosition facing (Facing of MissingHero) degrees
        Set StolenHero = (Last created unit)
        Hero - Set StolenHero experience to (Hero experience of MissingHero), Hide level-up graphics
        Unit - Set life of StolenHero to (Life of MissingHero)
        Unit - Set mana of StolenHero to (Mana of MissingHero)
        Unit - Hide MissingHero
        -------- Items --------
        For each (Integer A) from 1 to 6, do (Actions)
            Loop - Actions
                Item - Create (Item-type of (Item carried by MissingHero in slot (Integer A))) at TempPosition
                Set StolenItems[(Integer A)] = (Last created item)
                Hero - Give StolenItems[(Integer A)] to StolenHero

The above would give you a "replicate" of the "Possessed Hero", so you can learn any skills in whatever order. Next will be cleaning up, you need to remove all traces of what is done before.

Steps:
- Replace the newly create hero with the original one
- Destroy all replicated items, as to avoid "stealing"

Code:
        -------- Cleanup Hero --------
        Set TempPosition = (Position of StolenHero)
        Unit - Remove StolenHero from the game
        Unit - Move MissingHero instantly to TempPosition
        Unit - Unhide MissingHero
        -------- Cleanup Items --------
        For each (Integer A) from 1 to 6, do (Actions)
            Loop - Actions
                Item - Remove StolenItems[(Integer A)]

Lastly, what you have to do is simply remove leaks, and make it MUI or MPI (optional)
 

-=Swift=-

New Member
Reaction score
2
OKay you gusy are great filling my brain with knowledge. I understand perfectly the trigger Gojhin, and it is wonderful and I couldn't do anything better myself.. But what do I do with the casting hero? I don't want the user to have two heroes. How would I hide the Casting hero and have him using the targeted hero.. While keeping the Exp he earned using the targeted hero?? If that makes sense I'm kinda crazy lol.. :nuts: And the reason I don't use yours MoonSlinger is cuz that amke my brain hurt, and I don't need the items stolen so it just an extra time.. I appreciate the effert.. +REP

While I have your attention how I do I get it to where a hero uses an ability like, I dunno the one hero im talking about is using a varieation of tinkers ability, tinkers robo goblin not break stealth when using it.. Because what I am doing is the hero can switch from Bow to Sword and I want him to switch in stealth..
 
G

Gojhin

Guest
well. I would suggest going with moon slinger's idea (read it carefully and you should be able to understand it.) and then after than we can both help you out on the experience saving and what-not. but you should read his post so that we can help you further.

and, to your second question. you would want to simply make it so that when the unit changes from ranged to melee set the cooldown of the stealth ability to 0, and after he switches, cast the stealth. then, reset the cooldown on the spell to normal. does that make sense?
In game this would all happen instantaneously and you shouldn't be attacked or have a spell cast on you. the worst that might happen is that hostile units would look in your direction, but they would lose sight of you and it shouldn't effect you too much.
 

-=Swift=-

New Member
Reaction score
2
OKay your acting like I am a 5 year old with no expierence, tho I am not much better then that, I have to give myself some credit.. I understand his and It is just like yours but with some useless item stuff lol.. The only helpful difference is he uses a new hero and doing that tho causes more work with triggs adding exp. But I see I do need to use most of his to make this happen.

Okay so this what I have consieved so far and what I am using so far is...
Code:
Possession
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to FieryFire
    Actions
        Set MissingHero = (Target unit of ability being cast)
        Set TempPosition = (Position of MissingHero)
        Unit - Create 1 (Unit-type of MissingHero) for (Owner of (Triggering unit)) at TempPosition facing (Facing of MissingHero) degrees
        Set StolenHero = (Last created unit)
        Hero - Set StolenHero experience to (Hero experience of MissingHero), Hide level-up graphics
        Unit - Set life of StolenHero to (Life of MissingHero)
        Unit - Set mana of StolenHero to (Mana of MissingHero)
        Unit - Hide MissingHero
Now I need a Trigger to hide the Triggering Unit when the spell is casted, and to set his experience after the spell duriation is over. So i will use the trigger for cleanup hero and then add cleanup triggering unit and giving it the experience of the exp of stolen hero whent he skill is done.

Does that make sense? But how do I make it happen?
BTW You guys freaking rock and are helping me a bunch!
 
G

Gojhin

Guest
well. instead of Set StolenHero = (Last created unit) you should try something like: Set StolenHero = units owned by owner of casting unit matching unit type of matching unit equal to unit type of target unit of ability being cast. that should get your trigger to work the way you want it.
 

-=Swift=-

New Member
Reaction score
2
OKay isn't that doing the same thing as StolenHero = Last Created Unit? And that doesn't help me with getting rid of my hero and returning him back with the stolen heros new exp...
 
G

Gojhin

Guest
well. firstly, no, because last created unit tends to glitch sometimes. so narrowing it down to that would save you some confusion. and uh for the end of this trigger, you would basically want to just reverse the actions and units it's using.(i changed this a little bit)
Code:
Set MissingHero = (Target unit of ability being cast
Set TempPosition2 = Position of Units owned by owner of target unit of ability being cast
Set RealStolenHero = Units owned by owner of target unit of ability being cast
        Unit - Hide RealStolenHero
        Set TempPosition = (Position of MissingHero)
        Unit - Create 1 (Unit-type of MissingHero) for (Owner of (Triggering unit)) at TempPosition facing (Facing of MissingHero) degrees
        Set StolenHero = (Last created unit)
        Hero - Set StolenHero experience to (Hero experience of MissingHero), Hide level-up graphics
        Unit - Set life of StolenHero to (Life of MissingHero)
        Unit - Set mana of StolenHero to (Mana of MissingHero)
        Unit - Hide MissingHero

like this
Code:
        wait # seconds
        Set TempPosition = position of StolenHero
        Unit - hide (Unit-type of StolenHero) for (Owner of (StolenHero))
        Unit - unhide (Unit-type of MissingHero) for (Owner of (StolenHero))
        Hero - Set MissingHero experience to (Hero experience of StolenHero), Hide level-up graphics
        Unit - Set life of MissingHero to (Life of StolenHero)
        Unit - Set mana of MissingHero to (Mana of StolenHero)
        Unit - Move MissingHero to TempPosition
        Unit - Destroy StolenHero
        Unit - Unhide RealStolenHero
        Unit - Move RealStolenHero to TempPosition2
that would be the rest of your trigger
 

-=Swift=-

New Member
Reaction score
2
OKay so is that just one triger or two, I belive it is one, and I need some variables to go with it right?


Edit: Heck yes I understand it now.. OKay now I have one other question.. To go with this..
OKay one other thing that is wrong with this is: If the Triggering unit is lvl 6 and then the targeting unit is lvl 10 when the spell is over i would jump the Triggering unit to level 10! I just want to add the exp earned over that time to the triggering unit not the total exp it has.. If you understand what I mean..

And
How do I make it so if the Stolen Unit Dies it makes it so the RealStolenHero dies and then automaticly sets the Missing hero back?

Sorry for all this work.. You guys are helping alot!~
 
G

Gojhin

Guest
yeah, its all 1 trigger, i just added my part of the trigger in a dif section so you know what to add, also, yes. but the only other variable you need to create is another point variable (TempPosition2) so that you can give back the original stolen hero back to the player as if he weren't effected, also. the hero you stole has his exp reset back to before he was stolen, unless you don't want that, then just repeat the trigger again and set his (RealStolenHero) experience and hp and what-not to the same as the MissingHero at the end of the trigger. but thats just if u want the mind controlled hero to keep the exp he gained while under someone else's control. (however i got the intention you didn't want that)
 

-=Swift=-

New Member
Reaction score
2
That is perfect!
Almost done I assume..
But what if the Triggering unit is lvl 6 and then the targeting unit is lvl 10 when the spell is over i would jump the Triggering unit to level 10! I just want to add the exp earned over that time to the triggering unit not the total exp it has.
And yes I did not want that.

Also one last how do I make it so if the Stolen Unit Dies it makes it so the RealStolenHero dies and then automaticly sets the Missing hero back?
 
G

Gojhin

Guest
basically, you might want to think of a logical system like, not being able to cast "control hero" if he's a higher level than you. or, you could save the exp gained with variables such as creating a new trigger and turn it on when the unit casts "control hero" and then just make it the events: unit gains exp. condition: you know what you need to do here, action: set VARIABLE(integer) = "controlled hero exp" and set VARIABLE2(integer) = "controlling hero exp" then after he changes back, set the exp of the hero to the exp of the fake controlled hero, + the exp of your controlling hero and finally -(minus) the RealStolenHeroes exp and it'll be set right, for your second question...

basically create a new trigger(by copying the trigger i made for you) and then changing the condition to when a unit dies, and all the other conditions from MissingHero to Dying Unit. and it would work.
 

MoonSlinger

I Love using Cheap Tricks... only Results matters
Reaction score
74
You want the exp gain, so you just have to remove what it used to have.

Hero - Add ((Hero experience of StolenHero) - (Hero experience of MissingHero)) experience to (Triggering unit), Hide level-up graphics

Since the MissingHero would have the exp before he goes missing, you can subtract that from the total exp of StolenHero once the switch takes place. The gain be added.


As for making a check, you would need another trigger:
E - Unit dies
C - Unit = MissingHero
A -
Kill the caster of "Steal Hero"
Spawn MissingHero at the location of the dying unit.

To make use of that, you would need to assign the caster of "Steal Hero" to a unit variable.
 
G

Gojhin

Guest
by the way, the way this trigger is set up, moonslinger is correct, you would need to copy the items, so it's not useless. you would need to add that trigger he made for you into that trigger as well.

(hehe, i sorta beat u to this last response moon =D)
 

-=Swift=-

New Member
Reaction score
2
Omg i think i get it... I'll write the code in WE add the skill and test it! You guys rock and thank you. Keep watchin this post tho just incase i get stuck I probably will..
This will be FUN! lol This has helped me alot with triggeres and learnign more about what they can do... Hopefully I can use this for furthing thing I need. Thank you.

I have one question when you create the new units for the control is that going to make it so the player can revive the copied unit along with the original when they die? Should I have it Destroy or Remove form game the Created unit?

And I don't know why do I need the items? Won't the items be saved for the hidden unit anyways? And when he re-appears isnt he reset exactly the way b4 with items and everything?
 
G

Gojhin

Guest
yes, but the items aren't for the MissingHero, they're for the duplicate hero you create when it's acting as the mind-controlled unit. and, if a unit does revive as well as your original hero when he dies, make a trigger like this:
E: unit enters RE-SPAWN Region
C: unit type of entering unit not equal to unit type of MissingHero and units owned by owner of MissingHero equal to player is in control of units of type not equal to MissingHero and units owned by MissingHero = is a hero equal to true
A: remove entering unit from the game
 

-=Swift=-

New Member
Reaction score
2
OKaY i understand but i dont need the mind controled unit to have the items..
One problem is I cant find:
Code:
Unit - hide (Unit-type of StolenHero) for (Owner of (StolenHero))
Unit - unhide (Unit-type of MissingHero) for (Owner of (StolenHero))
Just so its not a variable mistake can you list the variables and there types?
What I have is:
TempPosition - Point
TempPosition2 - Point
StolenHero - Unit Group
RealStolenHero - Unit Group
MissingHero - Unit

And some other things I couldn't find I did another way by using Pick all Units in unit group and do...
Here is my trigger so far
[Trigger] How do I copy and paste the trigger it wont let me?

I did the rest I didn't understand my own way I think it will work.
 

darkRae

Ueki Fan (Ueki is watching you)
Reaction score
173
Mm.. guys, I wanna reply to the first question, about replicating the Hero. In Moonslinger's idea, it is good enough, but I think you need to make the items in the StolenHero's inventory undroppable. Why? Because you can easily have the items in the Hero's inventory by dropping the items elsewhere within the duration time. (imagine you are against an enemy that has powerful items, then you take control of it, then you drop all the items somewhere, then order your Hero to take it)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top