NWNX:EE  8193.36.12
nwnx_deprecated.nss File Reference

Go to the source code of this file.

Classes

struct  NWNX_Creature_MemorisedSpell
 A memorised spell structure. More...
 

Functions

int NWNX_Creature_GetMemorisedSpellCountByLevel (object creature, int class, int level)
 Gets the count of memorised spells for a creature's class at a level. More...
 
struct NWNX_Creature_MemorisedSpell NWNX_Creature_GetMemorisedSpell (object creature, int class, int level, int index)
 Gets the memorised spell at a class level's index. More...
 
void NWNX_Creature_SetMemorisedSpell (object creature, int class, int level, int index, struct NWNX_Creature_MemorisedSpell spell)
 Sets the memorised spell at a class level's index. More...
 
int NWNX_Creature_GetKnownSpellCount (object creature, int class, int level)
 Gets the known spell count (innate casting) at a class level. More...
 
int NWNX_Creature_GetKnownSpell (object creature, int class, int level, int index)
 Gets the known spell at a class level's index. More...
 
void NWNX_Creature_ClearMemorisedKnownSpells (object creature, int class, int spellId)
 Clear a specific spell from the creature's spellbook for class. More...
 
void NWNX_Creature_ClearMemorisedSpell (object creature, int class, int level, int index)
 Clear the memorised spell of the creature for the class, level and index. More...
 
int NWNX_Creature_GetSoundset (object creature)
 Get the soundset index for creature. More...
 
void NWNX_Creature_SetSoundset (object creature, int soundset)
 Set the soundset index for creature. More...
 
void NWNX_Creature_SetGender (object creature, int gender)
 Sets the creature gender. More...
 
void NWNX_Creature_RestoreSpells (object creature, int level=-1)
 Restore all creature spells per day for given level. More...
 
int NWNX_Creature_GetDomain (object creature, int class, int index)
 Gets one of creature's domains. More...
 
int NWNX_Creature_GetSpecialization (object creature, int class)
 Gets the creature's specialist school. More...
 
int NWNX_Creature_GetSpellUsesLeft (object oCreature, int nSpellID, int nMultiClass, int nDomainLevel=0, int nMetaMagic=METAMAGIC_NONE)
 Get the number of uses left of a spell. More...
 
int NWNX_Creature_GetMemorizedSpellReadyCount (object oCreature, int nSpellID, int nMultiClass, int nMetaMagic=METAMAGIC_NONE)
 Get the number of memorized ready spells by spellid. More...
 
void NWNX_Creature_SetEffectIconFlashing (object oCreature, int nIconId, int bFlashing)
 Set whether an effect icon is flashing or not. More...
 
effect NWNX_Effect_SetEffectExpiredScript (effect e, string script, string data="")
 Set a script with optional data that runs when an effect expires. More...
 
string NWNX_Effect_GetEffectExpiredData ()
 Get the data set with NWNX_Effect_SetEffectExpiredScript() More...
 
object NWNX_Effect_GetEffectExpiredCreator ()
 Get the effect creator. More...
 
effect NWNX_Effect_AccessorizeVisualEffect (effect eEffect)
 Accessorize an EffectVisualEffect(), making it undispellable and unable to be removed by resting or death. More...
 
object NWNX_Object_StringToObject (string id)
 Convert an object id to the actual object. More...
 
int NWNX_Object_CheckFit (object obj, int baseitem)
 Check if an item can fit in an object's inventory. More...
 
void NWNX_Object_AddIconEffect (object obj, int nIcon, float fDuration=0.0)
 Add an effect to an object that displays an icon and has no other effect. More...
 
void NWNX_Object_RemoveIconEffect (object obj, int nIcon)
 Remove an icon effect from an object that was added by the NWNX_Object_AddIconEffect() function. More...
 
void NWNX_Object_SetFacing (object oObject, float fDirection)
 Cause oObject to face fDirection. More...
 
int NWNX_Regex_Search (string str, string regex)
 
string NWNX_Regex_Replace (string str, string regex, string replace="", int firstOnly=FALSE)
 Replaces any matches of the regular expression with a string. More...
 
