A Bug in CombatLib: NPC "settodefend" option

I would love to have NPCs fighting alongside my player, but so far it's not possible. With CombatLib, any given monster (or NPC) in my game will attack itself at random during various sessions of play.

The problem only occurs if you implement the 'friend' option whereby an NPC can fight alongside the player by using this starting script: do (NpcName, "settodefend")

My guess is that somehow this 'settodefend' code is not updating lists (attackers or friends) correctly, or in some other way Quest is making the monster or NPC select itself as a target instead of other monsters. Can anyone help me figure out how to fix this? It would be an awesome feature for RPGs.

I isolated the problem by creating a brand new game without interference from any tweaks in my actual game. All I did in this new game (just 3 rooms, 2 monsters, 1 NPC, nothing else at all, no descriptions or anything else) was add the NPCLib and CombatLib. I have the same problem.

I did try to see if anyone else on the forums had problems like this, and indeed I found an unresolved topic along the same lines back in February: https://textadventures.co.uk/forum/quest/topic/ppcz9qjyp062hw0wvohvhw/problem-with-followers-in-pixies-combat-lib

Has anyone else tried having NPCs fight as an ally of the player in an RPG using CombatLib? Any ideas?



If you can post your code (or a link to view or download your code), we'll look it over and see if something stands out.

(It sounds like the example game's code would be more than enough.)

This topic is now closed. Topics are closed after 60 days of inactivity.