• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Upgrading Same Weapon Item

Status
Not open for further replies.
Level 8
Joined
Jun 26, 2019
Messages
318
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:
Level 8
Joined
Jun 26, 2019
Messages
318
events.gif
Events
joinbottom.gif
timer.gif
Time - Elapsed game time is 0.50 seconds
cond.gif
Conditions
actions.gif
Actions

join.gif
page.gif
Custom script: set udg_NO_ITEM_TYPE = 0
join.gif
set.gif
Set MAX_ITEM_COMBINES = 4
join.gif
set.gif
Set MAX_ITEM_COMBINES = MAX_ITEM_COMBINES + 1
join.gif
comment.gif
-------- --------
join.gif
set.gif
Set ItemNum = ItemNum + MAX_ITEM_COMBINES
join.gif
set.gif
Set CombineItem[ItemNum + 0] = Rocket Cannon (Dummy Buy)
join.gif
set.gif
Set CombineItem[ItemNum + 1] = Rocket Cannon
join.gif
set.gif
Set CombineItem[ItemNum + 2] = Double Rocket Cannon
join.gif
set.gif
Set CombineItem[ItemNum + 3] = Triple Rocket Cannon
join.gif
set.gif
Set CombineItem[ItemNum + 4] = Quad Rocket Cannon
join.gif
comment.gif
-------- --------
joinbottom.gif
set.gif
Set NUM_BASE_COMBINES = ItemNum / MAX_ITEM_COMBINES
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
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.
 
Level 8
Joined
Jun 26, 2019
Messages
318
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:
set.gif
Set MAX_ITEM_COMBINES = 4
This should be in Integer with unchecked array and default 0.
 
Level 8
Joined
Jun 26, 2019
Messages
318
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.
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
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.
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.

I mean, I found this upgrading item triggers for to build my own combining weapons for my new Battleships map
You did not find them. I made them. And I wrote them specifically to work for what you described you need.
 
Level 8
Joined
Jun 26, 2019
Messages
318
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.
 

Attachments

  • Battleships Weapon Combining Test2.w3x
    1.9 MB · Views: 17
Level 8
Joined
Jun 26, 2019
Messages
318
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?
 

Attachments

  • Battleships Weapon Combining Test3.w3x
    1.9 MB · Views: 22
Last edited:
Level 39
Joined
Feb 27, 2007
Messages
5,013
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.)
when I clicked the Rocket Cannon from shop, it completely created Double Rockets to full of inventory.
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.
 
Level 8
Joined
Jun 26, 2019
Messages
318
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.
 

Attachments

  • Battleships Weapon Combining Test4.w3x
    1.9 MB · Views: 21
  • Item Level Up System 2.w3x
    19.3 KB · Views: 22
Level 39
Joined
Feb 27, 2007
Messages
5,013
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 said:
Set CombineItem[ItemNum + 0] = Rocket Cannon (Dummy Buy)
Set CombineItem[ItemNum + 1] = Rocket Cannon
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.
 

Attachments

  • Battleships Weapon Combining Test3.w3x
    1.9 MB · Views: 32
Status
Not open for further replies.
Top