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 haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Lead your forces to battle in the 15th Techtree Contest. The call is yours, commander!
    Dismiss Notice
  4. The reforging of the races is complete. Come see the 14th Techtree Contest Results.
    Dismiss Notice
  5. It's time to choose your horse in the race - the 32nd Modeling Contest Poll is up!
    Dismiss Notice
  6. 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.

Giving items to Units

Discussion in 'Map Development' started by DeathDeamon, May 12, 2005.

  1. DeathDeamon

    DeathDeamon

    Joined:
    May 9, 2005
    Messages:
    3
    Resources:
    0
    Resources:
    0
    I cannot figure out how to give items to a unit with inventory, not a hero. Because there is no trigger that I know of for giving a unit an item.

    What i want to do is when a unit is created it is given an item that would be created once it finished its training
     
  2. klovadis

    klovadis

    Joined:
    Jan 3, 2005
    Messages:
    92
    Resources:
    0
    Resources:
    0
    1) just try using the hero triggers, i think it should work anyways.

    2) after creating a unit, create the item next to that unit and then order your created unit to "rightclick" on the item.
    success,

    klovadis

    [Edit: Dont forget to give "itembags" ability to your units first]
     
  3. Rui

    Rui

    Joined:
    Jan 7, 2005
    Messages:
    8,506
    Resources:
    8
    Maps:
    8
    Resources:
    8
    Don't you ahve the Frozen Throne or what? Just use the Inventory(hero) ability (add it to the unit) and the items will have the effect on units. I think its preety simple... :roll:

    -Rui
     
  4. Minkorok

    Minkorok

    Joined:
    Jan 9, 2005
    Messages:
    108
    Resources:
    0
    Resources:
    0
    yes whatever unit you are trying to give the items to has to have an inventory, once you have set that in the object editor then make a trigger something like this:

    • event
      Unit - A Unit Finishes training a unit
      Condition
      //if there is no specific unit then dont specify the unit here, if there is only a specific unit trained you want to have the item then:
      (unit trained) is equal to (IGetTheItems)
      Action
      Hero - Create "Item for the Unit" and give it to (trained unit)

    remember you can always specify for special units with the "action" "if/then/else" string (if unit one then item 1, if unit 2 then item 2)

    hope this helps :)
     
  5. Dragon_Lord

    Dragon_Lord

    Joined:
    Jul 20, 2004
    Messages:
    156
    Resources:
    0
    Resources:
    0
    First in the Object Editor you would give your unit an inventory at the top where it says "Abilities".

    Then create your trigger and after it says "Unit - Create 1 (your unit)" add Set DropUnit for Last created unit. Then whenever you want the item dropped on your unit, you would do the following trigger. But just to get this right, you said that once a unit finishes training, you wanted the item dropped on the unit. So:

    Events
    Unit - A unit finishes construction

    Conditions
    Unit - Trained unit equal to (your unit)

    Actions
    Unit - Create 1 DropItemDummy
    Unit - Set expiration timer on Last created unit to 1.00 seconds
    Item - Create (your item) at position of DropItemDummy
    Set ItemDropped to Last dropped item
    Unit - Order DropItemDummy to right-click ItemDropped
    Unit - Order DropItemDummy to drop ItemDropped on (your unit)

    Have fun!

    Edit: I had started writing this before someone else had posted... but I had to go somewhere so I couldn't finish. Anyway, I hope that this can still help you.