While discussing some quest-related stuff with Andrew on the plot list, I had some ideas regarding the character implementation. The question that got me thinking was what would happen if the player killed a character who had close bounds to another NPC. Would that NPC search for and attack the player eventually? (Yes, of course!)
So what it boils down to is changing the surviving characters schedule at some point after his companion was killed. Which would be simple if we had a few callbacks on each character that would be triggered in a case like this. Very much like the item implementation that has stuff like on_drop or on_use, etc ... Basically, each of the character callbacks I could think of would have a default implementation in the Python character class (more details below) and will also allow to attach a user-defined callback. The reason for this is that we'll probably have one character implementation for all NPC characters, but may need different behaviour for NPC x and NPC y. The callbacks we might need are the following: * on_attack triggered when the character loses health and is not yet in combat mode. Will allow to switch current schedule to combat or flee. Default might be based about some stat (like alignment and or strength or something else) The callback could of course set this to something else * on_death triggered when the character reaches health below zero. Default implementation would play death animation, unequip all items so they appear in the character"s inventory where the player can loot them and start a time event that will make the corpse decay eventually. For the player character, the callback might open the load screen, for individual NPCs, quest steps might be changed to completed or as in the example above, the schedule of related NPCs could be changed to hunt for the player. * on_activate triggered when the player presses the action button next to a character. Default implementation might initiate dialogue (or allow to pickpocket the character if in stealth mode), but special characters might react differently. We might also have a callback related to the 'ether', on_message which could be used as a standard way for characters to 'communicate'. It would be triggered when being in range of the character issuing the message (i.e shouting for help when being attacked). The default implementation could cover 'standard' messages like "Defend me", "Thief!" and some such, but certain characters could react to special messages too. In general, such message would switch to an appropriate schedule. They won't directly implement the character behaviour. Speaking of character schedules, I'm currently in the process of cleaning up the schedule implementation found in the v0.3 branch and integrating it with v0.4. The main problem is that it relied upon internal time events (so you could queue schedules to be activated after a certain amount of time had passed or a certain point in time had been reached). With v0.4 however, I had dropped internal event callbacks, so I need to put those back in first, to avoid costly calls to Python for activating queued schedules. Anyway, what do you think? Does this make sense? Any other callbacks we might need? Kai _______________________________________________ Adonthell-devel mailing list Adonthell-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/adonthell-devel