• 🏆 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!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

Help with hero upgrading

Status
Not open for further replies.
Level 1
Joined
Aug 8, 2011
Messages
3
Barev tuxek. I need some help regarding my warcraft 3 map (of course). So I don't know if any of you have played the Nyne's Swords n Armor, but there is a really cool mechanic I cant figure out how to use. So basically the hero starts off as rank one, then when it reaches level 3, it turns into a rank 2 hero and resets to level 1, while retaining all of its upgrades and items. I can't find out how to do that so I'd appreciate the help.
 
Level 1
Joined
Aug 8, 2011
Messages
3
Well I want it to be like this. A human rank 1 hero gets lvl 3 and turns into a rank 2 human. At level 5 he gets rank 3. At level 10 is 4 and so on. (theres multiple races)
 
Level 9
Joined
Apr 23, 2010
Messages
312
Start off with something like this
  • Untitled Trigger 001
    • Events
      • Unit - A unit Gains a level
    • Conditions
      • (Race of (Triggering unit)) Equal to Human
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of (Triggering unit)) Equal to 3
        • Then - Actions
          • "Your Actions"
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of (Triggering unit)) Equal to 5
        • Then - Actions
          • "Your Actions"
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of (Triggering unit)) Equal to 10
        • Then - Actions
          • "Your Actions"
        • Else - Actions
You can copy + paste this and have 4 of these triggers, one for each race. Where it says "Your Actions" I would recommend using the code I made.
  • Set ReplacedUnit_u = (Killing Unit)
    • Set TempPoint = (Position of (Killing unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Item-type of (Item being manipulated) Equal to "YourItem"
      • Then - Actions
        • Set UnitExperience_int = (Hero experience of ReplacedUnit_u)
        • Set Strength_int = (Strength of ReplacedUnit_u (Exclude bonuses))
        • Set Agility_int = (Agility of ReplacedUnit_u (Exclude bonuses))
        • Set Intellignece_int = (Intelligence of ReplacedUnit_u (Exclude bonuses))
        • Set Item_i[0] = (Item-type of (Item carried by ReplacedUnit_u in slot 1))
        • Set Item_i[1] = (Item-type of (Item carried by ReplacedUnit_u in slot 2))
        • Set Item_i[2] = (Item-type of (Item carried by ReplacedUnit_u in slot 3))
        • Set Item_i[3] = (Item-type of (Item carried by ReplacedUnit_u in slot 4))
        • Set Item_i[4] = (Item-type of (Item carried by ReplacedUnit_u in slot 5))
        • Set Item_i[5] = (Item-type of (Item carried by ReplacedUnit_u in slot 6))
        • Set ItemCharges_int[0] = (Charges remaining in (Item carried by ReplacedUnit_u in slot 1))
        • Set ItemCharges_int[1] = (Charges remaining in (Item carried by ReplacedUnit_u in slot 2))
        • Set ItemCharges_int[2] = (Charges remaining in (Item carried by ReplacedUnit_u in slot 3))
        • Set ItemCharges_int[3] = (Charges remaining in (Item carried by ReplacedUnit_u in slot 4))
        • Set ItemCharges_int[4] = (Charges remaining in (Item carried by ReplacedUnit_u in slot 5))
        • Set ItemCharges_int[5] = (Charges remaining in (Item carried by ReplacedUnit_u in slot 6))
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (ReplacedUnit_u)) Equal to "YourUnit"
        • Then - Actions
          • Hero - Set (ReplacedUnit_u) experience to 0, Hide level-up graphics
          • For each (Integer A) from 1 to 6, do (Actions)
            • Loop - Actions
              • Hero - Drop the item from slot (Integer A) of (ReplacedUnit_u)
              • Item - Remove (Last dropped item)
          • Unit - Hide (ReplacedUnit_u)
          • Unit - Remove (ReplacedUnit_u) from the game
          • Unit - Create 1 "YourNewUnit" for (Owner of (ReplacedUnit_u)) at TempPoint facing Default building facing degrees
        • Else - Actions
        • Set NewUnit_u = (Last created unit)
        • Hero - Set NewUnit_u experience to UnitExperience_int, Hide level-up graphics
        • Hero - Modify Strength of NewUnit_u: Set to Strength_int
        • Hero - Modify Agility of NewUnit_u: Set to Agility_int
        • Hero - Modify Intelligence of NewUnit_u: Set to Intellignece_int 0 to 5, do (Actions)
          • Loop - Actions
            • Hero - Create Item_i[(Integer A)] and give it to NewUnit_u
            • Item - Set charges remaining in (Last created item) to ItemCharges_int[(Integer A)]
    • Else - Actions
  • Custom script: call RemoveLocation(udg_TempPoint)
Where it says "YourNewUnit" place the unit you want to upgrade to for that level.
 
Level 9
Joined
Apr 23, 2010
Messages
312
Yes, they go together, and don't worry, i'm not uber pro either :) I edited the trigger, since you said the unit went back to level 1 that means you don't have to save the experience or attributes of the hero.

