A question about multi input

  • I created a BaseSpell Actor Component with a custom event CastMe
  • I created 3 children inheriting from the above component - Fireball | Lightning | Heal
  • I added those 3 spell components to the actor - Player Controller here, to make things easier
  • at Begin Play I populate a String | BaseSpell Map (Dictionary) with a KeyCombo | Spell Component

  • Pressing Any Key, providing it’s numeric, appends that letter to a string variable Accumulate String Combo
  • Pressing Right Mouse Button finds it in the Map; if the combo exists, the appropriate component’s CastMe event is fired.
  • Reset the Accumulate String Combo variable

This seems to work well, it’s simple, reasonably modular, allows you to override children’s custom events and can be easily expanded. Even updated dynamically, since you can just spawn and swap out the spell and their combo in the map.


It, of course, can be vastly improved. But again, it depends whether you’re dealing with 8 or 800 unique spells.