I really have no idea how to make item slots, bags or for that matter, a shop. Does anyone have any ideas? I know it is possible (I've seen games with them made by MMF2, I just don't know how they did it).
Printable View
I really have no idea how to make item slots, bags or for that matter, a shop. Does anyone have any ideas? I know it is possible (I've seen games with them made by MMF2, I just don't know how they did it).
dude, i have been sweatin over this for like ever. and i STILL cant figure it out. but i did have a small idea...
first you would make a counter.
and instead of numbers go and change the numbers to items.
with 0 being nothing, 1 could be a potion, 2 could be ether.
then what you would do is make an on loop event saying to create x ammount of these counters at start of frame, -32y postition from the last one.
then when you pick up an item,like a potion you would check if htere is one of those counters thats NOT over 0 (zero meaning thers no item in that space)
so if there is a 0 then you would take the value and change it to whatever potion is (1 in this example)
I just came up with this on the spot so it might not work. Ive been trying all week to come up with an idea for an inventory so im goig to try this as well, ill tell you if it works out.
I recommend trying the "Magic Deque" extension. It holds arrays of data and you can sort / move the data around. Perfect for shops / inventories.
Sorry Random, but I don't quite understand arrays. All I know is that that there is a value named by coordinates and you'd have to set each a value. Actually, (sudden freak brainstorm) if I combine your idea, and ZayLong's idea that might just work. Thanks!
Actully, using an active object would be better to use as an item slot cuz you can set each of the 32 directions to a different item instead of having 9 with a counter object.
im gettin ideas as well!!
an array sounds like it could work. im gonna try that as well.
You can use a counter too, just set it to "animation" and you can have as many icons for the items as you need.
If you only use directions your limited to only 32 items, if you use animations you can have over 9000 items.
Events
Always
-Set Direction ("Item") to #Alterable Value A("Item")#
-Set Animation ("Item") to #int(Alterable Value A("Item")/32)+1#
I'm not sure if this will work properly but it's worth a shot.
im still having trouble adding items though.
how would you make it so that when you find a potion or whatever it goes on the next empty avalible space. ive been doing this since 3:00PM!
Complicated, not even I understand... but here is a post of an inventory example made by DanielRehn
http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Board=5&Number=22419&S earchpage=1&Main=3318&Words=Inventory+DanielRehn&t opic=0&Search=true#Post22419
Hope it helps :)
This is exactly where the magic deque is helpful - sorry, I should have said "lists" instead of "arrays". Because that's what it does. Note that it won't allow the user to arrange items at will - it will always "snap" them together. So what you can do is loop through your deque everytime something changes, and update your inventory objects accordingly. You can use the loop position multiplied with the size of the items to set their position accordingly on screen.Quote:
Originally Posted by ZayLong
Or have one object at every slot, as recommended before, and set the animation frame to the graphic. If there is no item, make it invisible. Then again loop through the deque, and update each object.
If you use a real array instead of the magic deque, you can allow the player to place his items wherever he wants, in the inventory (maybe a better idea). To find the next empty space, just loop through the array indexes and once you find an empty value, there's your spot.
Dragonguy's idea is good, if i had a whole ton of objects, i could animate every single one. In one object. I got bored yesterday and tried to use the save game object (I never figured how to save with it until now!) I managed to fiddle around with it so that I could save position of the character, frame it was in and all the alterable variables. If I used alterable variables to contain my items, I'd be able to retreive them after I end the program.
Hm. Using the animation frames for the objects won't let you animate them..