• 🏆 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!

Inventory System

Status
Not open for further replies.
Level 2
Joined
Aug 11, 2015
Messages
8
Alright, so I want to make a simple inventory system. There are 6 slots in hero inventory. I planned to make slot 1,2 for various items like amulets rings etc, slot 3 for right hand items, slot 4 for helmet, slot 5 for left hand items and slot 6 for armor.

First trigger I made is something like this:
  • PickUP Armor
    • Wydarzenia
      • Unit - A unit Aquires an item
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Item being manipulated)) Equals Dummy Armor Item
          • (Item-type of (Item being manipulated)) Equals Dummy Armor Item 2
    • Actions
      • Set Temp_Position = (Position of (Item being manipulated))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Item-type of (Item carried by (Hero manipulating item) in slot 4)) Equals Dummy Armor Item
              • (Item-type of (Item carried by (Hero manipulating item) in slot 4)) Equals Dummy Armor Item 2
        • Then - Actions
          • Hero - Drop (Item being manipulated) from (Hero manipulating item)
          • Item - Move (Last dropped item) to Temp_Position
          • Game - Display to (Player group((Owner of (Hero manipulating item)))) for 1.50 seconds the text: Hero already has an armor.
        • Else - Actions
          • Unit - Order (Hero manipulating item) to move (Item being manipulated) to inventory slot 4
It works fine until I manually move an armor from slot 4 to somewhere else.
So what I am tryin' to do now is to find an event "Hero moves an item in the inventory" or somehow manage to prevent the player from moving item between slots. Any ideas?
 
Level 6
Joined
Aug 28, 2015
Messages
213
There should be an option in the object editor for items like:
Item can be droped
Set this to false and the player shouldn'tbe able to move the item.
But then you need to implement a way how to sell them you could use a sell ability based on chanell, with target = items.
The ability will be added or removed from the hero when comes in or out of range of a shop.

Or I think there is a way how to detect item movement search for "right click item stack and splitt" and look there in the triggers,
After the move event just check every position and if the type don't match with the position swap the items back or drop it.
 
Status
Not open for further replies.
Top