json NWNX_Regex_Match (string str, string regex)
 Returns all matches in a string that match the regular expression. More...
 
int NWNX_Util_IsValidResRef (string resref, int type=RESTYPE_UTC)
 Determines if the supplied resref exists. More...
 
int NWNX_Util_Get2DARowCount (string str)
 Gets the row count for a 2da. More...
 
string NWNX_Util_GetNSSContents (string sScriptName, int nMaxLength=-1)
 Gets the contents of a .nss script file as a string. More...
 
int NWNX_Util_GetServerTicksPerSecond ()
 Get the ticks per second of the server. More...
 

Variables

Cleric Domains

The clerical domains.

const int NWNX_CREATURE_CLERIC_DOMAIN_AIR = 0
 
const int NWNX_CREATURE_CLERIC_DOMAIN_ANIMAL = 1
 
const int NWNX_CREATURE_CLERIC_DOMAIN_DEATH = 3
 
const int NWNX_CREATURE_CLERIC_DOMAIN_DESTRUCTION = 4
 
const int NWNX_CREATURE_CLERIC_DOMAIN_EARTH = 5
 
const int NWNX_CREATURE_CLERIC_DOMAIN_EVIL = 6
 
const int NWNX_CREATURE_CLERIC_DOMAIN_FIRE = 7
 
const int NWNX_CREATURE_CLERIC_DOMAIN_GOOD = 8
 
const int NWNX_CREATURE_CLERIC_DOMAIN_HEALING = 9
 
const int NWNX_CREATURE_CLERIC_DOMAIN_KNOWLEDGE = 10
 
const int NWNX_CREATURE_CLERIC_DOMAIN_MAGIC = 13
 
const int NWNX_CREATURE_CLERIC_DOMAIN_PLANT = 14
 
const int NWNX_CREATURE_CLERIC_DOMAIN_PROTECTION = 15
 
const int NWNX_CREATURE_CLERIC_DOMAIN_STRENGTH = 16
 
const int NWNX_CREATURE_CLERIC_DOMAIN_SUN = 17
 
const int NWNX_CREATURE_CLERIC_DOMAIN_TRAVEL = 18
 
const int NWNX_CREATURE_CLERIC_DOMAIN_TRICKERY = 19
 
const int NWNX_CREATURE_CLERIC_DOMAIN_WAR = 20
 
const int NWNX_CREATURE_CLERIC_DOMAIN_WATER = 21
 

Function Documentation

◆ NWNX_Creature_GetMemorisedSpellCountByLevel()

int NWNX_Creature_GetMemorisedSpellCountByLevel ( object  creature,
int  class,
int  level 
)

Gets the count of memorised spells for a creature's class at a level.

Parameters
creatureThe creature object.
classThe class id from classes.2da. (Not class index 0-2)
levelThe spell level.
Returns
The memorised spell count.

Definition at line 151 of file nwnx_deprecated.nss.

◆ NWNX_Creature_GetMemorisedSpell()

struct NWNX_Creature_MemorisedSpell NWNX_Creature_GetMemorisedSpell ( object  creature,
int  class,
int  level,
int  index 
)

Gets the memorised spell at a class level's index.

Parameters
creatureThe creature object.
classThe class id from classes.2da. (Not class index 0-2)
levelThe spell level.
indexThe index. Index bounds: 0 <= index < NWNX_Creature_GetMemorisedSpellCountByLevel().
Returns
An NWNX_Creature_MemorisedSpell() struct.

Definition at line 157 of file nwnx_deprecated.nss.

◆ NWNX_Creature_SetMemorisedSpell()

void NWNX_Creature_SetMemorisedSpell ( object  creature,
int  class,
int  level,
int  index,
struct NWNX_Creature_MemorisedSpell  spell 
)

Sets the memorised spell at a class level's index.

Parameters
creatureThe creature object.
classThe class id from classes.2da. (Not class index 0-2)
levelThe spell level.
indexThe index. Index bounds: 0 <= index < NWNX_Creature_GetMemorisedSpellCountByLevel().
spellAn NWNX_Creature_MemorisedSpell() struct.

Definition at line 168 of file nwnx_deprecated.nss.

◆ NWNX_Creature_GetKnownSpellCount()

