Jump to content


Photo
- - - - -

Easy Inventory Example


  • Please log in to reply
15 replies to this topic

#1 Lithium

Lithium

    Spitfire Member

  • GMC Member
  • 1477 posts
  • Version:Unknown

Posted 08 October 2008 - 11:54 AM


Edited by pat_stix, 11 October 2008 - 09:20 AM.

  • 0

#2 nightspirit174

nightspirit174

    GMC Member

  • New Member
  • 2 posts

Posted 09 October 2008 - 10:21 AM

  • Title: Easy Inventory Example
  • Description: An easy to implement inventory.
  • GM Version: GM7 only
  • Registered: No (you might need to change a few things draw_sprite_ext>draw_sprite)
  • File Type: .GMK
  • File Size: 128kb
  • File Link: Inventory example.gmk

could you make a non pro one??????????
  • 0

#3 Lithium

Lithium

    Spitfire Member

  • GMC Member
  • 1477 posts
  • Version:Unknown

Posted 09 October 2008 - 12:49 PM

Ok ill upload a new version. It should be compatible.
  • 0

#4 L3TH4L J14

L3TH4L J14

    GMC Member

  • New Member
  • 15 posts

Posted 09 October 2008 - 10:07 PM

Oops! Sorry, Haven't been on in a while.

Edited by L3TH4L J14, 10 October 2008 - 01:12 AM.

  • 0

#5 Astrosapien

Astrosapien

    GMC Member

  • New Member
  • 473 posts

Posted 10 October 2008 - 01:03 AM

New rules for Tutorials and Examples forum state that if you post converted versions, that you PM the author and give them the link, because the author may not be checking the thread.

As for the tutorial, the program itself was very hard to test. I couldn't tell what to do at first, at all. I had to search in the code for any key_pressed events.

It seems to function well, I suggest mentioning the controls though, it makes this very hard to learn from if you can't see the result.
  • 0

#6 Lithium

Lithium

    Spitfire Member

  • GMC Member
  • 1477 posts
  • Version:Unknown

Posted 11 October 2008 - 08:55 AM

well in your game i don't suggest you make it possible to spawn items. You should be making the controls yourself.
  • 0

#7 Hardcore.

Hardcore.

    GMC Member

  • New Member
  • 60 posts

Posted 19 October 2008 - 10:41 PM

Howcan i add more items, i changed the effects of the first 2, but i can't get the 3rd one to work. for example: a Red orb drops, i click it and if im close enough it goes into my inventory. i have 2 red orbs now, but when i click one in the inventory, nothing happens. i checked the codes, and duplicated them. (changed some numbers. the item effect script looks like this now:

if global.invo[argument0]=1
{
with(obj_speler){hp+=25}
item_delete(argument0)
inventory_sort()
exit
}
if global.invo[argument0]=2
{
with(obj_speler){sprite_index=wolf}
item_delete(argument0)
inventory_sort()
exit
{
if global.invo[argument0]=3
{
with(obj_speler){sprite_index=cow}
item_delete(argument0)
inventory_sort()
exit
}}}

What seems to be the problem? :S
thanx in advance! :P
  • 0

#8 ThunderCats

ThunderCats

    GMC Member

  • New Member
  • 190 posts

Posted 23 October 2008 - 02:11 PM

cool thnks i like the fact that its easy to import to game
good job
  • 0

#9 Hardcore.

Hardcore.

    GMC Member

  • New Member
  • 60 posts

Posted 25 October 2008 - 01:29 AM

? anyone knows?
  • 0

#10 Lithium

Lithium

    Spitfire Member

  • GMC Member
  • 1477 posts
  • Version:Unknown

Posted 25 October 2008 - 02:04 AM

You have to add your item to the end of the equip_info script in the same form as the other items.
  • 0

#11 Hardcore.

Hardcore.

    GMC Member

  • New Member
  • 60 posts

Posted 25 October 2008 - 09:42 PM

I already did that, looks like this:

switch argument0//find the item's id
{
case 1:
{
switch(argument1)//switch the parameter provided.
{
case 0://name
return("Potion")//return the correct parameter
break;
case 1://price (Sell at half)
return(20)
break;
case 2://Description
return('Restores 25hp.')
}
}
break;

case 2:
{
switch(argument1)
{
case 0://name
return("Blue orb")
break;
case 1://price (Sell at half)
return(50)
break;
case 2://Description
return('Disguise into a wolf for 3 minutes.')
}
}
break;

case 3:
{
switch(argument1)
{
case 0://name
return("Red orb")
break;
case 1://price (Sell at half)
return(50)
break;
case 2://Description
return('Disguise into a cow for 3 minutes.')
}
}
break;

default: return(0) break;
}
  • 0

#12 Lithium

Lithium

    Spitfire Member

  • GMC Member
  • 1477 posts
  • Version:Unknown

Posted 25 October 2008 - 10:09 PM

try this
if global.invo[argument0]=1
{
with(obj_speler){hp+=25}
item_delete(argument0)
inventory_sort()
exit
}
if global.invo[argument0]=2
{
with(obj_speler){sprite_index=wolf}
item_delete(argument0)
inventory_sort()
exit
}
if global.invo[argument0]=3
{
with(obj_speler){sprite_index=cow}
item_delete(argument0)
inventory_sort()
exit
}

  • 0

#13 Hardcore.

Hardcore.

    GMC Member

  • New Member
  • 60 posts

Posted 26 October 2008 - 10:23 PM

try this

if global.invo[argument0]=1
{
with(obj_speler){hp+=25}
item_delete(argument0)
inventory_sort()
exit
}
if global.invo[argument0]=2
{
with(obj_speler){sprite_index=wolf}
item_delete(argument0)
inventory_sort()
exit
}
if global.invo[argument0]=3
{
with(obj_speler){sprite_index=cow}
item_delete(argument0)
inventory_sort()
exit
}


This works fine man tnx! :)
  • 0

#14 dragon toss

dragon toss

    GMC Member

  • New Member
  • 79 posts

Posted 28 December 2008 - 07:40 AM

Kinda resurrecting a new topic here but: How do it so if i have an item equipted i can delet it and put it back in the inventory?
  • 0

#15 Hardcore.

Hardcore.

    GMC Member

  • New Member
  • 60 posts

Posted 04 January 2009 - 03:02 PM

Uhm, delete the instance_destroy() part :)
  • 0

#16 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 22228 posts
  • Version:GM:Studio

Posted 13 August 2011 - 08:11 PM

Std Msg: Please use the tutorial template header.

Std Msg: Please add a summary/explanation or basic outline of what your tutorial is for or teaches; aka how it works in plain english.


  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users