Game Maker's Garage Forum

Game Creation => GameMaker => Topic started by: Tireas Dragon on June 10, 2008, 07:44:10 PM

Title: Inventory System
Post by: Tireas Dragon on June 10, 2008, 07:44:10 PM
I am currently working on a inventory system that will be able to support thousands of different items and it includes magical items. (example: Sword of never missing + 99 on chance to hit) I would like your input about this system and maybe include some magical items.
Possible bonuses include: (on weapons) Extra Damage, Bonus Chance to hit,
(on all items) Bonus stat points (strength, dexterity, constitution, intelligence, wisdom, charisma)
(on armor) bonus armor and return damage
Oh and don't forget to include a reasonable sell value for your magical items.

P.S. There is a very good chance I will use this inventory system on my next game after labyrinth.
Title: Re: Inventory System
Post by: EqwanoX on June 11, 2008, 10:20:12 AM
what do you mean by support thousands of items? then you list a bunch of stats that are irrelivant to an inventory system, tell us whats different compared to this:

let potion=potion+1

print "potion: "+str$potion

if potion>1 then
let potion=potion-1
let hp=hp+50
print "potion: "+str$potion
end if
Title: Re: Inventory System
Post by: Tireas Dragon on June 11, 2008, 02:43:46 PM
I mean thousands of different items and the things are possible bonuses for magical items.
heres a link but no magic items are in it yet. http://www.mediafire.com/?ns2m20flw3w
Title: Re: Inventory System
Post by: Silverwind on June 11, 2008, 04:10:06 PM
I like the way it sorts out each item's number so that if an earlier item is dropped the ones after it move down. That's clever. :)
Title: Re: Inventory System
Post by: Tireas Dragon on June 11, 2008, 04:16:30 PM
With this system I can make an almost infinite number of different items. I can make an item that is plus 6 to your strength and intelligence.
Title: Re: Inventory System
Post by: Silverwind on June 11, 2008, 04:50:41 PM
I don't really understand how that's different to other systems though. I mean, the inventory system I've always used is really simple, yet it can handle unlimited items with extra properties as well. QoM's code is kinda like this:
Code: [Select]
IF playerweapon$ = "Rusty Dagger" THEN
  playerWC = playerWC + 10
  playerhit = playerhit + 3
END IF

IF playerweapon$ = "Battle Axe" THEN
  playerWC = playerWC + 20
  playerhit = playerhit + 5
END IF

IF playerweapon$ = "Long Sword" THEN
  playerWC = playerWC + 35
  playerhit = playerhit + 8
END IF
So if you wanted an item to raise an attribute, you'd simply slip in the extra line of code:
Code: [Select]
IF playerweapon$ = "Rapier of Quickness" THEN
  playerWC = playerWC + 40
  playerhit = playerhit + 3
  STATdexterity = STATdexterity + 4
END IF

IF playerarmor$ = "Cloak of Endurance" THEN
  playerAC = playerAC + 25
  playerdef = playerdef + 6
  STATendurance = STATendurance + 3
END IF
Simple yet effective. Any property you want an item to have is easily implemented. Is your code very different to that?
Title: Re: Inventory System
Post by: Tireas Dragon on June 11, 2008, 05:04:08 PM
My code inserts all those bonuses with 1 line of code.
Title: Re: Inventory System
Post by: Silverwind on June 11, 2008, 05:23:24 PM
Wow! Now that is impressive! :D Can't wait to see it. Here's a simple inventory I just came up with that stores item properties in arrays.

This is how to set the properties of weapons and armors. The first parameter in the array is the item's name, the second parameter is the Attack plus it gives in combat, and the third parameter is the Defence plus it gives in combat.
Code: [Select]
Weapon1Stats$ = "RustyDagger 10 0"
Weapon2Stats$ = "BattleAxe 14 0"
Weapon3Stats$ = "LongSword 20 0"

Armor1Stats$ = "LeatherVest 0 8"
Armor2Stats$ = "ChainMail 0 12"
Armor3Stats$ = "SpikedCuiras 3 17"

How to set the player's weapon/armor properties to that of another item: (in other words, how to equip an item)
Code: [Select]
PlayerWeaponStats$ = Weapon1Stats$
PlayerArmorStats$ = Armor1Stats$

How to reference the properties of an item:
Code: [Select]
PlayerWeaponName$ = WORD$ PlayerWeaponStats$ 1
PlayerArmorName$ = WORD$ PlayerArmorStats$ 1

WeaponAttackPlus$ = WORD$ PlayerWeaponStats$ 2
ArmorAttackPlus$ = WORD$ PlayerArmorStats$ 2
WeaponAttackPlus = VAL WeaponAttackPlus$
ArmorAttackPlus = VAL ArmorAttackPlus$
WeaponDefencePlus$ = WORD$ PlayerWeaponStats$ 3
ArmorDefencePlus$ = WORD$ PlayerArmorStats$ 3
WeaponDefencePlus = VAL WeaponDefencePlus$
ArmorDefencePlus = VAL ArmorDefencePlus$