int NWNX_Creature_GetKnownSpellCount ( object  creature,
int  class,
int  level 
)

Gets the known spell count (innate casting) at a class level.

Parameters
creatureThe creature object.
classThe class id from classes.2da. (Not class index 0-2)
levelThe spell level.
Returns
The known spell count.

Definition at line 174 of file nwnx_deprecated.nss.

◆ NWNX_Creature_GetKnownSpell()

int NWNX_Creature_GetKnownSpell ( object  creature,
int  class,
int  level,
int  index 
)

Gets the known spell at a class level's index.

Parameters
creatureThe creature object.
classThe class id from classes.2da. (Not class index 0-2)
levelThe spell level.
indexThe index. Index bounds: 0 <= index < NWNX_Creature_GetKnownSpellCount().
Returns
The spell id.

Definition at line 180 of file nwnx_deprecated.nss.

◆ NWNX_Creature_ClearMemorisedKnownSpells()

void NWNX_Creature_ClearMemorisedKnownSpells ( object  creature,
int  class,
int  spellId 
)

Clear a specific spell from the creature's spellbook for class.

Parameters
creatureThe creature object.
classThe class id from classes.2da. (Not class index 0-2)
spellIdThe spell to clear.

Definition at line 186 of file nwnx_deprecated.nss.

◆ NWNX_Creature_ClearMemorisedSpell()

void NWNX_Creature_ClearMemorisedSpell ( object  creature,
int  class,
int  level,
int  index 
)

Clear the memorised spell of the creature for the class, level and index.

Parameters
creatureThe creature object.
classThe class id from classes.2da. (Not class index 0-2)
levelThe spell level.
indexThe index. Index bounds: 0 <= index < NWNX_Creature_GetMemorisedSpellCountByLevel().

Definition at line 192 of file nwnx_deprecated.nss.

◆ NWNX_Creature_GetSoundset()

int NWNX_Creature_GetSoundset ( object  creature)

Get the soundset index for creature.

Parameters
creatureThe creature object.
Returns
The soundset used by the creature.

Definition at line 198 of file nwnx_deprecated.nss.

◆ NWNX_Creature_SetSoundset()

void NWNX_Creature_SetSoundset ( object  creature,
int  soundset 
)

Set the soundset index for creature.

Parameters
creatureThe creature object.
soundsetThe soundset index.

Definition at line 204 of file nwnx_deprecated.nss.

◆ NWNX_Creature_SetGender()

void NWNX_Creature_SetGender ( object  creature,
int  gender 
)

Sets the creature gender.

Parameters
creatureThe creature object.
genderThe GENDER_ constant.

Definition at line 210 of file nwnx_deprecated.nss.

◆ NWNX_Creature_RestoreSpells()

void NWNX_Creature_RestoreSpells ( object  creature,
int  level = -1 
)

Restore all creature spells per day for given level.

Parameters
creatureThe creature object.
levelThe level to restore. If -1, all spells are restored.

Definition at line 216 of file nwnx_deprecated.nss.

◆ NWNX_Creature_GetDomain()

int NWNX_Creature_GetDomain ( object  creature,
int  class,
int  index 
)

Gets one of creature's domains.

Parameters
creatureThe creature object.
classThe class id from classes.2da. (Not class index 0-2)
indexThe first or second domain.
Deprecated:
Use GetDomain(). This will be removed in future NWNX releases.

Definition at line 232 of file nwnx_deprecated.nss.

◆ NWNX_Creature_GetSpecialization()

int NWNX_Creature_GetSpecialization ( object  creature,
int  class 
)

Gets the creature's specialist school.

Parameters
creatureThe creature object.
classThe class id from classes.2da. (Not class index 0-2)
Deprecated:
Use GetSpecialization(). This will be removed in future NWNX releases.

Definition at line 238 of file nwnx_deprecated.nss.

◆ NWNX_Creature_GetSpellUsesLeft()

int NWNX_Creature_GetSpellUsesLeft ( object  oCreature,
int  nSpellID,
int  nMultiClass,
int  nDomainLevel = 0,
int  nMetaMagic = METAMAGIC_NONE 
)

