NPC Variables

From PSwiki
Jump to navigation Jump to search

For both Behavior Operations and Tribe Scripting some of the fields are parsed for keywords and values replaced before use.


NPC Variables allow for scripting where keywords are replaced in strings.

This allows for generic scripting like:

<talk text="My name is $name" />
<wait duration="$NBUFFER[Wait_Duration]" anim="stand" />

First buffers will be replaced than keywords will be replaced.

Bufferes that wil be replaced

Bufferes will be replaced first. This allows keywords in the buffers.

Keyword Description
$NBUFFER[x] Replace with the value from the NPC buffers that is set by the Tribe Scripting SetBuffer algorithm or the Set Buffer Operation.
$TBUFFER[x] Replace with the value from the Tribe buffers that is set by the Tribe Scripting SetBuffer algorithm or the Set Buffer Operation.

Keywords that will be replaced

The following keywords are replaced in strings used in the NPC Client Scripting.

Keyword Description
$name Replaced with the name of the NPC.
$perception_type The type of the last perception.
$owner If npc is a pet, replaced with the name of the owner
$race Replaced with the race of the NPC.
$race_size Replaced with the size of the NPC.
$target Replaced with the name of the current target.

Additional Keywords that will be replaced for tribes

The following keywords are replaced in strings used in the NPC Client Scripting if the NPC is part of a tribe.

Keyword Description
$member_type Replace with the npc tribe member type.
$resource_area Replace with the npc tribe resource area type.
$tribe If npc is part of a tribe, replaced with the tribes name.

Boolean types

Some script require boolean as output. They will be deamed true if the string resolve to either "true" or "yes".

Example:

<set_buffer buffer="Region" value="true" />
<melee outside_region="$NBUFFER[Region]" />