Wizard Doesn't Do Tactics
Dragonfolk2000
Member Posts: 390
I've got a wererat with levels in wizard. The desired tactic is to cast all two defensive spells (Shield and Endure Elements), cast offensive spells on the nearest PC, then run into melee to fight. They're a wererat so their DR helps a bit with that last part. But what they end up doing is casting Daze and then running into combat. I can't figure out how to change or alter the existing behavior to do what I'm trying to do. I think it's in the OnSpawn script but I'm having trouble understanding how to make it do what I want it to. Does anybody know?
0
Comments
SetSpawnInCondition(NW_FLAG_FAST_BUFF_ENEMY);
The last time I looked into modifying the combat AI, I was amazed at how convoluted it is. I still want to figure it out, but it keeps getting pushed back.
And the PC is a friendly target?
Edit: sorry, I just reread what you posted and understand.
I'll try to post later how I get NPCs to (usually) do certain things.
I can work with this but it seems only some spells are triggering. Shield doesn't activate but Endure Elements does.
Update: Many spells that would be considered buff spells aren't cast ahead of time. Sure. Okay. Someone should make a list of everything that gets cast through that spawn flag.
x0_i0_talent
line 1695. It starts listing what spells it will cast. SPELL_SHIELD is not one of the if cases.
The if cases are setup so that only the best version of the spell is cast.
In nw_c2_default9 I do:
If I want the creature to do something special at the end of a combat round, I set ECRE|Int|1 in their variables list in the palette.
If I want them to add an action to cast shield and endure elements, then in x2_def_userdef I do:
Since this is adding actions to the creature's action queue, it can work, but depending on what is happening to the creature, not all the time. Meaning, the default ai will clear all their actions to do some other action in some cases, or sometimes they never stop attacking to do any other action in their queue. If that's the case, try throwing a ClearAllActions(); before adding the actions and see what you get.
It's been quite a while since I've worked on this, but I think what I found is that the best stuff to put in the ECRE section is code to identify when you want your creature to do something specific. Then create a custom ai script that runs for the creature at that point.
For example:
if( conditions_under_which_I'd_like_this_creature_to_do_a_thing == TRUE )
SetCreatureOverrideAIScript(OBJECT_SELF,"ai_custom");
Model your ai_custom after x2_ai_shadow. I'll share how I think this should look.