Upgrading Items

Vulcansurge

Ultra Cool Member
Reaction score
27
Hello guys,

Im making a trigger to upgrade items, similar to later versions of Battle Tanks, but to no avail. Here is my trigger.

CODE:
Code:
UpgradeCannon
    Events
        Unit - A unit Uses an item
    Conditions
        ItemUpgrading[(Player number of (Owner of (Hero manipulating item)))] Equal to No item
    Actions
        Set tempInt[0] = ((Owner of (Hero manipulating item)) Current gold)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Item-type of (Item being manipulated)) Equal to Basic Cannon (Level 1)
            Then - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        tempInt[0] Greater than or equal to 600
                    Then - Actions
                        Hero - Drop (Item being manipulated) from (Hero manipulating item)
                        Item - Remove (Item being manipulated)
                        Hero - Create Upgrading Item and give it to (Hero manipulating item)
                        Set ItemUpgrading[(Player number of (Owner of (Hero manipulating item)))] = (Last created item)
                        Wait 10.00 seconds
                        Hero - Drop ItemUpgrading[(Player number of (Owner of (Hero manipulating item)))] from (Hero manipulating item)
                        Hero - Create Basic Cannon (Level 2) and give it to (Hero manipulating item)
                        Set ItemUpgrading[(Player number of (Owner of (Hero manipulating item)))] = No item
                    Else - Actions
                        Set tempGroup = (Player group((Owner of (Hero manipulating item))))
                        Game - Display to tempGroup for 5.00 seconds the text: |cFF0000FFNote:|r
                        Game - Display to tempGroup the text: You do not have eno...
                        Game - Display to tempGroup for 5.00 seconds the text:  
                        Custom script:   call DestroyForce(udg_tempGroup)
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Item-type of (Item being manipulated)) Equal to Basic Cannon (Level 2)
            Then - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        tempInt[0] Greater than or equal to 700
                    Then - Actions
                        Hero - Drop (Item being manipulated) from (Hero manipulating item)
                        Item - Remove (Item being manipulated)
                        Hero - Create Upgrading Item and give it to (Hero manipulating item)
                        Set ItemUpgrading[(Player number of (Owner of (Hero manipulating item)))] = (Last created item)
                        Wait 10.00 seconds
                        Hero - Drop ItemUpgrading[(Player number of (Owner of (Hero manipulating item)))] from (Hero manipulating item)
                        Hero - Create Basic Cannon (Level 3) and give it to (Hero manipulating item)
                        Set ItemUpgrading[(Player number of (Owner of (Hero manipulating item)))] = No item
                    Else - Actions
                        Set tempGroup = (Player group((Owner of (Hero manipulating item))))
                        Game - Display to tempGroup for 5.00 seconds the text: |cFF0000FFNote:|r
                        Game - Display to tempGroup the text: You do not have eno...
                        Game - Display to tempGroup for 5.00 seconds the text:  
                        Custom script:   call DestroyForce(udg_tempGroup)
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Item-type of (Item being manipulated)) Equal to Basic Cannon (Level 3)
            Then - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        tempInt[0] Greater than or equal to 800
                    Then - Actions
                        Hero - Drop (Item being manipulated) from (Hero manipulating item)
                        Item - Remove (Item being manipulated)
                        Hero - Create Upgrading Item and give it to (Hero manipulating item)
                        Set ItemUpgrading[(Player number of (Owner of (Hero manipulating item)))] = (Last created item)
                        Wait 10.00 seconds
                        Hero - Drop ItemUpgrading[(Player number of (Owner of (Hero manipulating item)))] from (Hero manipulating item)
                        Hero - Create Basic Cannon (Level 4) and give it to (Hero manipulating item)
                        Set ItemUpgrading[(Player number of (Owner of (Hero manipulating item)))] = No item
                    Else - Actions
                        Set tempGroup = (Player group((Owner of (Hero manipulating item))))
                        Game - Display to tempGroup for 5.00 seconds the text: |cFF0000FFNote:|r
                        Game - Display to tempGroup the text: You do not have eno...
                        Game - Display to tempGroup for 5.00 seconds the text:  
                        Custom script:   call DestroyForce(udg_tempGroup)
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Item-type of (Item being manipulated)) Equal to Basic Cannon (Level 4)
            Then - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        tempInt[0] Greater than or equal to 900
                    Then - Actions
                        Hero - Drop (Item being manipulated) from (Hero manipulating item)
                        Item - Remove (Item being manipulated)
                        Hero - Create Upgrading Item and give it to (Hero manipulating item)
                        Set ItemUpgrading[(Player number of (Owner of (Hero manipulating item)))] = (Last created item)
                        Wait 10.00 seconds
                        Hero - Drop ItemUpgrading[(Player number of (Owner of (Hero manipulating item)))] from (Hero manipulating item)
                        Hero - Create Basic Cannon (Level 5) and give it to (Hero manipulating item)
                        Set ItemUpgrading[(Player number of (Owner of (Hero manipulating item)))] = No item
                    Else - Actions
                        Set tempGroup = (Player group((Owner of (Hero manipulating item))))
                        Game - Display to tempGroup for 5.00 seconds the text: |cFF0000FFNote:|r
                        Game - Display to tempGroup the text: You do not have eno...
                        Game - Display to tempGroup for 5.00 seconds the text:  
                        Custom script:   call DestroyForce(udg_tempGroup)
            Else - Actions
                Do nothing

VARIABLES:
ItemUpgrading is to stop two items being upgraded at once.
tempInt is used to make sure the player has enough gold.
tempGroup is used to chat to a single player.

ME THINKS THIS:
Now, me thinks that the item I'm using, because it isnt charged, is not going through the trigger. I have enabled the "Stats - Actively Used" but that didnt work. Should I make a dummy ability that adds zero health to the hero so it still looks like it is using the item?

Im gereous with +rep and I like to credit any help I recieve! :D
 

Vulcansurge

Ultra Cool Member
Reaction score
27
I think its fixed. Dont worry about posting here, unless you want to tell me how much you like my system! :D
 

esb

Because none of us are as cruel as all of us.
Reaction score
329
Pretty nice system! :D
Good work
 

Vulcansurge

Ultra Cool Member
Reaction score
27
Thanks.

Do you think I should make a sample map for it? There doesnt seem to be one going around... Ill have to give credit to the creator of Battle Tanks for the idea...
 

esb

Because none of us are as cruel as all of us.
Reaction score
329
It would be a good idea for other people, and a good addition to the tutorial section.
 
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