Перейти к основному контенту

Поиск

Inventory system?

  • Supposer

    B) Have you confirmed that the one on the ground has lost power? Try using playtest mode to see gadgets etc. while you're playing the game. You should be able to tweak the object and see if it's really being powered off or not. https://indreams.me/guide/palette-glossary/assembly/modes/playtest-mode

  • VoodooChild616

    Hey, so say for example you have a sword that you want the user to pick up:


    Character's Microchip

    1. Add a Tag onto the microchip. Name the tag "SWORD" (i usually use all-caps for this sort of thing but you don't have to).

    2. Hook up the Tag output (the one for when the Tag is detected) to an "And" gadget. Hook up the output of the Square button on the Controller to the other input of the And gadget.

    3. Add a Variable Modifier to the microchip, set the variable name to something like "CONNIE_HAS_SWORD" (or whatever your character is called), set the operation type to "set", and the operation value to 1.

    4. Hook up the output of the And gadget to the power input of the Variable Modifier.

    5. Create another Variable Modifier with the same variable name but change the Operation Type to "get". Hook up the "variable value" output of this Variable Modifier to the power port of the Sword object in the character's hand.


    Collectable Item's Microchip (the one that will be "collected")

    1. Add a Trigger Zone to the Microchip and set the "things to detect" to Tag and setup a zone to detect the tag which is roughly where your character will be when they can collect the object. Set the name of the Tag to detect to "SWORD" (you can use up and down on the d-pad to cycle through Tags already in your scene).

    2. Add a Variable to the microchip. Set the Variable name to "CONNIE_HAS_SWORD".

    3. Add an "And" gadget to the microchip. Hook up the "Detected" output of the Trigger Zone into the And's first input. Hook up the output from the Variable's "value increased" port into the other input on the And.

    4. Add a Destroyer to the microchip and hook up the output of the And gadget to the power port of the Destroyer.


    Summary

    What you've got now is a Variable called "CONNIE_HAS_SWORD" which by default is set to 0 and therefore does not power-on the sword in the character's hand. When the character moves within the trigger zone and presses square the variable is increased to 1 which powers-on the sword. On the collectible item, the Variable increasing triggers an output which, along with the detection of the character in the trigger zone causes the Destroyer to be activated, deleting the item from the scene.


    Next steps

    Next you should try repeating the process with more objects / variables.

    Also, the Operation Type of a Variable Modifier on your character could be set to "add" instead of "set" to give you a count of the number collected rather than just an on / off. For example, this could be used for ammo.

    Once you have multiple objects in your inventory you'll need a way to cycle through the objects you have.

    You could use a Selector for this, with each input being the Variable Modifier for that object (ie "CONNIE_HAS_SWORD") and the output going to a different object in the character's hand (ie the Sword) and an input from the user's controller moving the selector on until the selector's output signal is "on" (ie the character has the object in their inventory)

Войдите в службу, чтобы оставить комментарий.