First thing's first, you want to place those variables, here is a list of the ones you will need. they don't have to be the same name as mine, but everything else must match!

Variables
Item_i = Item-Type Array
ItemCharges_int = Integer Array
ReplacedUnit_u = Unit
TempPoint = Point
UpgradedUnit_u = Unit
Now that you have made those variables you can begin making the trigger!
  • Hero Rank Upgrade
    • Events
      • Unit - A unit Gains a level
    • Conditions
      • (Race of (Triggering unit)) Equal to Human
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of (Triggering unit)) Less than 3
        • Then - Actions
        • Else - Actions
          • Set ReplacedUnit_u = (Triggering unit)
          • Set TempPoint = (Position of (Triggering unit))
          • -------- -------------------------------------------------- --------
          • -------- This saves the item in each slot for the hero --------
          • -------- -------------------------------------------------- --------
          • Set Item_i[0] = (Item-type of (Item carried by ReplacedUnit_u in slot 1))
          • Set Item_i[1] = (Item-type of (Item carried by ReplacedUnit_u in slot 2))
          • Set Item_i[2] = (Item-type of (Item carried by ReplacedUnit_u in slot 3))
          • Set Item_i[3] = (Item-type of (Item carried by ReplacedUnit_u in slot 4))
          • Set Item_i[4] = (Item-type of (Item carried by ReplacedUnit_u in slot 5))
          • Set Item_i[5] = (Item-type of (Item carried by ReplacedUnit_u in slot 6))
          • -------- ----------------------------------------------------------------------- --------
          • -------- This saves the charges of the saved item in each slot for the hero --------
          • -------- ----------------------------------------------------------------------- --------
          • Set ItemCharges_int[0] = (Charges remaining in (Item carried by ReplacedUnit_u in slot 1))
          • Set ItemCharges_int[1] = (Charges remaining in (Item carried by ReplacedUnit_u in slot 2))
          • Set ItemCharges_int[2] = (Charges remaining in (Item carried by ReplacedUnit_u in slot 3))
          • Set ItemCharges_int[3] = (Charges remaining in (Item carried by ReplacedUnit_u in slot 4))
          • Set ItemCharges_int[4] = (Charges remaining in (Item carried by ReplacedUnit_u in slot 5))
          • Set ItemCharges_int[5] = (Charges remaining in (Item carried by ReplacedUnit_u in slot 6))
          • -------- ----------------------------------------------------------------------------------- --------
          • -------- We must remove the experience and item's of the hero to prevent unused data --------
          • -------- ----------------------------------------------------------------------------------- --------
          • Hero - Set ReplacedUnit_u experience to 0, Hide level-up graphics
          • For each (Integer A) from 1 to 6, do (Actions)
            • Loop - Actions
              • Hero - Drop the item from slot (Integer A) of ReplacedUnit_u
              • Item - Remove (Last dropped item)
          • -------- ------------------------------------------------------------------------------------------- --------
          • -------- Now we have to check what level the hero is becoming to determine what he turns into --------
          • -------- ------------------------------------------------------------------------------------------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Hero level of (Triggering unit)) Equal to 3
            • Then - Actions
              • Unit - Hide ReplacedUnit_u
              • Unit - Remove ReplacedUnit_u from the game
              • Unit - Create 1 "Rank 2 Hero" for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Hero level of (Triggering unit)) Equal to 5
            • Then - Actions
              • Unit - Hide ReplacedUnit_u
              • Unit - Remove ReplacedUnit_u from the game
              • Unit - Create 1 "Rank 3 Hero" for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Hero level of (Triggering unit)) Equal to 10
            • Then - Actions
              • Unit - Hide ReplacedUnit_u
              • Unit - Remove ReplacedUnit_u from the game
              • Unit - Create 1 "Rank 4 Hero" for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
            • Else - Actions
          • -------- ------------------------------------------------------------------------ --------
          • -------- Now that we have the new hero, we should give him his stuff back! --------
          • -------- ------------------------------------------------------------------------ --------
          • Set UpgradedUnit_u = (Last created unit)
          • For each (Integer A) from 0 to 5, do (Actions)
            • Loop - Actions
              • Hero - Create Item_i[(Integer A)] and give it to UpgradedUnit_u
              • Item - Set charges remaining in (Last created item) to ItemCharges_int[(Integer A)]
          • -------- ------------------------------------------------ --------
          • -------- Last but not least, remove that point leak --------
          • -------- ------------------------------------------------ --------
          • Custom script: call RemoveLocation(udg_TempPoint)
 
Last edited:
Status
Not open for further replies.
Top