I have a list of all of my items, now I just need to provide functionality to those items when they are equipped. Is there a simple way of giving those items functionality, such as a Short Sword that has 1 Pound of Weight, +5 to attack damage and actually having that attack damage be added to my character’s damage when he has that weapon equipped?
(The only way I can fathom is creating a function for EACH item, and being that there are about 300 items, that sounds like not such a simple way, so before I jump into that I would like to know if there’s a simple method I’m overlooking)
You don’t need a function for every item.
It would be simple enough to have a script on every item, and make it be the same one script, (attached to the prefab) with inspector-settable fields for every possible effect an equipped item can have, and if the item does not affect that attribute, you just leave it set to zero. Then the various action functions in your player’s script add up the relevant variables to that action from all the players’ equipped items.
An easy way of providing them with different specific damages is to use a health bar just like hack and slash rpg
and attaching a script named something like damage to each weapon where you import the adjustCurrentHealth or any similar variable and make it public so you can adjust it different for each weapon…
What it does is adjust the adjustment or damage it does to the enemy health, so each weapon can have a different attack damage
HOPING IT SOLVES YOUR PROBLEM,