Reign
Member
I know of a few ways to do this and how I would do this in C++, but I'm wondering what someone more experienced with game maker thinks of my setup and if there's a better way before I call this complete and make 100's of items.
Basically, I have an inventory that looks something like the newer Fallout games
which requires item name, amount, description, icon, max amount, etc. You can craft and store/loot from containers like many Bethesda games. I'm using a ds_grid as an inventory which only stores the ID and amount of each item. I can then look up the description and other properties using the ID to index an array of the item definitions that are stored like so->
I can use items like this
Is that fine or should I make each item its own gamemaker object with its properties defined in the create event? or is there an even better way?
Basically, I have an inventory that looks something like the newer Fallout games
which requires item name, amount, description, icon, max amount, etc. You can craft and store/loot from containers like many Bethesda games. I'm using a ds_grid as an inventory which only stores the ID and amount of each item. I can then look up the description and other properties using the ID to index an array of the item definitions that are stored like so->
Code:
///scrInitAllItems()
for(var i=0;i<NUM_ITEMS;++i)
global.Items[i]=instance_create(0,0,objItem);
// Bow (example item)
global.Items[12].Type = TYPE_WEAPON;
global.Items[12].Name = "Wood Bow";
global.Items[12].Description = "Looks hand crafted.";
global.Items[12].Amount = 0;
global.Items[12].MaxStack = 0;
global.Items[12].Value = 100;
global.Items[12].Tile = 12;
global.Items[12].Effect = -1;
global.Items[12].Damage = 5;
global.Items[12].DamageType = DAMAGE_SHOT;
global.Items[12].Range = 356;
global.Items[12].ClipSize = -1;
global.Items[12].ReloadTime = -1;
global.Items[12].Projectile = objArrow;
global.Items[12].ProjectileOffset = 0;
global.Items[12].BulletSpeed = 12.0;
global.Items[12].EquipSlot = SLOT_WEAPON;
global.Items[12].Speed = 8;
global.Items[12].Armor = 0;
Code:
global.Player.Damage = global.Items[itemid].Damage;
global.Player.DamageType = global.Items[itemid].DamageType;
global.Player.Projectile = global.Items[itemid].Projectile;
global.Player.ClipSize = global.Items[itemid].ClipSize;
Last edited: