Aller au contenu

Photo

Variable to make NPC only use spells or ranged weapons


  • Veuillez vous connecter pour répondre
9 réponses à ce sujet

#1
Loki_999

Loki_999
  • Members
  • 430 messages

Sure there is a var for this that the AI takes note of, but can't find it.  Probably burried in TonyK's stuff.

 

Anyone know what var is required to tell a hostile creature to not use melee weapons?



#2
kevL

kevL
  • Members
  • 4 070 messages

not sure if this rules out bows or not :

 

 

"X2_L_BEH_OFFENSE" - in 'nw_i0_generic'

( does not accept negative values, would use "0" instead ) What I've found is there are 2 ai's: true Tony's AI is mainly for companions, and uses scripts like gb_comp_*

but My present understanding is that Tony wrote only a front end for the Monster AI -- and that this still uses the old NwN1 ai underneath, scripts like nw_c2_default*

- the X2_L_BEH_* variables affect monster-ai but not Companion AI


If you want to examine the monster-ai, i suggest starting at the bottom of 'nw_i0_generic' chooseTactics() and work your way up that include. chooseTactics() is what's called by DetermineCombatRound()

 

 

 

ps. 'x0_inc_generic' contains some of the expanded NwN1 ai



#3
Loki_999

Loki_999
  • Members
  • 430 messages

Great, thanks. Its probably henchman AI i'm thinking of, so ill try poking around again for the companion stuff.



#4
kevL

kevL
  • Members
  • 4 070 messages

k

I also had another look, and it appears that Tony does hook to his own Ai for monsters: even the nw_c2_default* scripts call HenchDetermineCombatRound(), which is T's.

 

( using his add-on )



#5
Loki_999

Loki_999
  • Members
  • 430 messages

Yeah, had a poke around. I think i found the flag to tell a companion/henchman to not use melee and back away etc.  Ill give it a play with at some point.

 

Thanks for the input.



#6
kevL

kevL
  • Members
  • 4 070 messages

'gui_bhvr_hench_change'

case HENCH_ASC_USE_RANGED_WEAPON:
case HENCH_ASC_NO_MELEE_ATTACKS:

yeh, i've been through it to set up defaults for my companions. iirc, some of these behaviors are setup by Tony's, while others are setup by NwN1 ai.



#7
Loki_999

Loki_999
  • Members
  • 430 messages

Well, at the end of the day, it doesn't matter who provided it, as long as it works  ;)



#8
kevL

kevL
  • Members
  • 4 070 messages

it's not just where it came from, it's a subtle warning that the methods used are different ...



#9
4760

4760
  • Members
  • 1 212 messages

Yeah, had a poke around. I think i found the flag to tell a companion/henchman to not use melee and back away etc.  Ill give it a play with at some point.

Could you share what this flag would be, please?

I tried a variable "X2_IA_COMBAT_STYLE_RANGED" set to 1, but it didn't work.

Anyway, I got it to work using a custom AI script (via the "x2_ia_demo.nss" template and the string variable "X2_SPECIAL_COMBAT_AI_SCRIPT").



#10
Loki_999

Loki_999
  • Members
  • 430 messages

Ah, didn't get round to finishing off the testing. Was actually going to try the COMBAT_STYLE_RANGED one myself. There was another though, something that was like DO_NOT_MELEE or something. found i think in x0_i0_henchmen or one of the includes.

 

Anyway, glad to hear you got it working.