U
uni00
Guest
Since I used enum item{} to make an inventory, the item names in the inventory are prefixed with "item.". I want to reap only this name.
Because you have to create an objname for instance_create() so that the character will drop the item you used.
I want to create "item_draw" this time, but the name in the inventory is "item.draw", so if it is left as it is it will be an error if you specify a nonexistent object as "item_item.draw".
thanks!
Because you have to create an objname for instance_create() so that the character will drop the item you used.
I want to create "item_draw" this time, but the name in the inventory is "item.draw", so if it is left as it is it will be an error if you specify a nonexistent object as "item_item.draw".
thanks!
Code:
enum item{
none = 0,
draw = 1,
dresser = 2,
ball_w = 3,
ball_b = 4,
ueki = 5,
tubo = 6,
tue = 7,
kagi = 8,
kami = 9,
total
}
GML:
var iid = global.inv[# var_slot, 0];
if (global.item_index[# iid, item_stat.type] == item_type.create) //If the item is food
{//Gain the right amount of health
instance_create_depth(o_player1.x,o_player1.y,-1001,asset_get_index("item_"+string(iid)));
global.inv[# var_slot, 1] -= 1; //Remove one food item
if (global.inv[# var_slot, 1] <= 0) //Clear the slot if it is empty
{
global.inv[# var_slot, 0] = 0;
global.inv[# var_slot, 1] = 0;
}
}