1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Upgrading Same Weapon Item

Discussion in 'World Editor Help Zone' started by (Battleships) Speed, Oct 13, 2019.

  1. (Battleships) Speed

    (Battleships) Speed

    Joined:
    Jun 26, 2019
    Messages:
    31
    Resources:
    0
    Resources:
    0
    Since we have combine 2 same items into 1 item. 2 same weapons into 1 weapon. Single weapon to Double Weapon. I feels that there's something we can do this and I am still figuring out how to stacking up to 4 times with buying same weapon for 4 times. Buying same weapon "Single Rocket Cannon" for 4 times from the shop to get to Quad Rocket Cannon. I want it to be working like power up the weapon after bought a Single Rocket Cannon. Because I don't like to have 2 items in inventory to combine 1 item. I want it to power up the item after bought the first item, then buy again as power up the first item to be second item as double weapon, you know. Because it's frustrating to have 2 items in inventory to combine into 1 item due to when you have full inventory, you have to drop one of items to be able to continue buy the same item again to have 2 items in inventory to combine into 1 item. I hope you know what I am saying. I have the combine weapon trigger picture here. In this trigger, I can only buy 2 times of same weapon. I am figuring out how to buy it 4 times of same weapon. I tried this "Single Rocket Cannon + Double Rocket Cannon = Triple Rocket Cannon" in trigger, and it don't work. I don't know why. But, I want to buy single rocket cannon, and then buy it again for 3 times to get to Quad Rocket Cannon, like power up the single rocket cannon for 3 times, you know. Almost like one in Battletanks. Upgrading weapon to level 2, you know. But, upgrading weapons to Double Rocket Cannon, from buying same weapon from shop. I found the triggers that will work for me, but I copied them out of the forum and I need help to turn them into my map as item sold to be in the shop for players to buy the Single Rocket Cannon from shop and the players can buy same weapon from shop for 4 times to be Quad Rocket Cannon, like right now it's at Double Rocket Cannon, but I am working on to get it to be able to buy it for 4 times, like upgrading the same weapon or stacking the same weapon. I don't know what type of variables on all of them variables should be, example: Integer, Boolean, Item, Item-Type, Unit. Here the copy of triggers below. I also uploaded a map for you to test it out.
     
    Last edited: Oct 13, 2019
  2. (Battleships) Speed

    (Battleships) Speed

    Joined:
    Jun 26, 2019
    Messages:
    31
    Resources:
    0
    Resources:
    0
    [​IMG]Events
    [​IMG][​IMG]Time - Elapsed game time is 0.50 seconds
    [​IMG]Conditions
    [​IMG]Actions

    [​IMG][​IMG]Custom script: set udg_NO_ITEM_TYPE = 0
    [​IMG][​IMG]Set MAX_ITEM_COMBINES = 4
    [​IMG][​IMG]Set MAX_ITEM_COMBINES = MAX_ITEM_COMBINES + 1
    [​IMG][​IMG]-------- --------
    [​IMG][​IMG]Set ItemNum = ItemNum + MAX_ITEM_COMBINES
    [​IMG][​IMG]Set CombineItem[ItemNum + 0] = Rocket Cannon (Dummy Buy)
    [​IMG][​IMG]Set CombineItem[ItemNum + 1] = Rocket Cannon
    [​IMG][​IMG]Set CombineItem[ItemNum + 2] = Double Rocket Cannon
    [​IMG][​IMG]Set CombineItem[ItemNum + 3] = Triple Rocket Cannon
    [​IMG][​IMG]Set CombineItem[ItemNum + 4] = Quad Rocket Cannon
    [​IMG][​IMG]-------- --------
    [​IMG][​IMG]Set NUM_BASE_COMBINES = ItemNum / MAX_ITEM_COMBINES
     
  3. (Battleships) Speed

    (Battleships) Speed

    Joined:
    Jun 26, 2019
    Messages:
    31
    Resources:
    0
    Resources:
    0
  4. (Battleships) Speed

    (Battleships) Speed

    Joined:
    Jun 26, 2019
    Messages:
    31
    Resources:
    0
    Resources:
    0
    Here the map as example. Test it out.
     

    Attached Files:

  5. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,546
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Make the item on the ground or brought from shop a dummy "used on pickup" item. Triggers detect when the unit uses the item, and then removes the dummy item (use on pickup kills the item and items do not decay, remove is needed to stop a leak), and either creates the actual single version of the item if the unit does not have one already, or upgrades an existing variant.

    If neither can happen then it refunds the player the gold cost or recreates the dummy on the floor.
     
  6. (Battleships) Speed

    (Battleships) Speed

    Joined:
    Jun 26, 2019
    Messages:
    31
    Resources:
    0
    Resources:
    0
    I am actually making this for a shop to buy the weapon from. I uploaded the map for you to test it out.
     
  7. (Battleships) Speed

    (Battleships) Speed

    Joined:
    Jun 26, 2019
    Messages:
    31
    Resources:
    0
    Resources:
    0
    I am talking about what type of variable on each of those variables I should put in: Boolean, Integer, Item, Item-Type, Unit... and I am trying to turn them all into my map, but I have to make variables, but I don't know what type of variable I should turn it in for each variables.

    Example:
    [​IMG]Set MAX_ITEM_COMBINES = 4
    This should be in Integer with unchecked array and default 0.
     
  8. (Battleships) Speed

    (Battleships) Speed

    Joined:
    Jun 26, 2019
    Messages:
    31
    Resources:
    0
    Resources:
    0
    I mean, I found this upgrading item triggers for to build my own combining weapons for my new Battleships map, but I am trying to figure out how to turn them into my Battleships map to be as sold item to be in the shop for players to buy a weapon, and then buy same weapon again for up to 4 times, like right now that you can buy it for 2 times to be Double Rocket Cannon. But, I am working on to turn them into my map as sold item to be in the shop.
     
  9. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    2,901
    Resources:
    1
    Spells:
    1
    Resources:
    1
    What the hell, dude? You needed to make another thread about this exact same topic that I just helped you with yesterday, delete all your posts in the other thread, and then not even credit me as the person who wrote those triggers? I don't understand you.

    USE
    YOUR
    BRAIN
    TO
    FIGURE
    OUT
    WHAT
    TYPE
    OF
    VARIABLE
    THEY
    ARE.

    If you are not capable of this you should absolutely not be trying to make maps. This is level 0 triggers, the most basic of the most basic concepts. For fuck's sake one of them even says "Integer ___" right in front of it.
    Because you are so FUCKING lazy
    MAX_ITEM_COMBINES - Integer because in the setup trigger it's assigned to 4 which is an integer.
    ItemNum - Also an integer because in the setup trigger it's assigned using MAX_ITEM_COMBINES which is an integer.
    CombineItem[] - Item type array because in the setup trigger it's assigned to item types... duh.
    NUM_BASE_COMBINES - Integer because in the setup trigger it's assigned using ItemNum and MAX_ITEM_COMBINES which are integers.
    B_Unit - Unit, read the fucking name of the variable.
    B_Item - Item (see above).
    B_IType - Item (see above).
    GiveItem - Same as CombineItem because it's assigned to a value of CombineItem[]. Also look at the last line of the trigger where it's used and tell me what the fuck other kind of variable could go there?!
    FoundItem - Boolean because it's assigned to False/True which are booleans.
    S_Item - Item (duh)
    S_IType - Item type (duh)
    NO_ITEM_TYPE - Item Type (you read my comment about what this is and why it exists... right?)


    If it doesn't have the little [] symbols after it then it's not a fucking array. Most variables never need to have a default value set. HOLY FUCK.

    You did not find them. I made them. And I wrote them specifically to work for what you described you need.
     
  10. (Battleships) Speed

    (Battleships) Speed

    Joined:
    Jun 26, 2019
    Messages:
    31
    Resources:
    0
    Resources:
    0
    Sorry... I am trying to finish my map...
     
  11. (Battleships) Speed

    (Battleships) Speed

    Joined:
    Jun 26, 2019
    Messages:
    31
    Resources:
    0
    Resources:
    0
    Actually, I am not good at English... and the reason I don't say it is because nobody cares.
     
  12. (Battleships) Speed

    (Battleships) Speed

    Joined:
    Jun 26, 2019
    Messages:
    31
    Resources:
    0
    Resources:
    0
    What about BaseInt and SlotInt?
     
  13. (Battleships) Speed

    (Battleships) Speed

    Joined:
    Jun 26, 2019
    Messages:
    31
    Resources:
    0
    Resources:
    0
    Those are both Integer?
     
  14. (Battleships) Speed

    (Battleships) Speed

    Joined:
    Jun 26, 2019
    Messages:
    31
    Resources:
    0
    Resources:
    0
    Okay. Well, I finished creating variables all the way what you wrote into my map, and doing the map test, and clicked on Rocket Cannon in the shop, and the WC3 game just completely exit game way fast itself. Sigh... I think I made a mistake in the variables, but I dont know which that caused the WC3 game to exit game itself as soon as I clicked Rocket Cannon in shop. Here the map you can test it out and you can see the problem.
     

    Attached Files:

  15. (Battleships) Speed

    (Battleships) Speed

    Joined:
    Jun 26, 2019
    Messages:
    31
    Resources:
    0
    Resources:
    0
    Ah. It was "exitwhen true" caused the game to exit automatically itself when clicked Rocket Cannon from shop. I removed those "exitwhen true" off the trigger, and it solved the problem, but now there's new problem again, when I clicked the Rocket Cannon from shop, it completely created Double Rockets to full of inventory. Sigh. Here the updated map. So. You can see the new problem. After you bought 1 Rocket Cannon, the inventory will be completely full of Double Rocket Cannons, for just one click from shop, and now you gonna get one of Double Rocket Cannons dropped to ground or sell it to shop, and buy Rocket Cannon again, and you will notice all changed to Triple Rocket Cannon. Weird. Help please?
     

    Attached Files:

    Last edited: Oct 13, 2019
  16. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    2,901
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Yes they are integers... because the line in which they are being used can only accept an integer variable. Seriously, use your brain! They also say "int" in the variable name.... (I'm aware of what you said about not speaking English.)
    That's what the exitwhen true line prevents. There's no reason for that line to crash the map, it just leaves the loop early.
     
  17. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,546
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    exitwhen true escapes the current loop block in JASS.
     
  18. (Battleships) Speed

    (Battleships) Speed

    Joined:
    Jun 26, 2019
    Messages:
    31
    Resources:
    0
    Resources:
    0
    Here the 2 trigger maps that I want it to be combined. Check out the map "Battleships Weapon Combining Test" first below, and you can see how it worked the way I wanted it to be, but I want it to be able to continue to combining to get to Quad Rocket Cannon, and I want it to work almost like the other map "Item Level Up System" below.
     

    Attached Files:

  19. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    2,901
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Christ almighty. The reason it's crashing is that you didn't actually make dummy tome versions of the weapons to buy from the shop instead of real items! You want to do this so the player can buy weapons when they have a full inventory. When I wrote this:
    I meant that the 0th index is some tome or other used on pickup item (like DSG suggested) and the 1st index is the actual base level item. You did not do this and instead put the base level item in the 0th and 1st index. This causes an infinite loop when a unit buys an item because it's supposed to replace the dummy with the base item which will fail to trigger the trigger again. By having the same item the trigger runs again infinitely. I made a couple of small errors where I forgot to use ItemNum+1 and the logic with the item giving can be simplified. The trigger is now:
    • Weapon A Combining 2
      • Events
        • Unit - A unit Acquires an item
      • Conditions
      • Actions
        • Set B_Item = (Item being manipulated)
        • Set B_IType = (Item-type of B_Item)
        • Set B_Unit = (Triggering unit)
        • For each (Integer BaseInt) from 1 to NUM_BASE_COMBINES, do (Actions)
          • Loop - Actions
            • Set ItemNum = (BaseInt x MAX_ITEM_COMBINES)
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • B_IType Equal to CombineItem[ItemNum]
              • Then - Actions
                • Item - Remove B_Item
                • Set GiveItem = CombineItem[(ItemNum + 1)]
                • For each (Integer SlotInt) from 1 to 6, do (Actions)
                  • Loop - Actions
                    • Set S_Item = (Item carried by B_Unit in slot SlotInt)
                    • Set S_IType = (Item-type of S_Item)
                    • For each (Integer CombInt) from (ItemNum + 1) to (ItemNum + (MAX_ITEM_COMBINES - 1)), do (Actions)
                      • Loop - Actions
                        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • S_IType Equal to CombineItem[CombInt]
                            • CombineItem[(CombInt + 1)] Not equal to NO_ITEM_TYPE
                          • Then - Actions
                            • Item - Remove S_Item
                            • Set GiveItem = CombineItem[(CombInt + 1)]
                            • Custom script: exitwhen true
                          • Else - Actions
                • Hero - Create GiveItem and give it to B_Unit
                • Set GiveItem = NO_ITEM_TYPE
                • Custom script: exitwhen true
              • Else - Actions

    And a map is attached since I'm sure you're not going to be making those changes yourself. Buy the new cannon I created, not the old one.
     

    Attached Files:

  20. (Battleships) Speed

    (Battleships) Speed

    Joined:
    Jun 26, 2019
    Messages:
    31
    Resources:
    0
    Resources:
    0
    This is perfect! Thanks, man! I love it! Beautiful! :D