Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Dark Dreams of Furiae - a new module for NWN:EE! Buy now
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

Follow on AI scripting question

TerrorbleTerrorble Member Posts: 97
I've created a lot of creature specific behavior (casting spells, using objects, moving/teleporting, buffing, etc) by setting creatures to use code I put in x2_def_userdef (usually the EVENT_END_COMBAT_ROUND section). I can usually get them to do what I want, but it hasn't been without problems.

How does putting the code in x2_def_userdef compare to having the creature execute a custom ai script? (i.e. X2_SPECIAL_COMBAT_AI_SCRIPT)


Comments

  • ShadooowShadooow Member Posts: 381
    I never used UserDefined for creatures because it doesn't prevent the original code in those event to run. Plus you need to enable it in OnSpawn which defeats the purpose really.

    Anyway, each creature script will be doing some stuff and eventually run creature internal AI. The events scripts are just external layer of this AI and it is internal AI (DetermineCombatRound) when the real stuff happens.

    UserDefined cannot prevent any of that happen. So even if the creature does what you want her to do via UserDefined, it is at the very least ineffective as the creature is doing stuff and you are canceling it in middle and replacing with your own instructions. You can even break the AI this way - I fixed numerous issues in henchman AI caused by canceling the current AI action in middle in external script. This is because the internal AI sets variable to TRUE, then issues the spell cast action, and then issues the ActionDoCommand(variable to FALSE)); and when the variable is TRUE that internal AI won't do anything as it things it is casting the spell.

    User Defined events are usefull, but definitely not for AI coding purposes.

    Terrorble
  • TerrorbleTerrorble Member Posts: 97
    Thanks Shadooow, I was hoping you'd chime in.

    After what I learned from your article and posts in the other thread, I figured the inconsistencies in my NPC behavior was probably due to conflicts between my external commands and the internal AI.

    If anyone else has pearls of wisdom to share about scripting custom AI combat behavior I'd like to hear them.

Sign In or Register to comment.