I won't beat around the bush and get straight to the point.
I want that in my game, when the character dies, the player loses their gold, items, and armor.
I can do that easily using the script call "$gameParty.initAllItems();" but this, first of all, also deletes key items, and nobody wants that to happen. Also, this does not include the items that the player has equipped.
What I want to know is if there is a way to add an "if" statement in that code or something similar to generate an exception with specific items and not have to delete each object one by one using "$gameParty.loseItem($dataItems[12], 1);" for example.
I tryed this but it doesnt work IDK why:
$game_party.items.each do |item|
next if $data_items[item.id].key_item?
$game_party.lose_item(item, item.quantity)
end
$game_party.weapons.each do |weapon|
next if $data_weapons[weapon.id].key_item?
$game_party.lose_item(weapon, weapon.quantity)
end
$game_party.armors.each do |armor|
next if $data_armors[armor.id].key_item?
$game_party.lose_item(armor, armor.quantity)
end
I need some help 🙁
I want that in my game, when the character dies, the player loses their gold, items, and armor.
I can do that easily using the script call "$gameParty.initAllItems();" but this, first of all, also deletes key items, and nobody wants that to happen. Also, this does not include the items that the player has equipped.
What I want to know is if there is a way to add an "if" statement in that code or something similar to generate an exception with specific items and not have to delete each object one by one using "$gameParty.loseItem($dataItems[12], 1);" for example.
I tryed this but it doesnt work IDK why:
$game_party.items.each do |item|
next if $data_items[item.id].key_item?
$game_party.lose_item(item, item.quantity)
end
$game_party.weapons.each do |weapon|
next if $data_weapons[weapon.id].key_item?
$game_party.lose_item(weapon, weapon.quantity)
end
$game_party.armors.each do |armor|
next if $data_armors[armor.id].key_item?
$game_party.lose_item(armor, armor.quantity)
end
I need some help 🙁