Need help to review code or possible bug

I’m trying to go for the bonus in Kelvintaph Crusader (save all allies), so I program my paladin to heal friends that have low health. However, the paladin immediately casts “heal” on a fully healthy friend after just half a second, and then he cannot cast again for next 5 seconds (cooldown). The relevant code is shown in the screenshot. Probably I’m missing something, or probably it’s a bug. I tried to debug the issue, but I have questions about debug() too :worried:

[Note: I’m not a professional coder]

see screenshot - contains code spoiler!

Try adding a now() check to avoid casting the spell for the first second as a test. I can’t seem to find an issue with the code, so I get the feeling that it might be some kind of initialization issue that exists at the beginning of the map.

Yes, I did just that. Unfortunately, I still failed badly at the bonus…

Because you didn’t summon her, you have to command your paladin on the first frame, or she’ll do her automatic logic, which includes healing anyone who is damaged. Once you command her once, she’ll wait for orders from you. You don’t command the paladin to do anything on the first frame, since she can cast heal but there are no damaged friends. (I’m not saying that you should know this, just that this is currently the fix: tell her to attack or shield or something if she can cast heal but doesn’t find a damaged-enough friend to warrant it.)

1 Like

Thanks, you’re right: I didn’t cover all scenarios. I will fix that now! :smile:

update: I fixed the code, so the paladin doesn’t cast immediately. Unfortunately it didn’t help to get the bonus :frowning:

update 2: rearranging the priorities allowed me to win, although I was walking on - so to say - thin ice