Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.
As the title suggests, I would like to know how to check an Item/Weapon/Armor's Element. I can't find out how anywhere, and I need it for my Good Alchemy Script. If anyone helps, thanks. Peace out!
item = $data_items[item_id]
element_set = item.element_set
# OR
weapon = $data_weapons[weapon_id]
element_set = weapon.element_set
# OR
armor = $data_armors[armor_id]
element_set = armor.guard_element_set
# Then
for element_id in element_set
p $data_system.elements[element_id]
end
The element set is an array of element ids. The name of elements in the game is stored in $data_system.elements array. The index being element_ids and name as what is stored in the index.
If you want, here is something I did real quick. It will return an array of all elements names for items, weapons & armors.
Code:
class RPG::Item
def element_names
names = []
for id in @element_set
names << $data_system.elements[id]
end
return names
end
end
class RPG::Weapon
def element_names
names = []
for id in @element_set
names << $data_system.elements[id]
end
return names
end
end
class RPG::Armor
def element_names
names = []
for id in @guard_element_set
names << $data_system.elements[id]
end
return names
end
end
You can just use:
Code:
<rpg_item>.element_names or <rpg_weapon>.element_names or <rpg_armor>..element_names
Thanks, Seph! I don't know what I'd do without your help? This is perfect,a nd thanks for that bit of code. You will be at the top of the Credits list for helping me so much! Peace Out, and stay Cool!
This topic has been resolved. If Akahi Aomitsu or any other users have any questions or further problems regarding this topic, please create a new thread about them.