I plan on making a wand for a game I’m working on with various people. While I’m sure I could do it by myself, I was hoping for some advice on how to go about it the best way possible.
Essentially it will be a Harry Potter based wand. The player types out the name of a spell with their wand equipped, and then they click to cast it. Each spell will have a variety of different effects and display differently.
I’m thinking of a regular tool with just a simple local script that will pass the inputs to a controlling script in ServerScriptService. That way wands themselves are very simple, and completely useless without that server script.
But the server script is what I’m not entirely certain about. Each spell has a variety of different effects, and considering I plan on making at least 50-100 (with more that are easy to update), I am a bit overwhelmed on deciding the most efficient solution. Some spells with have very similar effects, while others could be vastly different from others, if not unique. Using Harry Potter spells as an example, compare “Stupefy” with “Expecto Patronum”. One is similar to a beam of lightning that affects one target, while the other is multiple ‘shields’ coming from the wand and growing to a certain radius, affecting only certain targets within range. Finding a way to create multiple spells with a large variety of effects, with an easy way to add new spells…idk.
Here is what I’m currently thinking about doing:
Summary
I’m thinking I could just make a ModuleScript containing a function for each spell. It will be passed all the possible arguments it could need and go from there. This would give me the most customization over each spell, however I imagine much of the code for these spells would look the same. This also means it’d be extremely difficult to update how a spell works, as I would have to change each and every ModuleScript.
Alternatively, I could have a ModuleScript with a table of various spells whose data represents how it will act. This would require something like a Yu-Gi-Oh card, in which I think of every possible situation (is the spell travel in a straight line or is it a ‘bubble’ effect, is the spell instant or does it take time to travel/grow, what type of effect does it have, etc). This could make it really easy to add new spells to the game and update how certain spells work. As a side benefit, it could make it easy to add a “custom spell” feature. However, thinking of all the various variables would take a long time to create…
Not sure if I explained this very well. But any tips/suggestions/resources would be super helpful.