Spell Select System in Warduke

Aerisetta

Active member
Hello

I am trying to make a spell system similar to the one in Warduke. But I've had a lot of trouble trying to unravel the code to find how it works.

Is there a version somewhere that's easier to understand?

What i need is
1. player spawns with 5 spells
2. player can press a button to cycle through spells (and icon will change to show this)
3. player can press a cast spell button to cast the spell
4. player can learn new spells


1696422157530.png
 
But I've had a lot of trouble trying to unravel the code to find how it works.

Yeah, it's hard to understand just by reading the character text. Basically spell select system has two parts:
1. Personal keyscript for respective character.
2. Spell select animation which changes to actual spell casting animation when conditions are met (usually MP). The former usually use FREESPECIAL animation.

Keyscript takes key press input when spell change key is pressed. Basically pressing the key will change current spell to the next one however there's check system to see if next spell is available/unlocked or not. If not available, the system will change spell to the next one and repeat the check again until it arrives at available spell or the same spell. This system is run by MagicSelect function in the keyscript.
If the next spell is available, the current spell is stored in global variable. IOW it tells the whole system including display system which spell icon to be displayed.
This current spell stored in that variable will be read when FREESPECIAL animation is performed. Since each spell has its own MP cost, script in FREESPECIAL will check if current MP is enough or not.

For Rise of Warduke, we could onlyuse one key to change spell/skill. However, in one of my metroidvanias called Robo Magi, I could use two keys, one to change to previous spell and the other to next spell.
 
Back
Top Bottom