Get the number of uses left of a spell.

Note
This function is for caster classes that don't need to memorize spells.
Parameters
oCreatureThe creature.
nSpellIDThe spell ID.
nMultiClassThe position of the class to check, 0-2
nDomainLevelThe domain level if checking a domain spell.
nMetaMagicA METAMAGIC_* constant.
Returns
The number of spell uses left or 0 on error.

Definition at line 244 of file nwnx_deprecated.nss.

◆ NWNX_Creature_GetMemorizedSpellReadyCount()

int NWNX_Creature_GetMemorizedSpellReadyCount ( object  oCreature,
int  nSpellID,
int  nMultiClass,
int  nMetaMagic = METAMAGIC_NONE 
)

Get the number of memorized ready spells by spellid.

Note
This function is for caster classes that need to memorize spells.
Parameters
oCreatureThe creature.
nSpellIDThe spell ID.
nMultiClassThe position of the class to check, 0-2
nMetaMagicA METAMAGIC_* constant.
Returns
The number of spell uses left or 0 on error.

Definition at line 250 of file nwnx_deprecated.nss.

◆ NWNX_Creature_SetEffectIconFlashing()

void NWNX_Creature_SetEffectIconFlashing ( object  oCreature,
int  nIconId,
int  bFlashing 
)

Set whether an effect icon is flashing or not.

Parameters
oCreatureThe target creature.
nIconIdThe icon id, see effecticons.2da.
bFlashingTRUE for flashing, FALSE for not flashing.

Definition at line 256 of file nwnx_deprecated.nss.

◆ NWNX_Effect_SetEffectExpiredScript()

effect NWNX_Effect_SetEffectExpiredScript ( effect  e,
string  script,
string  data = "" 
)

Set a script with optional data that runs when an effect expires.

Parameters
eThe effect.
scriptThe script to run when the effect expires.
dataAny other data you wish to send back to the script.
Remarks
OBJECT_SELF in the script is the object the effect is applied to.
Note
Only works for TEMPORARY and PERMANENT effects applied to an object.

Definition at line 288 of file nwnx_deprecated.nss.

◆ NWNX_Effect_GetEffectExpiredData()

string NWNX_Effect_GetEffectExpiredData ( )

Get the data set with NWNX_Effect_SetEffectExpiredScript()

Note
Should only be called from a script set with NWNX_Effect_SetEffectExpiredScript().
Returns
The data attached to the effect.

Definition at line 294 of file nwnx_deprecated.nss.

◆ NWNX_Effect_GetEffectExpiredCreator()

object NWNX_Effect_GetEffectExpiredCreator ( )

Get the effect creator.

Note
Should only be called from a script set with NWNX_Effect_SetEffectExpiredScript().
Returns
The object from which the effect originated.

Definition at line 300 of file nwnx_deprecated.nss.

◆ NWNX_Effect_AccessorizeVisualEffect()

effect NWNX_Effect_AccessorizeVisualEffect ( effect  eEffect)

Accessorize an EffectVisualEffect(), making it undispellable and unable to be removed by resting or death.

Note
If linked with a non-visualeffect or a non-accessorized visualeffect it will get removed.
Parameters
eEffectAn EffectVisualEffect(), does not work for other effect types.
Returns
The accessorized effect or an unchanged effect if not an EffectVisualEffect().

Definition at line 306 of file nwnx_deprecated.nss.

◆ NWNX_Object_StringToObject()

object NWNX_Object_StringToObject ( string  id)

Convert an object id to the actual object.

Parameters
idThe object id.
Returns
An object from the provided object ID.
Remarks
This is the counterpart to ObjectToString.
Deprecated:
Use the basegame StringToObject() function. This will be removed in a future NWNX release.

Definition at line 351 of file nwnx_deprecated.nss.

◆ NWNX_Object_CheckFit()

int NWNX_Object_CheckFit ( object  obj,
int  baseitem 
)

Check if an item can fit in an object's inventory.

Parameters
objThe object with an inventory.
baseitemThe base item id to check for a fit.
Returns
TRUE if an item of base item type can fit in object's inventory

Definition at line 357 of file nwnx_deprecated.nss.

