Jump to content

Spellcaster AI Problems


lionusprime

Recommended Posts

Hi guys, long time reader, first time poster.

 

I decided to give Oblivion modding a try, and for my first effort, I've added a dungeon some people may recognize to the Valus Mountains. In the final stages of debugging, I've found a problem with a scripted NPC boss-style fight - The script dynamically switches in and out a pair of NPCs on death, so the boss fight format is fight NPC1 for 500 health, fight NPC2 for 500 health, for a set number of stages, whereupon a different NPC is called in and the final stage of the fight begins. I've got that bit working like a treat - just need to add some magic shader visuals to the NPCs when they warp in and out to make it look more glamorous - but the problem I'm having is this.

 

The boss (NPC1) is a mage-type character. I'm trying to swap his spellset for more powerful ones each stage, with a final spell of astronomical power in the last stage. All the spells have been made without incident, however, if I add npc1.removespell weakspell and npc1.addspell strongerspell to the onDeath scipt, it doesn't work - I find that the NPC simply chooses one spell during stage one and spams it until the cows come home, then when he has this spell removed and replaced by other spells, he will just use his staff until it runs out, then try and beat me to death with his 5 hand to hand skill fists of fury.

 

I've tried a script with a looping timer, choosing a random spell from the current set every 10 seconds and then calling npc1.cast selectedSpell player on that spell, then read up online that 'cast' is buggy when getting actors to cast On Target spells, and i'm out of ideas. If at all possible, I want to avoid using an invisible activator floating in front of the NPC and casting the spells, does anyone have any idea how I could implement this in a workable fashion?

 

I'll post the current NPC scripts if needed.

 

Thanks in advance,

 

LP.

Link to comment
Share on other sites

The reason why the NPC might not be using the stronger spells, could be because the NPC doesn't have the skill to use them. NPC mages typically use only their strongest spell that they can use, at the range it's for. Regardless if you have the stats autocalculated or not, they get set when the NPC loads at that value. If the NPC gets their level increased, their stats won't increase since they were already loaded. You could use scripting to increase skill each time, but all that scripting to control stats and swap out spells really just complicates things needlessly. Instead what you might want to try doing is making a seperately defined NPC for each stage with preset stats and spells. When the first one dies, the second one gets placed and is ready to go without all that scripting to adjust the NPC.

 

To make combat more varried, you might want to just add a few basic spells to each stage NPC, one self, one touch, one target of slightly lower strength to act as the default spells that NPC will use. Then you can use scripting to randomly add a stronger spell to the NPC for a few seconds, and remove that spell, adding another one. This way when the spell gets added it will become the preferred spell to use, and they'll use it, when the spell gets removed, they'll go back to their default until a stronger one becomes available. You can combine this with changing out fightingstyles to get even more variation. Also be sure not to neglect things like invisibility spells, and damage skills/attributes since usage of those can make a longer fight much more entertaining than just fighting someone who uses pure destruction spells. If you were feeling brave you could probably even plan out groups of actions that you want the NPC to do durring a fight using scripting to adjust what spells are available, what to cast on themselves, and what fighting styles to use. Since you're using two known references (the player and the NPC) you can check for spell effects on one to determine specific actions (for instance checking if the player is paralyzed and having the NPC switch to an upclose style to use some touch based spells or just beat on the player while they're stunned).

 

You can do alot with custom scripting battles, it is just very hard to make them work right.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...