SetAssociateListenPatterns(object)

From NWN Lexicon
Jump to: navigation, search

Prepares an associate (henchman, summoned, familiar) to be commanded.

void SetAssociateListenPatterns(
    object oTarget = OBJECT_SELF
);

Parameters

oTarget
Associate to initialize commands for. (Default: OBJECT_SELF)


Description

Initialize oTarget to listen for the standard ASSOCIATE_COMMAND_* commands. These are invoked by the PC in the radial menus.

This function seems largely redundant since AddHenchman will automatically seem to call it. The other ways of having associates however - such as summons - not tested yet.

It doesn't require SetListening to be called, these listening patterns are "fake" anyway and simply used as an easy message system between the game and the AI scripts. Since they are special they avoid the usual SetListeningPattern issues:

  • They do not require the PC to be seen, heard or in LoS
  • They span areas
  • They happen instantly even when the game is paused

Some of the commands can be sent individually to a particular NPC (and can only ever be sent to one NPC for some reason, such as Pick Lock) and some to the entire team (if chosen as a generic shout, it can be targeted to one NPC as well). If sent to the entire team they occur in order of party order - so henchman 1, then 2, etc. If you only want one to reply you have to have logic to cover this.

By default the game engine does nothing special with them (besides passing the command onto OnConversation). This means these listening patterns could be reused with SetTlkOverride and replacing the relevant textures. For instance "Pick Lock" could be renamed to "Pick locks and disarm traps" to combine the function, while "Disarm Trap" could be changed to something like "Target particular enemy" which brings up an OnPlayerTarget event. Changes would have to be module-wide.

There are a number of voice commands that initiate the relevant listening pattern command too, marked by a start next to their text. Open the menu with "v" by default then use:

  • W: Combat
    • E: Attack * - "Attack Nearest Enemy" on radial or ASSOCIATE_COMMAND_ATTACKNEAREST
    • D: Heal me * - "Heal Me" on radial or ASSOCIATE_COMMAND_HEALMASTER
    • F: Guard me * - "Guard Me" on radial or ASSOCIATE_COMMAND_GUARDMASTER
    • X: Hold * - "Stand Your Ground" on radial or ASSOCIATE_COMMAND_STANDGROUND
  • E: Exploration
    • E: Follow me * - "Follow" on radial or ASSOCIATE_COMMAND_FOLLOWMASTER

These also fire the voice commands given if selected in the radial. Other commands such as Open Lock or Disarm Trap don't have a voice command or a voice menu option, and sadly some more useful ones like "Search" are not available, although as per above some existing ones could be reused.

In several instances the game will fire associate commands automatically - the PC and in fact scripts have no control on them firing - for instance ASSOCIATE_COMMAND_MASTERSAWTRAP will fire when a trap appears to the PC, and the info is filtered to the associate via. GetLastTrapDetected.


Version

1.22

See Also

functions: 

SetListeningPatterns

constants: 

ASSOCIATE_COMMAND_* Constants



 author: Charles Feduke, editor: Jody Fletcher