Author Topic: Henchman atacking Chest or locked objects  (Read 454 times)

Legacy_Calva64

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
Henchman atacking Chest or locked objects
« on: March 03, 2012, 10:37:49 pm »


               Hi All,

I know this is old news probably, but I wanted to post this for the community anyway.

As some of us know the problem with a party of multiple henchman especially one with a rogue is that the AI in NWN causes the rogue to pick the lock and the others mele henchman to attack it.

I wrote a script to stop the behavior of the melee unit only when a rogue is in the party.

So basically the rogue can pick the lock  with out interference from the other members.

It attaches to the click event of the locked object.

Here it is its for a pary of 3 henchman. Modify it to your hearts content.

void main()
{
    object oPC = GetFirstPC();
    object oHenchman1 = GetHenchman(oPC,1);
    object oHenchman2 = GetHenchman(oPC,2);
    object oHenchman3 = GetHenchman(oPC,3);
    if ((GetclassByPosition(1,oHenchman1) == class_TYPE_ROGUE && oHenchman1 != OBJECT_INVALID) ||
        (GetclassByPosition(1,oHenchman2) == class_TYPE_ROGUE && oHenchman2 != OBJECT_INVALID) ||
        (GetclassByPosition(1,oHenchman3) == class_TYPE_ROGUE && oHenchman3 != OBJECT_INVALID))
    {
        if (GetclassByPosition(1,oHenchman1) != class_TYPE_ROGUE)
        {
           DelayCommand(2.0,AssignCommand(oHenchman1,ClearAllActions()));
        }
        if (GetclassByPosition(1,oHenchman2) != class_TYPE_ROGUE)
        {
            DelayCommand(2.0,AssignCommand(oHenchman2,ClearAllActions()));
        }
        if (GetclassByPosition(1,oHenchman3) != class_TYPE_ROGUE)
        {
            DelayCommand(2.0,AssignCommand(oHenchman3,ClearAllActions()));
        }
    }
}

As you can see the possiblities for manipulation are endless this works for my upcomming game/

Regards,

Calva64
               
               

               


                     Modifié par Calva64, 03 mars 2012 - 10:42 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Henchman atacking Chest or locked objects
« Reply #1 on: March 03, 2012, 11:22:05 pm »


               its actually new for me, I will be able to fix it inside AI, will send the real fix as soon as I get back to the patch project again
               
               

               
            

Legacy_Calva64

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
Henchman atacking Chest or locked objects
« Reply #2 on: March 04, 2012, 02:48:06 am »


               well i found a real simple fix. here ti is.

    SetAssociateState(NW_ASC_RETRY_OPEN_LOCKS,FALSE);

this command stops bashing and picking of locks for a henchman.

use need the henchman include file. Thats it.

regards,

Calva64