◆ NWNX_Object_AddIconEffect()

void NWNX_Object_AddIconEffect ( object  obj,
int  nIcon,
float  fDuration = 0.0 
)

Add an effect to an object that displays an icon and has no other effect.

Remarks
See effecticons.2da for a list of possible effect icons.
Parameters
objThe object to apply the effect.
nIconThe icon id.
fDurationIf specified the effect will be temporary and last this length in seconds, otherwise the effect will be permanent.

Definition at line 363 of file nwnx_deprecated.nss.

◆ NWNX_Object_RemoveIconEffect()

void NWNX_Object_RemoveIconEffect ( object  obj,
int  nIcon 
)

Remove an icon effect from an object that was added by the NWNX_Object_AddIconEffect() function.

Parameters
objThe object.
nIconThe icon id.

Definition at line 378 of file nwnx_deprecated.nss.

◆ NWNX_Object_SetFacing()

void NWNX_Object_SetFacing ( object  oObject,
float  fDirection 
)

Cause oObject to face fDirection.

Note
This function is almost identical to SetFacing(), the only difference being that it allows you to specify the target object without the use of AssignCommand(). This is useful when you want to change the facing of an object in an ExecuteScriptChunk() call where AssignCommand() does not work.
Parameters
oObjectThe object to change its facing of
fDirectionThe direction the object should face

Definition at line 390 of file nwnx_deprecated.nss.

◆ NWNX_Regex_Search()

int NWNX_Regex_Search ( string  str,
string  regex 
)
Parameters
strThe string to search.
regexThe regular expression to use when searching.
Returns
TRUE if string matches the regular expression.

Definition at line 417 of file nwnx_deprecated.nss.

◆ NWNX_Regex_Replace()

string NWNX_Regex_Replace ( string  str,
string  regex,
string  replace = "",
int  firstOnly = FALSE 
)

Replaces any matches of the regular expression with a string.

Parameters
strThe string to search.
regexThe regular expression to use when searching.
replaceThe string to replace the matches with.
firstOnlySet to TRUE to only replace the first match.
Returns
A new string with any replacements made.

Definition at line 423 of file nwnx_deprecated.nss.

◆ NWNX_Regex_Match()

json NWNX_Regex_Match ( string  str,
string  regex 
)

Returns all matches in a string that match the regular expression.

Parameters
strThe string to search.
regexThe regular expression to use.
Returns
A json array with json arrays of all (sub)matches. Returns JsonNull() on error.

Definition at line 429 of file nwnx_deprecated.nss.

◆ NWNX_Util_IsValidResRef()

int NWNX_Util_IsValidResRef ( string  resref,
int  type = RESTYPE_UTC 
)

Determines if the supplied resref exists.

Parameters
resrefThe resref to check.
typeThe Resref Type.
Returns
TRUE/FALSE

Definition at line 460 of file nwnx_deprecated.nss.

◆ NWNX_Util_Get2DARowCount()

int NWNX_Util_Get2DARowCount ( string  str)

Gets the row count for a 2da.

Parameters
strThe 2da to check (do not include the .2da).
Returns
The amount of rows in the 2da.

Definition at line 466 of file nwnx_deprecated.nss.

◆ NWNX_Util_GetNSSContents()

string NWNX_Util_GetNSSContents ( string  sScriptName,
int  nMaxLength = -1 
)

Gets the contents of a .nss script file as a string.

Parameters
sScriptNameThe name of the script to get the contents of.
nMaxLengthThe max length of the return string, -1 to get everything
Returns
The script file contents or "" on error.

Definition at line 472 of file nwnx_deprecated.nss.

◆ NWNX_Util_GetServerTicksPerSecond()

int NWNX_Util_GetServerTicksPerSecond ( )

Get the ticks per second of the server.

Remarks
Useful to dynamically detect lag and adjust behavior accordingly.
Returns
The ticks per second.

Definition at line 479 of file nwnx_deprecated.nss.

Variable Documentation

◆ NWNX_CREATURE_CLERIC_DOMAIN_AIR

const int NWNX_CREATURE_CLERIC_DOMAIN_AIR = 0

Definition at line 11 of file nwnx_deprecated.nss.

