0 Favourites

How do I Make Switchable Weapons/Item Slots?

  • I have been wanting to make an exploration based action-rpg, similar to the original NES Zelda for a while now and after looking into a lot of different possible game engines I believe that Construct might be the perfect one for the job. I have very little experience with these sorts of things unfortunately, the only other game engine I worked with in the past was RPG Maker XP.

    I've seen tutorials on here for drag-and-drop inventories and life-bar HUD's and they seem like they will go a long way to helping this project come to life, but before I can work on the game I need to figure out how to do the player controls.

    Ideally I want the player to be able to set any 2 items to their usable items slots (sword, shield, torch, potion, etc.) and then use them to attack enemies or solve the games puzzles, but a lot of the game examples I've seen here have fixed controls. Is it possible to have a variety of potential items/player actions that can only be toggled on or off when the game character has the item equipped, and make it so that the item/ability uses the specific item slot control for use?

    (Example: Item slots A and B. If the player equips "sword" to A, then pressing A will activate sword, but if he equips it to B then B will activate sword)

    My apologies for the long rambling post.

  • A quick search on tutorials and you get that:

  • Those look like good tutorials, but they seem to be tutorials for inventory systems. Inventory is a part of the question I asked, but I was mostly asking if/how it is possible to have player input commands be able to be toggled between different inventory items.

    You know, being able to set items from the inventory into 1 of 2 action command slots and then having the item in that slot determine the action that takes place on the screen when the player inputs the command.

    Apologies once again if my question was answered in the tutorials posted but I read through them and I'm not sure they would work for this particular problem (though that may be due to my inexperience with this engine).

  • Could you simply have all your inventory items placed into a family, and give the family two instance variables, for example 'In Slot A' or 'In Slot B' . Pressing the A button activates the object for 'In Slot A' that is true, and pressing the B button activates the object that for 'In Slot B' is true.

    Sorry if that's not very well explained, I can further expand on this method if you'd like, and could probably cobble together a small capx to illustrate what im trying to get at.

  • That sounds like a simple and elegant solution - if making a CAP file wouldn't be too much trouble I'd be interested in seeing one, but if it would be a hassle don't worry about it; I can probably work something out from your description.

    Thanks a lot for the help!

  • Hope it works out for you!

    I'll rustle up a .capx for you within the next day or so, it would probably be good for me to have an example of this sort of thing to hand! Just a thought : you will need the personal license level of C2 to create families, though you can probably find a workaround for it anyway.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Finally got around to doing the .capx, hope this provides a decent example to anyone out there, I rushed through it a bit so it doesn't like it if you put two inventory objects in the same slot, but hopefully this will do what you need!

    https://dl.dropboxusercontent.com/u/245987915/2slotInventory.capx

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)