Attack = Attack + WeaponAttackPlus
Attack = Attack + ArmorAttackPlus
Defence = Defence + WeaponDefencePlus
Defence = Defence + ArmorDefencePlus

It's fairly straight forward. You shouldn't have to edit any of the code to use it, so you don't even have to understand it. All you have to do is set the values of "Weapon1Stats" "Weapon2Stats" and so on. If you do understand it however, you could add extra parameters such as attribute bonuses or durability. Or even the item's sell price. :) It's easy to mod.
Title: Re: Inventory System
Post by: Tireas Dragon on June 11, 2008, 05:29:16 PM
That works pretty similar to mine, but mine I have done a lot to so I can implement magic properties.

EDIT: Wow I should of thought of the word idea. I'll insert it right away.
Title: Re: Inventory System
Post by: Silverwind on June 11, 2008, 05:37:47 PM
Cool. As I mentioned above, you could always add more parameters to the arrays in this system in order to add magical bonuses.

How are you managing to keep it down to a single line when you reference an item's properties though? That's what's really amazing.
Title: Re: Inventory System
Post by: Tireas Dragon on June 11, 2008, 05:38:53 PM
Not for referencing just for declaring.
Title: Re: Inventory System
Post by: Silverwind on June 11, 2008, 05:45:15 PM
Oh. I was thinking you'd discovered a Godly command Al hadn't told us about or something, lol! (DOMENU READMIND ;D )
Title: Re: Inventory System
Post by: Tireas Dragon on June 11, 2008, 05:49:16 PM
LOL I didn't realize I was leading you to believe I was some sort of GM God who can do practically anything with a line of code.

Title: Re: Inventory System
Post by: Tireas Dragon on June 12, 2008, 11:51:25 AM
Alright here it is with magic items included, and two-handed weapons.

http://www.mediafire.com/?m4qobs1m2ig

P.S. I named some of the armor after the people here on the GMG I hope no-one minds.
Title: Re: Inventory System
Post by: Tireas Dragon on June 13, 2008, 03:17:40 PM
I looked at the number of downloads of the inventory system its 0 why hasn't anybody taken a look at the fixed system?

Title: Re: Inventory System
Post by: Silverwind on June 13, 2008, 03:54:52 PM
Just checked it now. Nice, though it's not the source code. Was that intentional?

(also, I got Silverwind's Titanium Plate. Awesome! ;D )
Title: Re: Inventory System
Post by: Tireas Dragon on June 13, 2008, 04:06:11 PM
do you want the source code? It looks like your making a inventory system quite similar.
Title: Re: Inventory System
Post by: Gan on June 13, 2008, 04:27:52 PM
Ah, this is great, once I get a few things straightened out I will see if I can put this in a few Sc games!

Sorry I didn't check this out earlier, I have been gone for a week.


-Gandolf
Title: Re: Inventory System
Post by: Silverwind on June 13, 2008, 05:34:22 PM
Quote
do you want the source code? It looks like your making a inventory system quite similar.
No thanks, I don't need it. I just thought you were releasing the system as open source and was making sure you knew it was a compiled app in case you had done so by mistake.

I believe there was a fantastic inventory system in SC awhile ago. Eq knows more about it than I do.
Title: Re: Inventory System
Post by: Tireas Dragon on June 13, 2008, 08:19:16 PM
Really what did it do and how did it work?


Title: Re: Inventory System
Post by: Silverwind on June 14, 2008, 03:05:08 AM
I'm not exactly sure, though I do remember seeing the code. I think it actually stored every item the player was carrying in an array, and could replace the values whenever the player gained or lost an item. I could have completely misinterpreted it though, as I couldn't really understand the code.

EDIT:

Oh yeah, it was supposed to store them in categories somehow as well. I think that was why everyone was exited about it.
Title: Re: Inventory System
Post by: EqwanoX on June 14, 2008, 09:52:44 AM
you might be talking about the one redd made on snet, but all he did was post the code for obtaining an item, he didnt make a working demo
Title: Re: Inventory System
Post by: Silverwind on June 14, 2008, 10:48:25 AM
Hey TD, what game are you using this in?
Title: Re: Inventory System
Post by: Tireas Dragon on June 14, 2008, 10:51:02 AM
Well after I finish Labyrinth ( I haven't given up on it) I will probably revive work in Darksville and use this in it.
Title: Re: Inventory System
Post by: Tireas Dragon on June 14, 2008, 11:10:42 AM
The best thing to do with this is probably make a system for judging the value of each bonus and developing a fair value system of each item judging sell value.
Title: Re: Inventory System
Post by: EqwanoX on June 15, 2008, 10:13:06 AM
darksville is pretty good, it has a lot done, map, shops, battle engine, theres no reason not to finish it, i liked it
Title: Re: Inventory System
Post by: Tireas Dragon on June 15, 2008, 05:13:27 PM
The only map done is the world map. The battle engine doesn't work either. If I revive work on it a lot will have to be completely redone.