Default creature scripts: what do YOU do?

Hey hey! I’m interested in making a module, but I was mostly curious about best practices first. Obviously, I am interested in best practices outside of just scripting, but I’m starting here. :stuck_out_tongue:

If I wish to script a new behavior for a creature, what is the general consensus as to what is best?

  1. Use OnUserDefined for all of my specific needs.
  2. Overwrite and replace the script with only my content.
  3. Overwrite and replace, but execute the default script at the beginning.
  4. <Something I didn’t think of.>

And do best practices change from situation to situation? If so, the situation I am looking at is a scene-specific creature: a potted plant, if you would. No variables need to translate, no combat is expected, etc… Would it be safe, efficient, or otherwise good to scrap the default NPC scripts?

Any outlooks and opinions, are welcome. Thank you for taking a read!

(P.S., I apologize if this is already addressed elsewhere: I could not find a similar post with the keywords by which I searched.)

Write your own OnSpawn that calls the UD events you need and then use a custom OnUserDefined. This will handle 90% of the behavior mods you’ll ever need. For those other cases when OnUD won’t cut it, make a modified copy of the default behavior and save it under a different filename.

If you really want to get fancy, use a custom AI mod like Jasperre’s AI or Tony K’s AI.

1 Like