You are here

Change default max guard companions distance

11 posts / 0 new
Last post
demoix
Change default max guard companions distance

I need some help to change companions max follow/guard distance (with Tony Companion and Monster AI 2.2). Currently, as far as I know, max is 20 meters on ''FAR'' option. How to change it for let's say100 meters? I realized that Eldrich spear for my Warlock companions is useless now. With 100 meters they supposed to attack from mutch far away (ranged companions)

  • up
    50%
  • down
    50%
kevL's

in the #include file 'x0_i0_assoc' there's a function:

float GetFollowDistance(object oTarget = OBJECT_SELF);

the three possible AI-follow distances are set there (by converting a bitmask into a distance in meters).

You'd have to change those floats and recompile any scripts that call that function. Ie, it's not trivial,


I think (am pretty sure) it applies to Companions as well as Associates ...

There are other ways to do it, for example by directly modifying the AI-event script(s) that call that function.

 

edit: guard distance is similar but looks like it's set in 'hench_o0_ai'

  • up
    50%
  • down
    50%
Proleric

I suspect that SetAssociateState is the function you need to change before recompiling calling scripts.

NWN and DAO adventures at http://proleric.com/

  • up
    50%
  • down
    50%
kevL's

SetAssociateState() just sets the bitmask (near, medium, far). the actual distance in meters is determined in other functions by examining the bits that were set by SetAssociateState().

it wouldn't be (too) terribly difficult to make those distance-values modifiable in the Gui, just time consuming ....

  • up
    50%
  • down
    50%
demoix

Which program can open .NCS files? (hench_o0_ai.NCS)

  • up
    50%
  • down
    50%
kevL's

.ncs is a compiled script -- you need the .nss that compiled into that.

if you go to the download for TonyK's AI 2.2 there should be a .erf download available [erfsource2.2.zip]; he packaged the source code inside compmonai.erf, which is inside the zip.


you can open an erf with Tanita's nwn2packer ... [nwn2packer_20080808.zip]

 

edit: add links

  • up
    50%
  • down
    50%
kevL's

inside 'hench_o0_ai.nss' look at lines 545..568

change each fGuardDistance to what you want (floats means they need a decimal pt)

Recompile. But there's more: This script is executed by the #include function HenchDetermineCombatRound() - which is called by ... about 47 other scripts, some of which are #includes, which then should be traced to see what functions call those also.

but I think if you recompile
gb_assoc_damage
gb_assoc_combat
gb_assoc_distrb
gb_assoc_percep
gb_comp_combat
gb_assoc_attack
gb_assoc_spell
gb_assoc_heart

uh,
like i said, it's not trivial

also, the issue of a companion's maximum perception distance should be addressed... they can't even see 100m

  • up
    50%
  • down
    50%
demoix

I managed to open hench_o0_ai.nss. I used Tanita nwn2 packer to export hench_o0_ai.nss from compmonai.erf and then i open hench_o0_ai.nss with Notepad. Then I changed fGuardDistance = 100.0 .  Then I just save it from notepad. It means I recompiled file? Sorry but I'm totally green on this. If not, which program I should use to recompile files?

  • up
    50%
  • down
    50%
kevL's

open the toolset. The first thing to do, is go to options and * turn autosave OFF *

ok. Under the File menu, use Open Script or Conversation...

browse to the .nss file, open it, then click Compile. check the status bar for any errors..

If it works, a .NCS file appears alongside the .nss

  • up
    50%
  • down
    50%
demoix

So, I put hench_o0_ai.nss into nwn2/data/spcripts_x2.zip (otherwise I can't find tony's AI modified hench_o0_ai.nss), then I open it, click on Save & Compile (F7) but nothing happens. Then I click on File>Compile>All Scripts in Module, then nothing happens and finally, I click on File>Compile>All open scripts and got:

Compiling hench_o0_ai

Error: hench_o0_ai.nss(45): ERROR: UNDEFINED IDENTIFIER 
Information: Compilation Finished
sad
 
I think I'm not getting to make it, thanks for the help anyway
 
 

 

  • up
    50%
  • down
    50%
kevL's

i'll just point out, in case you want to make modifications in the future

there's the installation folder, and there's a player-folder in Documents (roughly speaking)

to make modifications to the game, put things in

\Documents\Neverwinter Nights 2\Override (roughly speaking)


that way nothing changes in the installation folder.

but yeah, it sounds like you're trying to accomplish something that's going to be nothing but a huge headache without at least an intermediate knowledge of.. stuff.

 

 

kudos for attempting, tho!

  • up
    50%
  • down
    50%