# Inventory in Rpg in flash

**URL:** <https://forum.kirupa.com/t/inventory-in-rpg-in-flash/265143>\
**Category:** Uncategorized\
**Created:** [July 4, 2008, 4:11pm UTC](https://forum.kirupa.com/t/inventory-in-rpg-in-flash/265143 "2008-07-04T16:11:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcogiannini](https://avatars.discourse-cdn.com/v4/letter/m/bbce88/32.png) [@marcogiannini](https://forum.kirupa.com/u/marcogiannini)\
**Post date:** [July 4, 2008, 4:11pm UTC](https://forum.kirupa.com/t/inventory-in-rpg-in-flash/265143/1 "2008-07-04T16:11:13Z")

</div>

Hello all,  
I’m a newby in flash, and I wish to create an adventuregame (Rpg, first person view) similar to many others, just for testing my drawing abilities.

The general coding of the game is clear enough to me, but I need an inventory in which to keep useful objects during the game.  
To store items inside the inventory, I used the simple tutorial suggested here in kirupa. I attached this code over the item-mc:

on (release) {  
\_root.addToSlot (this)

this code call the addToSlot function

function addToSlot (item) {  
if (!item.found) {  
item.\_x = eval ("itemSlot) + currentslotnum).\_x;  
item.\_y = eval ("itemSlot) + currentslotnum).\_y;  
item.found = true;

…and then one is added to currentslotnum (with currentslotnum++), a variable set to one in the beginning

With this code the inventory is actually functioning, the item goes to the first free slot in the inventory. But obviously I need to use later this item in the game (i.e. a key inside a hole). How can I do this? I tried with a Mc containing a button: with StartDrag and StopDrag method coded with hitTest or \_droptarget nothing happens, that is the Mc don’t come out of the inventory - the drag command seems to be ignored.

anyone knows how to do?  
I need something similar to skutnik’s Daymare town  
[http://www.daymaretown.com/dmt1.html](http://www.daymaretown.com/dmt1.html)

o something similar…

> **[Escape Online](http://www.minijuegos.com/juego/escape-i6821)**
>
> Te han encerrado en una celda, usa la lógica y escapa de allí. ¡Cualquier cosa puede pasar!

tankhing you all in advance

---

<div class="post-metadata">

**Author:** ![arosemena](https://avatars.discourse-cdn.com/v4/letter/a/a3d4f5/32.png) [@arosemena](https://forum.kirupa.com/u/arosemena)\
**Post date:** [July 7, 2008, 4:32am UTC](https://forum.kirupa.com/t/inventory-in-rpg-in-flash/265143/2 "2008-07-07T04:32:17Z")

</div>

i did an rpg some time ago, what used was IDs for items (with linkage), and the hidden variables where items IDs stored, and when u open the inventory it do an attachmovie of each id in each slot, then if i want to remove an item i would use a function that check the hidden variables for the id of the item and then remove it, for droping and taking i used 3 frames for equipable items and 2 for normal items, first frame was for item in floor, second for item in inventory and third(if used) for equipment, each frame with his button for each function(take, drop, unequip) hope this help

---

<div class="post-metadata">

**Author:** ![nathan99](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@nathan99](https://forum.kirupa.com/u/nathan99)\
**Post date:** [July 7, 2008, 8:54am UTC](https://forum.kirupa.com/t/inventory-in-rpg-in-flash/265143/3 "2008-07-07T08:54:21Z")

</div>

[http://www.n99creations.com/vieweg.php?id=19](http://www.n99creations.com/vieweg.php?id=19)

---

<div class="post-metadata">

**Author:** ![marcogiannini](https://avatars.discourse-cdn.com/v4/letter/m/bbce88/32.png) [@marcogiannini](https://forum.kirupa.com/u/marcogiannini)\
**Post date:** [July 10, 2008, 4:18pm UTC](https://forum.kirupa.com/t/inventory-in-rpg-in-flash/265143/4 "2008-07-10T16:18:35Z")

</div>

thank you nathan and arosemena

I’m actually trying to develop your suggestion  
see you
