Jump to content

Proper way (code-wise) to do upgradable weapon?


Recommended Posts

Hi experts,

 

What is the proper way to do upgradable weapon?

So far I know only two ways:

1) recipe

the better weapon consumes older weapon + other ingredients.

Does this mean I need 5 prefabs if I want weapon +1 +2 +3 +4 and +5?

2) trader component

put weapon in inventory (not equipped), "give" it correct ingredient and it accepts and upgrades itself.

Only need 1 prefab.

 

For each method above, do I need to be concerned with client-server stuff (making net variables, client-only functions etc)?

Any other recommended methods?

 

Thanks.

Link to comment
Share on other sites

13 hours ago, SenL said:

What is the proper way to do upgradable weapon?

So far I know only two ways:

1) recipe

the better weapon consumes older weapon + other ingredients.

Does this mean I need 5 prefabs if I want weapon +1 +2 +3 +4 and +5?

2) trader component

put weapon in inventory (not equipped), "give" it correct ingredient and it accepts and upgrades itself.

Only need 1 prefab.

Both methods should require 1+n prefabs. You want to keep the upgrades separate from the original, giving it a different design or added fluff to notate that it's been upgraded.

 

13 hours ago, SenL said:

For each method above, do I need to be concerned with client-server stuff (making net variables, client-only functions etc)?

This depends on how many prefabs you use and the method in which you use. If you use method 2 (trader component) then you should definitely allow the client to track what they've traded with the sword. However, if you use method 1 there is already a way to keep track of progress on client side (recipe tab).

 

13 hours ago, SenL said:

Any other recommended methods?

There is a different method, but it's overkill and requires to have a DEEP understanding of how the current crafting system works. You'd basically create your own "upgrading" system which works similar to the crafting system, but only for specific items which can be upgraded.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...