How do I make the Equip/Unequip system in my game?

Get help using Construct 2

Post » Sun Dec 04, 2016 11:44 pm

hello, first of all english isn't my first language so i'm sorry if i write anything wrong, so...
i'm creating a rpg game, i've created an array for storing the player itens (the game has an inventory of course) but i'm having a lot of difficulties manipulating the array, here's what i want to do:

- if the player clicks the chest slot, and the chest slot already has a chestplate equipped, then the code would look for the first empty array space to store the chestplate in (so that would be an Unequip system) but i can't figure out how to do that, the way i tried to do actually replaces all the empty inventory slots to the chestplate instead of only the first one available, would love some help since i really don't know what to do.
B
7
S
2
Posts: 16
Reputation: 555

Post » Mon Dec 05, 2016 9:49 pm

Do your items have unique IDs?
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,415
Reputation: 4,824

Post » Tue Dec 06, 2016 12:17 am

gumshoe2029 wrote:Do your items have unique IDs?


no, i just created an array to create some "Slots", "Slot" is a sprite that i've created so he has all the animations (for example if the value is 1 then the slot animation will be a potion, etc)
B
7
S
2
Posts: 16
Reputation: 555

Post » Tue Dec 06, 2016 4:42 am

so your item Id for potion is 1... continue...
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,415
Reputation: 4,824

Post » Tue Dec 06, 2016 11:46 am

I want suggest you to use an invisible tilemap and check if the object is at a specific tile position, if so, improve the player with its stats.

To know the tileposition, you can check the positiontotileX and Y of the tilemap
Image
B
106
S
23
G
17
Posts: 1,357
Reputation: 22,137

Post » Tue Dec 06, 2016 12:53 pm

gumshoe2029 wrote:so your item Id for potion is 1... continue...

TELLES0808 wrote:I want suggest you to use an invisible tilemap and check if the object is at a specific tile position, if so, improve the player with its stats.

To know the tileposition, you can check the positiontotileX and Y of the tilemap


The only problem i'm having is to store an item only in the first empty slot instead of all the empty inventory slots, what i wanted to do is if the player clicks on an equipped item the code would remove this piece from the equipment slots and store it in only the FIRST empty slot available of the inventory, the way that i tried to do is checking the array XY but it doesn't change the value (to store the item) of only the first empty slot but ALL the slots, i don't know how to fix it i'm using the array in a wrong way.
B
7
S
2
Posts: 16
Reputation: 555

Post » Tue Dec 06, 2016 12:59 pm

try using "once while true" conditional.
Image
B
106
S
23
G
17
Posts: 1,357
Reputation: 22,137

Post » Tue Dec 06, 2016 1:21 pm

TELLES0808 wrote:try using "once while true" conditional.


i tried that and it didn't work too, i guess that "runs once" means that he will fill the entire array only 1 time, oh god...
B
7
S
2
Posts: 16
Reputation: 555

Post » Tue Dec 06, 2016 3:07 pm

Well, take a printscreen of you events and place here, I can't figure out what you're doing wrong.
Image
B
106
S
23
G
17
Posts: 1,357
Reputation: 22,137

Post » Tue Dec 06, 2016 4:27 pm

Message: Kagubro can only post plain text URLS until they have 500 rep. 4 URLS modified. Why?
TELLES0808 wrote:Well, take a printscreen of you events and place here, I can't figure out what you're doing wrong.


I think i've managed to explain everything right, follow the order of the screenshots:

1) http://prnt.sc/dg3dmn
2) http://prnt.sc/dg3e32
3) http://prnt.sc/dg3e97
4) http://prnt.sc/dg3ef3
B
7
S
2
Posts: 16
Reputation: 555

Next

Return to How do I....?

Who is online

Users browsing this forum: rayolf and 7 guests