1. A slave to two rhythms, the 22nd Terraining Contest is here.
    Dismiss Notice
  2. The heavens smile on the old faithful. The 16th Techtree Contest has begun.
    Dismiss Notice
  3. The die is cast - the 6th Melee Mapping Contest results have been announced. Onward to the Hive Cup!
    Dismiss Notice
  4. The glory of the 20th Icon Contest is yours for the taking!
    Dismiss Notice
  5. Shoot to thrill, play to kill. Sate your hunger with the 33rd Modeling Contest!
    Dismiss Notice
  6. Do you hear boss music? It's the 17th Mini Mapping Contest!
    Dismiss Notice
  7. 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.

Restocking a sellable unit.

Discussion in 'World Editor Help Zone' started by Drazhar, Mar 26, 2012.

  1. Drazhar

    Drazhar

    Joined:
    May 11, 2010
    Messages:
    213
    Resources:
    0
    Resources:
    0
    Hi guys, I'm trying to work out if there's a way to restock a unit, as in;

    A building sells a unit and the stock of that unit goes to 0, so no more can be bought. When that unit dies, the stock of that unit goes back to 1 so that another can be bought. I've already thought about replacing the building but that will reset any other purchases too, I've also thought about limiting players to only a certain amount of that unit, but that doesn't apply to 'sold' units, only trained - also, I only want to have one of these units on the field at the time, not 1 per player, so selling and (somehow) restocking once it dies seems to be the way to go. I'm hoping there's a simple trigger function I've missed :p.

    - thanks :)
    :goblin_boom:
     
  2. Lifee_72

    Lifee_72

    Joined:
    Mar 5, 2009
    Messages:
    246
    Resources:
    0
    Resources:
    0
    Ok try this :
    • Untitled Trigger 001
      • Events
        • Unit - A unit Sells a unit
      • Conditions
        • (Unit-type of (Triggering unit)) Equal to Footman
      • Actions
        • Neutral Building - Remove Footman from all marketplaces


    Note : Make a variable type unit and set the variable to Selling Unit.

    • Untitled Trigger 002
      • Events
        • Unit - A unit Dies
      • Conditions
        • (Unit-type of (Triggering unit)) Equal to Footman
      • Actions
        • Neutral Building - Add Footman to (Triggering unit) with 1 in stock and a max stock of 1


    Note 2 : Here use the variable and replace triggering unit with your variable.
     
  3. Drazhar

    Drazhar

    Joined:
    May 11, 2010
    Messages:
    213
    Resources:
    0
    Resources:
    0
    That's it! That's the function I was looking for! Neutral building... urgh. Thanks Lifee :ogre_haosis:
     
  4. Adiktuz

    Adiktuz

    Joined:
    Oct 16, 2008
    Messages:
    9,674
    Resources:
    23
    Models:
    2
    Packs:
    1
    Maps:
    1
    Spells:
    16
    Tutorials:
    1
    JASS:
    2
    Resources:
    23
    Take note that remove item/unit from stock only works in the Item/Unit is added to the shop via triggers...