• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Moving buffs between heroes

Status
Not open for further replies.
Level 3
Joined
Feb 25, 2009
Messages
38
Okay, so i'm trying to make a custom hero that evolves (using multiple separate heroes) when it reaches max level

but i want the evolved hero to keep all the bonuses it might have gotten from Tomes

Agi/Str/Int is easy enough, but i'm having trouble transferring the Tome of Health effect, or making it stack, to be precise..

I'm making it simple, and using this formula for the tomes:

  • Stats
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to Tome of Strength
        • Then - Actions
          • Set str (Real that saves the bonus from any picked up tome) = (str + 1)
        • Else - Actions
Yatta yatta, rest of tomes follow... duh duh duh....

  • evolve 1
    • Events
      • Game - Slave(A Real that follows the level of the hero) becomes Equal to 10.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of Hero) Equal to Stage 1
        • Then - Actions
          • Set Slave = 1.00
          • Unit - Replace Stage 1 with a Stage 2 using The old unit's relative life and mana
          • Set Hero = (Last replaced unit)
          • Hero - Set Hero (Unit variable that follows and changes as the hero evolves) Hero-level to 1, Hide level-up graphics
          • Hero - Modify Strength of Hero: Add str
          • Hero - Modify Agility of Hero: Add agi
          • Hero - Modify Intelligence of Hero: Add int
        • Else - Actions

i.e
A hero has 1000hp. It picks up two Tomes of Health, each giving +50 max hp.
The hero now has 1100 max hp.

It then evolves (gets swapped out with a completely different hero)
How do i get the two tomes transferred over without having to use a trillion triggers?


Note: Yes, i know my triggers are leaky as fuck. I'm not a pro, mkay? ;P
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
I think that you shouldnt use "Replace unit"
Instead make an ability based of bear form/crow form and adjust some stuff.
Put in the "normal unit" the stage 2 unit and in the "alternative unit" the stage 1 unit.

Then make a trigger and give your hero the new ability and remove it immediately again.
Then your unit is instantly transformed into the new unit while remaining buffs, bonusses, handle id, etc, etc, etc...
It is in fact the same unit but has a different unit type id.
 
Level 21
Joined
Aug 13, 2011
Messages
739
You can keep track of the other bonuses the same way:
  • Acquire Manual of Health
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to Manual of Health
        • Then - Actions
          • Set HPBonus = (HPBonus + 1)
        • Else - Actions
Then you can give the hero all of the tomes the other one had (which are instantly used) by using a loop in your evolve trigger:
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • HPBonus Greater than 0
      • Then - Actions
        • For each (Integer A) from 1 to HPBonus, do (Actions)
          • Loop - Actions
            • Hero - Create Manual of Health and give it to Hero
      • Else - Actions
 
Level 3
Joined
Feb 25, 2009
Messages
38
Thanks for all the help!
I went with Tickles' solution. I tried making it a trigger like that, but i didn't use the right trigger function, plus i used the ability for hp instead of adding the item.

Again, thanks for all the help! :D
 
Status
Not open for further replies.
Top