item re-pickup system?

educator

New Member
Reaction score
9
sorry about the dodgy name i didn't know what to call it.
ill tell you about my map first or it wont make much sense. each player has 1 ship, they use that ship to destroy their enemies ship. they only have one unit at a time. they can buy items to help them destroy other ships. when their ship dies they get to pick a new one. what i want is for the new ship to get the items their other ship had. the ships are NOT heroes and they can pick a different ship when their original dies. how do i make triggers that give the new ship the items from the old ship?
 

Moridin

Snow Leopard
Reaction score
144
Try something like this:

Trigger:
  • Trigger 1
    • Events
      • Unit - A unit dies
    • Conditions
      • Unit-type of (Triggering unit) Equal to Ship
    • Actions
      • For (Integer A) from 1 to 12 do actions
        • loop - Actions
          • If (multiple conditions) do (then actions) else do (else actions)
            • If - Conditions
              • Player(Integer A) Equal to (Triggering Player)
            • Then - Actions
              • Set Item1[(Integer A)] = Item carried by (Triggering unit) in slot 1
              • Set Item2[(Integer A)] = Item carried by (Triggering unit) in slot 2
              • Set Item3[(Integer A)] = Item carried by (Triggering unit) in slot 3
              • Set Item4[(Integer A)] = Item carried by (Triggering unit) in slot 4
              • Set Item5[(Integer A)] = Item carried by (Triggering unit) in slot 5
              • Set Item6[(Integer A)] = Item carried by (Triggering unit) in slot 6


...and then when they respawn, you simply give them back the items they had (which are stored in the variables).

Notes: Freehand. All the Item1, Item2, etc variables are item variable arrays of size 13.
 

educator

New Member
Reaction score
9
ok, well i got what you said, but iv got no idea how "interger a" works, and the trigger says "hero" does this mean that ill have to remake all my units as heroes? ( just a little question, there is a unit ability called "hero" does this mean that the unit with the ability will be treated as a hero in triggers?) im not real good with the more advanced stuff ( or the basic if "interger A" is basic stuff)
 

Moridin

Snow Leopard
Reaction score
144
Alright. Firstly, you do not need to convert all your units to heroes. Even though the action is listed under Hero, it will work for any unit with an inventory.

Secondly, Integer A works like this: It's a loop, that runs a number of times. In the case I gave it runs 12 times, each time it increments itself by 1. So first integer A = 1. It runs all the actions under it. When it finishes all the actions in the loop, it increments integer A, making it 2. Runs the loop again, makes it 3....and so on.

Because you have a max of 12 players, and because you can have 1 unit per player, you will need seperate variables to store the 6 items of each player. Unfortunately, wc3 does not support 2D array variables, so you either have to have 12 item variable arrays that can store 6 items each, or 6 item variables that can store 12 each (to signify the seperate players). I find 6 variables with a size of 12 easier. Note that either way, you have the same number of variables (12 x 6 = 72).

Hope you understand how it works now, if you still don't, I'll go into a little more detail.
 

educator

New Member
Reaction score
9
thats cool, but i cant figure out how to give the items to the player's next ship, how would i do this?
 

Moridin

Snow Leopard
Reaction score
144
You can use a similar loop with the action:

Hero - Give item to hero

to give the required items to the respawned unit.
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top