Basic Troubleshooting

From The Muse

Troubleshooting Code/Content Additions

[edit | edit source]

This is a checklist of common mistakes that may be causing your mod to work incorrectly. It's not a comprehensive guide on all the things that can go wrong, but it's a good place to start if you're stuck.

  • Missing Script: If the addition is a custom action or buff that requires a custom script to implement, make sure you've assigned that script to the resource for that action or buff. Besides not executing your custom code, certain settings can create even more erratic behavior on default resources for custom scripts. For example, the root "Buff" resource with "trigger on" events set will simply remove themselves when those events trigger.
  • Null Checks: Whenever you await anything within an action, make sure you check if your unit and/or target are still valid before proceeding. If the unit dies or the player exits the game before the ability resumes the references may become null. There are a variety of abort_ functions on EventCores that make this more painless. For example:
await run_system_fxgs(unit)
if activation.abort_without_unit(unit): return

or

var plan:CompconPlan = await TargetActionUtil.ask_for_targets(activation)
if activation.abort_when(not CompconPlan.is_valid_with_targets(plan, context)): return