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.

[General] Buying items with full inventory

Discussion in 'World Editor Help Zone' started by Strydhaizer, Sep 3, 2019.

  1. Strydhaizer

    Strydhaizer

    Joined:
    Feb 28, 2013
    Messages:
    1,504
    Resources:
    4
    Models:
    1
    Maps:
    1
    Template:
    2
    Resources:
    4
    Hello guys, I just want to ask if it is possible to acquire an item (or in this case, buy a new item) with hero having occupied all the slots of inventory? I want to store the amount of charges to an integer variable, so when the hero acquire a charged item, a random item should be dropped from hero's inventory - to give space for the item acquired by the hero, store the amount of charges the item to the integer variable, remove the bought charged item from the hero's inventory, and reacquire the random item dropped. It should prevent a warning that the hero occupied all slots ("Inventory is full" warning) when buying a charged item with full inventory.

    - Also what is the order string/id of hero acquiring an item?
     
    Last edited: Sep 3, 2019
  2. Ceday

    Ceday

    Joined:
    Feb 22, 2010
    Messages:
    1,077
    Resources:
    0
    Resources:
    0
    As far as I know only way to enable buy with full inventory is, your shop sells dummy units. When an unit is bought from the shop:
    1- Corresponding item is created
    2- If buying unit has empty inventory slot or item is a charged item that buying unit already has (like a hp/mana pot) it is added to buying unit's inventory. If there is no available slot put it near buying unit or wherever you want.
    3- Bought dummy unit is removed from the game.
     
  3. Strydhaizer

    Strydhaizer

    Joined:
    Feb 28, 2013
    Messages:
    1,504
    Resources:
    4
    Models:
    1
    Maps:
    1
    Template:
    2
    Resources:
    4
    Oh shiz I forgot that it's possible to buy mercenary (instantly created) units in the game. Thanks for the idea! :D
     
  4. Ricola3D

    Ricola3D

    Joined:
    Feb 27, 2019
    Messages:
    224
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Personnally I used dummy items (copy of my stackable items with "use automatically when acquire = true"), and a version I modified of the Easy Item Stack 'n Split v2.7.4 system.

    As a consequence: it adds the charges to your inventory. If max charge is reached, it drops the remaining charges on the floor.

    If you want the modified version of Easy Item Stack 'n Split v2.7.4, I can send it to you :)
     
  5. Strydhaizer

    Strydhaizer

    Joined:
    Feb 28, 2013
    Messages:
    1,504
    Resources:
    4
    Models:
    1
    Maps:
    1
    Template:
    2
    Resources:
    4
    I cannot use that because I made an Inventory System that adds an item to an item (array) variable when the hero uses the item, so when the item has "Automatically use items when acquired" set to true then it will go straight to the item var.

    But still, thanks for your help! :D
     
  6. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    3,024
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Tomes can also be bought with a full inventory, so you could use those as dummy items. Just make sure to clean up the tome models with Item Cleanup 1.3.
     
  7. Ceday

    Ceday

    Joined:
    Feb 22, 2010
    Messages:
    1,077
    Resources:
    0
    Resources:
    0
    What happens when a non-hero unit tries to buy? Asking because never tested it myself.
     
  8. Wrda

    Wrda

    Joined:
    Nov 18, 2012
    Messages:
    1,125
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Last time I checked, game crashed. Was long time ago though.
     
  9. BloodSoul

    BloodSoul

    Joined:
    May 10, 2009
    Messages:
    755
    Resources:
    2
    Spells:
    2
    Resources:
    2
    It crashes because the unit is attempting to acquire an ability which modifies a hero attribute (XP, agility, strength, intelligence). However, they still can buy items which are set to be "used automatically when acquired". E.g. Manual of Health (+50 HP) can be bought by units.
     
  10. deepstrasz

    deepstrasz

    Map Reviewer

    Joined:
    Jun 4, 2009
    Messages:
    11,176
    Resources:
    1
    Maps:
    1
    Resources:
    1