Inventory problem

  • #1, by LupaShivaMonday, 22. September 2014, 23:54 6 years ago
    Hello everyone, I been two days trying to solve a problem, and I can't seem to find the way to make it work,and I think its more simple than what I think, imagine you have the inventory with the items you take, and you have some placeholders for items but specific items, for example I drop a pair of pants from my basic inventory and dropped it in the specific placeholder for cloths, and when dropped it stays in that placeholder and does a specific action, don't know if I'm being xplicit.

    Thank you all and sorry for my english

    Forum Fan

    122 Posts


  • #2, by afrlmeTuesday, 23. September 2014, 13:30 6 years ago
    I believe you may need to create a custom inventory system for that...

    Create the placeholders as action areas & then in same interface create the items as animations & then use conditions, values & the set animation position to place items where needed etc.

    The default inventory system is a bit basic & you can't really adapt it into something more dynamic.

    Imperator

    6842 Posts

  • #3, by LupaShivaTuesday, 23. September 2014, 15:41 6 years ago
    Woa! sorry to insist but can you explain that a little better?

    Thank you for the help

    Forum Fan

    122 Posts

  • #4, by afrlmeTuesday, 23. September 2014, 16:27 6 years ago
    I believe you are talking about an inventory system with similar traits to rpg games in which the player can manipulate abilities or stats of a character by applying certain clothing or accessories to said character, no?

    The default inventory system of Visionaire Studio works in the same way as the save system does. It has infinite slots & it also adds the items to the next empty slot in the inventory, thus you can't manually specify a slot in which an item should go, well not without using lua at any rate & even then you would have to manipulate all item/inventory positions each time you added or removed an item.

    I'm not sure if it's possible for me to explain what I mentioned in my previous reply, in a few words.

    The basic gist of it is:
    1. Create an interface
    2. Create the inventory slots, but instead of setting them as item placeholders, set them as action areas.
    3. Now create more buttons as action areas - 1 per game item & give each one same name as one of your game items.
    4. Create an animation in each one & name it same as button name. Add the static or animated item image to it & set the loop amount to infinite.
    5. You need to create a condition for each item which you will enable/disable if item is or is not in characters inventory.
    6. After you drop an item on a slot, you will set the animation position to the slot & perform whatever other actions you need it to do.

    I can't really go into loads of detail, otherwise I will be here all day, as this is all theoretical. Sorry.

    Imperator

    6842 Posts

  • #5, by LupaShivaTuesday, 23. September 2014, 18:39 6 years ago
    Yes its that what i pretend, im trying a mix between rpg and point and click,and i actually managed to do it, created hitpoints bar, combat, random traps and enemies, leveling, but equiping an item its getting me nuts, but i think im understanding what you explain, ill try it =)

    Thank you a lot

    Forum Fan

    122 Posts

  • #6, by LupaShivaWednesday, 24. September 2014, 22:58 6 years ago
    I tried and I can't do it =( Because in the buttons there's no option for drop an item, but probably something im doing wrong =(

    Forum Fan

    122 Posts

  • #7, by afrlmeWednesday, 24. September 2014, 23:04 6 years ago
    I think that is because typically you would drop the item on another item & not on the inventory slot. Interfaces only allow immediate execution commands.

    Having said that... we can use the normal left click command & then use an execute a script action part with a bit of lua script to check if an item is held & if it is being dragged & if so then we trigger off some other actions.

    I'm not going to go into detail about the code needed for this right now though. I need to think about it a little first as I currently have a bit of a nasty headache.

    Imperator

    6842 Posts

  • #8, by LupaShivaThursday, 25. September 2014, 16:14 6 years ago
    Hum ok dont worry ill try it again, actually i dont get nothing of script but ill try to fix it.

    Thank you again

    Forum Fan

    122 Posts

  • #9, by afrlmeThursday, 25. September 2014, 16:39 6 years ago
    You would create a called by other action below the left click action which you will add the actions you want it to perform when you drop an item onto the button.

    You would add an execute a script action part to the left click action with something along the lines of...
    if game:getLink(VGameUsedItem):getName() == "item_name" then
    startAction("Interfaces[interface_name].InterfaceButtons[button_name].ButtonActions[action_name]")
    end
    1
    2
    3
    4

    ...obviously you need to replace the names with the actual names of the interface, button & called by other action. Names are case sensitive.

    P.S: I've not tested this code. It's entirely off the top of my head.

    Imperator

    6842 Posts

Write post