◆ NWNX_CREATURE_CLERIC_DOMAIN_ANIMAL

const int NWNX_CREATURE_CLERIC_DOMAIN_ANIMAL = 1

Definition at line 12 of file nwnx_deprecated.nss.

◆ NWNX_CREATURE_CLERIC_DOMAIN_DEATH

const int NWNX_CREATURE_CLERIC_DOMAIN_DEATH = 3

Definition at line 13 of file nwnx_deprecated.nss.

◆ NWNX_CREATURE_CLERIC_DOMAIN_DESTRUCTION

const int NWNX_CREATURE_CLERIC_DOMAIN_DESTRUCTION = 4

Definition at line 14 of file nwnx_deprecated.nss.

◆ NWNX_CREATURE_CLERIC_DOMAIN_EARTH

const int NWNX_CREATURE_CLERIC_DOMAIN_EARTH = 5

Definition at line 15 of file nwnx_deprecated.nss.

◆ NWNX_CREATURE_CLERIC_DOMAIN_EVIL

const int NWNX_CREATURE_CLERIC_DOMAIN_EVIL = 6

Definition at line 16 of file nwnx_deprecated.nss.

◆ NWNX_CREATURE_CLERIC_DOMAIN_FIRE

const int NWNX_CREATURE_CLERIC_DOMAIN_FIRE = 7

Definition at line 17 of file nwnx_deprecated.nss.

◆ NWNX_CREATURE_CLERIC_DOMAIN_GOOD

const int NWNX_CREATURE_CLERIC_DOMAIN_GOOD = 8

Definition at line 18 of file nwnx_deprecated.nss.

◆ NWNX_CREATURE_CLERIC_DOMAIN_HEALING

const int NWNX_CREATURE_CLERIC_DOMAIN_HEALING = 9

Definition at line 19 of file nwnx_deprecated.nss.

◆ NWNX_CREATURE_CLERIC_DOMAIN_KNOWLEDGE

const int NWNX_CREATURE_CLERIC_DOMAIN_KNOWLEDGE = 10

Definition at line 20 of file nwnx_deprecated.nss.

◆ NWNX_CREATURE_CLERIC_DOMAIN_MAGIC

const int NWNX_CREATURE_CLERIC_DOMAIN_MAGIC = 13

Definition at line 21 of file nwnx_deprecated.nss.

◆ NWNX_CREATURE_CLERIC_DOMAIN_PLANT

const int NWNX_CREATURE_CLERIC_DOMAIN_PLANT = 14

Definition at line 22 of file nwnx_deprecated.nss.

◆ NWNX_CREATURE_CLERIC_DOMAIN_PROTECTION

const int NWNX_CREATURE_CLERIC_DOMAIN_PROTECTION = 15

Definition at line 23 of file nwnx_deprecated.nss.

◆ NWNX_CREATURE_CLERIC_DOMAIN_STRENGTH

const int NWNX_CREATURE_CLERIC_DOMAIN_STRENGTH = 16

Definition at line 24 of file nwnx_deprecated.nss.

◆ NWNX_CREATURE_CLERIC_DOMAIN_SUN

const int NWNX_CREATURE_CLERIC_DOMAIN_SUN = 17

Definition at line 25 of file nwnx_deprecated.nss.

◆ NWNX_CREATURE_CLERIC_DOMAIN_TRAVEL

const int NWNX_CREATURE_CLERIC_DOMAIN_TRAVEL = 18

Definition at line 26 of file nwnx_deprecated.nss.

◆ NWNX_CREATURE_CLERIC_DOMAIN_TRICKERY

const int NWNX_CREATURE_CLERIC_DOMAIN_TRICKERY = 19

Definition at line 27 of file nwnx_deprecated.nss.

◆ NWNX_CREATURE_CLERIC_DOMAIN_WAR

const int NWNX_CREATURE_CLERIC_DOMAIN_WAR = 20

Definition at line 28 of file nwnx_deprecated.nss.

◆ NWNX_CREATURE_CLERIC_DOMAIN_WATER

const int NWNX_CREATURE_CLERIC_DOMAIN_WATER = 21

Definition at line 29 of file nwnx_deprecated.nss.