SCRIPT FUNCTIONS

Math Functions

TypeCasting/Conversion

Combat Functions

Actions

Information

Targeting

Movement Functions

Time Functions

Effects Functions

Spell Casting

PC/NPC Ability Effects

Environmental Effects

Visual Effects

Sound Effects

Music Effects

Lighting Effects

Inventory Functions

Conversation Functions

String Functions

Party Functions

Journal Functions

Alignment Functions

Experience Functions

Reputation/Faction Functions

Server Functions

Debug Functions

Saving Throw Functions

Item Creation Functions

Area Functions

Module Functions

Encounter Functions

Action on Object Functions

Henchmen/Familiars/Summoned Functions

Local Variable Handlers

Talents/Skills and Feats

Get Data:

From Object

From Creature

Miscellaneous Functions

Money

Spells

Player Character Only

Perception

Traps

Core AI Functions

Core AI TALENT Functions



Math Functions

absolute value of an integer Value

arccosine of fValue

arcsine of fValue

arctan of fValue

cosine of fValue

absolute value of a float Value

log of fValue

fValue is raised to the power of fExponent

sine of fValue

square root of fValue

tan of fValue

TypeCasting/Conversion

Float to Int

Float to String

Convert nInteger into a floating point number.

Convert nInteger to hex, returning the hex value as a string.

Convert nInteger into a string.

Convert fAngle to a vector

Convert fFeet into a number of meters.

Convert oObject into a hexadecimal string.

Convert nRounds into a number of seconds

Convert sNumber into a floating point number.

Convert sNumber into an integer.

Convert nTurns into a number of seconds

Convert vVector to an angle

Convert fYards into a number of meters.

Combat Functions

Actions

Attack oAttackee

The caller will perform a Melee Touch Attack on oTarget

The caller will perform a Ranged Touch Attack on oTarget

Information

Get Attack Target

Get Attempted Attack Target

Get the creature that is going to attack oTarget.

Determine if oCreature is in combat

Get the last attacker of oAttackee

Get the attack mode (COMBAT_MODE_*) of oCreature's last attack

Get the attack type (SPECIAL_ATTACK_*) of oCreature's last attack

Get the last weapon that oCreature used in an attack.

Get nDamage adjusted by oTarget's reflex and evasion saves.

Get the total amount of damage that has been dealt to the caller.



Targeting

Get the Nth object nearest to oTarget that is of the specified type.

Get the creature nearest to lLocation

Get the Nth object nearest to oTarget that is of the specified type.

Get the nth Object nearest to oTarget that has sTag as its tag.

Get the nNth object nearest to lLocation that is of the specified type.

Determine whether oSource hears oTarget.

Determine whether oSource sees oTarget.

Get the vector to oTarget

Get the position vector from lLocation.

Movement Functions

Force Follow Object

Force Move to Location

Force Move to Object

The subject will jump to lLocation instantly as an action

Jump to an object ID, or as near to it as possible, as an action.

Jump to Location

Jump to Object

Move away from Location

Move away from Object

ActionMove to Location

ActionMove to Object

Random Walk

Rest

Sit in oChair.

Get oCreature's movement rate.

Get the destination (a waypoint or a door) for a trigger or a door.

Get the first waypoint with the specified tag.

Cause the caller to face fDirection

Cause the caller to face vTarget

Create a vector with the specified values for x, y and z

Get the magnitude of vVector

Normalize vVector

WalkWayPoints

Time Functions

Do nothing for fSeconds seconds.

Delay aActionToDelay by fSeconds.

Get Calendar Day

Get Calendar Month

Get Calendar Year

Find out if it is currently Dawn

Find out if it is currently Day

Find out if it is currently Dusk

Determine if it is currently Night

Get the current hour.

Get the current millisecond

Get the current second

Get the current minute

Convert nHours into a number of seconds

Set the calendar to the specified date.

Set Time

Effects

Determine if eEffect is a valid effect

Get the next in-game effect on oCreature.

Set the subtype of eEffect to Magical and return eEffect.

Remove eEffect from oCreature.

Set the subtype of eEffect to Supernatural and return eEffect

Set eEffect to be versus a specific alignment.

Set eEffect to be versus a specific race.

Set eEffect to be versus traps.

Set the subtype of eEffect to Extraordinary and return eEffect

Spell Casting

The action subject will fake casting a spell at lLocation

The action subject will fake casting a spell at oTarget

Cast Spell at Location

Cast Spell at Object

Counterspell oCounterSpellTarget

Determine if oObject has effects originating from nSpell

Ability Effects

Ability Decrease effect

Ability Increase effect

AC Decrease effect

AC Increase effect

Appear Effect

Area of Effect

Attack Decrease effect

Attack Increase effect

Beam effect

Blindness

Charmed

Concealment - by percentage

Confused

Curse effect on one or more attributes

Damage effect

Decrease damage effect

Damage Immunity Decrease

Damage Immunity Increase

Increase damage effect

Damage Reduction

Damage Resistance

Damage Shield

Darkness

Daze

Deaf

Death

Disappear

Disappear - then Appear again

Disease

Dispell Magic - All

Dispell Magic - Best

Dominated

Entangled

Frightened

Haste

HP change on creature Dying effect

Heal effect

Immunity Effect by type

Invisibility effect

Knockdown effect

Link two Effects together

Miss Chance effect

Modify Number of Attacks effect

Movement Speed Decrease

Movement Speed Increase

Negative Level Effect

Paralyze

Poison

Polymorph

Regeneration

Resurrection1

Sanctuary

Saving Throw Decrease

Saving Throw Increase

See Invisible

Silence

Skill Decrease

Skill Increase

Sleep

Slow

Spell Immunity

Spell Level Absorbtion

Spell Resistance Decrease

Spell Resistance Increase

Stun

Summon Creature

Swarm

Temporary Hitpoints

Time Stop

True Seeing

Turn Undead

Turn Resistance Decrease

Turn Resistance Increase

Ultravision

Visual Effects

Cause the action subject to play an animation

Apply eEffect at lLocation

Apply eEffect to Object

Create a Visual Effect that can be applied to an object.

Play nAnimation immediately.

Sound Effects

Get the duration (in seconds) of the sound attached to nStrRef

Play sSoundName

Play a voice chat.

Play Object Sound

Set the position of an Object's oSound.

Set the volume of an Object's oSound.

Stop playing Object's oSound.

Immediately speak a conversation one-liner.

Music Effects

Change the ambient day track for oArea to nTrack

Change the ambient night track for oArea to nTrack

Play the ambient sound for oArea.

Set the ambient day volume for oArea to nVolume

Set the ambient night volume for oArea to nVolume

Stop the ambient sound for oArea.

Change the background day track for oArea to nTrack.

Change the background night track for oArea to nTrack.

Get the Battle Track for oArea.

Get the Day Track for oArea.

Get the Night Track for oArea.

Play the background music for oArea.

Set the delay for the background music for oArea.

Stop the background music for oArea.

Change the battle track for oArea.

Play the battle music for oArea.

Stop the battle music for oArea.

Lighting

Get the color for the main light 1 of the tile at lTile.

Get the color for the main light 2 of the tile at lTile.

Get the color for the source light 1 of the tile at lTile.

Get the color for the source light 2 of the tile at lTile.

Get All clients in oArea to recompute the static lighting.

Set the status of the illumination for oPlaceable.

Set the main light color on the tile at lTileLocation.

Set the source light color on the tile at lTileLocation.

Inventory Functions

Determine whether oObject has an inventory

Equip oItem into nInventorySlot

Equip most damaging melee weapon

Equip most damaging ranged weapon

Equip Best Armor

Get the item that caused the caller's OnInventoryDisturbed script to fire

Get the type of disturbance for OnInventoryDisturbed

Get the object which is in oCreature's specified inventory slot

Get the last object that disturbed the inventory of the caller.

Get the next item in oTarget's inventory

Give Item to Someone

Pick up oItem from the ground

Put down oItem on the ground.

Take Item from Someone else

Unequip Item from Inventory

Get the first item in oTarget's inventory

Conversation Functions

Begin Conversation

Conversation event

Determine whether oObject is in conversation.

Display Floaty Text above creature

Display Floaty Text above creature - using String Refs

Get the person with whom you are conversing.

Get the number of the string pattern matched in the conversation

Get the appropriate matched string in Conversation script

Get the number of string parameters matched.

Get the PC that is involved in the conversation.

Pause Conversation

Resume a conversation after it has been paused.

Speak String

Speak String Reference

Start Conversation

The caller will immediately speak sStringToSpeak

String Functions

Convert sString to Lower Case

Convert sString to Upper Case

Find the position of sSubstring inside sString

Get a string from the talk table using nStrRef.

Get nCounter characters from the left end of sString

Get the length of sString

Get nCounter characters from the right end of sString

Get nCount characters from sString, starting at nStart

Insert sString into sDestination at nPosition

Test String Against Pattern

Party Functions

Add oPC to oPartyLeader's party

Remove oPC from their current party

Journal Functions

Add Journal Quest Entry

Remove a journal quest entry from oCreature.

Alignment Functions

Adjust the alignment of oSubject

Get Good/Evil Value

Get oCreature's Law/Chaos Value

Experience Functions

Get the experience assigned in the journal editor for szPlotID.

Sets oCreature's experience to nXpAmount.

Reputation/Faction Functions

Adjust Reputation

Change Faction

Clear Personal Reputation

Determine if the Faction Ids of the two objects are the same

Determine if oSource considers oTarget as a friend

Determine if oSource considers oTarget as neutral.

Determine whether oSource has a friendly reaction towards oTarget

Determine whether oSource has a hostile reaction towards oTarget

Determine whether oSource has a neutral reaction towards oTarget

Find out how oSource feels about oTarget.

Find out how nStandardFaction feels about oCreature.

Get Average Faction Alignment - Good/Evil

Get Average Faction Alignment - Law/Chaos

Get Average Faction Level

Get Average Faction Reputation

Get Average Faction Experience Points

Get Best Faction AC

Get Faction's Total Gold

Get Faction Leader

Get Faction Least Damaged

Get the member of oFactionMember's faction that has taken the most damage

Get Faction's most frequent class

Get Faction's Strongest member

Get Faction's Weakest member

Get Worst Faction AC

Get the first member of oMemberOfFaction's faction

Get the next member of oMemberOfFaction's faction

Get the last object that was sent as a Hostile towards oCreature

Make oSource into a temporary enemy of oTarget using personal reputation

Make oSource into a temporary friend of oTarget using personal reputation

Make oSource into a temporary neutral of oTarget using personal reputation

Make oCreatureToChange join one of the standard factions

Set how nStandardFaction feels about oCreature.

Server Functions

Activate Portal

End Game

Export All Characters

Get the IP address from which oPlayer has connected.

Get the public part of the CD Key that oPlayer used when logging in.

Make the corresponding panel button on the player's client start or stop flashing.

Remove oPlayer from the server

Single Player AutoSave

Debug Functions

Print Log File for Debugging Talents

Inserts a debug print string into the log.

Output a formatted float to the log file.

Output a formatted integer to the log file.

Output a formatted string to the log file.

Output a formatted object to the log file.

Output a formatted vector to the log file.

Write sLogEntry as a timestamped entry into the log file

Saving Throw Functions

Do a Fortitude Save check for the given DC

Do a Reflex Save check for the given DC

Does a Will Save check for the given DC

Get oTarget's base fortitude saving throw value

Get oTarget's base reflex saving throw value

Get the DC to save against for a spell

Get oTarget's base will saving throw value

Item Creation Functions

Create Generic Druid Weapon

Create Generic Monk Weapon

Create Generic Wizard Weapon

Create Item On Object

Create Item At Location

Create Specific Druid Weapon

Create Specific Monk Weapon

Create Specific Wizard Weapon

Area Functions

Expose the entire map of oArea to oPlayer

Get the first object in oArea

Get the next object in oArea.

Set whether oMapPin is enabled.

Module Functions

Get the module.

Get the module's name in the language of the server that's running it.

Get the starting location of the module.

Use this in an OnItemAcquired script to get the item that was acquired.

Use in an OnItemAcquired script:Get the creatre that previously possessed the item.

Use this in an OnItemLost script to get the item that was lost/dropped.

Use this in an OnItemLost script to get the creature that lost the item.

Shut down the currently loaded module and start a new one

Encounter Functions

Determine whether oEncounter is active

Determine if oCreature was spawned from an encounter

Get the difficulty level of oEncounter

Get the number of times that oEncounter has spawned so far

Get the maximum number of times that oEncounter will spawn.

Set oEncounter's active state to nNewValue.

Set the difficulty level of oEncounter.

Set the number of times that oEncounter has spawned so far

Set the maximum number of times that oEncounter can spawn

Action on Object Functions

Activate oItem

Cause the action subject to close oDoor

Determined whether oItem has been identified

Determine if oObject is a valid object

Determine if oObject (which is a placeable or a door) is currently open

Determine if nPlacebleAction is valid for oPlaceable

Determine if oObject is trapped

Get the item that was activated

Get the activated item's target

Get the location of the activated item's target

Get the creature that activated the item.

Get the object that closed the door or placeable

Get the last object that disarmed the trap on the caller

Get the last object that locked the caller.

Get the last creature that opened the caller.

Get the last object that used the placeable object that is calling this function.

Get the location of oObject.

Get the Tag of oObject

Lock oTarget

Open Door

Perform nDoorAction on oTargetDoor

Perform Placeable Object Action

Return TRUE if oItem is a ranged weapon.

Set whether oItem has been identified.

Set the destroyable status of the caller.

Set the locked state of oTarget, which can be a door or a placeable object.

Use oPlaceable.

Unlock Object

Henchmen/Familiars/Summoned Functions

Add oHenchman as a henchman to oMaster

Get Associate

Get Familiar Type

Get Familiar Name

Get the henchman belonging to oMaster

Get the last command (ASSOCIATE_COMMAND_*) issued to oAssociate

Get the master of oAssociate.

Remove oHenchman from the service of oMaster

Removes oAssociate from the service of oMaster

Set Associate Listen Patterns

Summon an Animal Companion

Summon a Familiar

Local Variable Handlers

Delete oObject's local float variable sVarName

Delete oObject's local integer variable sVarName

Delete oObject's local location variable sVarName

Delete oObject's local object variable sVarName

Delete oObject's local string variable sVarName

Get oObject's local float variable sVarName

Get oObject's local integer variable sVarName

Get oObject's local location variable sVarName

Get oObject's local object variable sVarName

Get oObject's local string variable sVarName

Set oObject's local float variable sVarName to nValue

Set oObject's local int variable sVarName to nValue

Set oObject's local string variable sVarName to nValue

Set oObject's local object variable sVarName to nValue

Set oObject's local location variable sVarName to nValue

Talents/Skills and Feats

Use nFeat on oTarget

Use Skill on Target

Use tChosenTalent at lTargetLocation.

Use Talent on Object

Determine whether oCreature has nSkill, and nSkill is useable

Determine whether oCreature has nFeat, and nFeat is useable.

Determine if oObject has effects on it originating from nFeat.

Get the ID of tTalent

Determine if tTalent is valid

Get the number of ranks that oTarget has in nSkill.

Get the type (TALENT_TYPE_*) of tTalent.

TalentFeat(int nFeat)

TalentSkill(int nSkill)

TalentSpell(int nSpell)

Get Data

From Object

Determine if the weapon equipped is capable of damaging oVersus

Determines whether oItem has nProperty

Determine if a specific key is required to open the lock on oObject

Determine if the lock on oObject is lockable.

Determine the DC of locking a lock on oObject

Determine the DC of unlocking a lock on oObject

Determine if the illumination for oPlaceable is on

Get the last object that unlocked the caller.

Get the locked state of oTarget

Get the Armour Class of oItem

Get the tag of the key that will open the lock on oObject

Get the name of oObject.

Get the number of stacked items that oItem comprises.

Get the nNth object with the specified tag.

Get the object type (OBJECT_TYPE_*) of oTarget

From Creature

Determine whether oTarget's action stack can be modified

Determine whether oCreature has tTalent

Determine whether oCreature has nSpell memorised

Determine whether oCreature is being controlled by a DM

Determine if nDoorAction can be performed on oTargetDoor

Determine if oObject is listening for something

Determine if oCreature is a Player Controlled character

Determine if oCreature is of a playable racial type

Determine if oCreature is resting

Get Ability Modifier

Get Ability Score

Get AC

Get Age

Get Alignment - Good/Evil

Get Alignment - Law/Chaos

Get Animal Companion Creature Type

Get Animal Companion Name

Get the area that oTarget is currently in

Get the area's object ID from lLocation.

Get Blocking Door

Get Caster Level

Get Challenge Rating

Get the creature's class (CLASS_TYPE_*) based on nClassPosition

Get the target that last clicked on a trigger

Get Creature Size

Get the best talent (i.e. closest to nCRMax without going over) of oCreature

Get a random talent of oCreature, within nCategory

Get the current action (ACTION_*) that oObject is executing

Get the current hitpoints of oObject

Get Damage Dealt by type

Get Deity

Get Distance between Objects

Get Distance between Locations

Get Distance to Object

Get Effect Creator

Get Effect Duration Type

Get the spell id(SPELL_*) that applied eSpellEffect

Get Effect Type

Get Effect Sub Type

Get the object possessed by oCreature with the tag sItemTag

Get Entering Object

Get Exiting Object

Get Facing

Get the orientation value from lLocation.

Get the possessor of oItem

Get the first in-game effect on oCreature

Get the creature that is currently sitting on the specified object.

Get First PC in party list

Get the name of oCreature's sub race.

Get the next PC in the player list.

Get the gender of oCreature

Get the number of hitdice for oCreature

Get the racial type (RACIAL_TYPE_*) of oCreature

Get the last trap detected by oTarget.

Get the maximum Hit Points possible for oTarget

Get the trap nearest to oTarget.

Get oCreature's experience.

Returns the creator of oAreaOfEffectObject.

Set whether oObject is listening.

Set the string for oObject to listen for.

Miscellaneous Functions

Assign aActionToAssign to oActionSubject

Cause oObject to run evToRun

Clear All Actions

Create an event of the type nUserDefinedEventNumber

Destroy Object

Determine if oCreature is a dead NPC, dead PC or a dying PC

Determine if oSource considers oTarget as an enemy

Determine if oCreature has immunity of type nImmunity versus oVersus

Determine the levels that oCreature holds in nClassType.

Determines the creature's class level based on nClass Position.

Determine whether oTarget is a plot object.

Do aActionToDo

Execute Script

Get the first object within oPersistentObject

Get the first object in nShape

Get the object that killed the caller

Get the metamagic type (METAMAGIC_*) of the last spell cast by the caller

Get Next In Persistant object???

Get Next Object in Shape

Get the number of Hitdice worth of Turn Resistance that oUndead may have

Gets the event number in a User Defined Event.

Get an integer between 0 and nMaxInteger-1.

Generate Random Name

Give nXP Experience to oCreature

NPC Surrender to Enemies

Open oStore for oPC.

PopUpDeathGUIPanel

Rolling Dice - D2 - D100

Spawn a GUI panel for the client that controls oPC.

Sends szMessage to all the Dungeon Masters currently on the server.

Send a server message (szMessage) to the oPlayer.

Set the transition bitmap of a player

Set Camera Facing

Set the camera mode for oPlayer.

Set whether oTarget's action stack can be modified

Set the value for a custom token.

Set oTarget's plot object status.

Set Weather

Money

Get the amount of gold possessed by oTarget.

Get the gold piece value of oItem.

Give nGP gold to oCreature.

Take nAmount of gold from oCreatureToTakeFrom.

Spells

Create an event which triggers the "SpellCastAt" script

Determine whether the last spell cast in a spell script was considered harmful.

Do a Spell Resistance check between oCaster and oTarget

Get Attempted Spell Target

Get the ID of the last spell that was cast.

Get who cast the last spell in a spell script.

Get the item used to cast the last spell.

Gets the ID of the spell that is being cast (SPELL_*).

Get the location of the caller's last spell target.

Get the object at which the caller last cast a spell

Player Character Only

Determine the type (REST_EVENTTYPE_REST_*) of the last rest event

Get the last PC that rested

Get the last player that died

Get the last player who is dying.

Get the object id of the player who last pressed the respawn button.

Get the last PC that levelled up.

Get the name of oPlayer.

Sets oPlayer and oTarget to dislike each other.

Sets oPlayer and oTarget to like each other.

Perception

Determine whether the object that was perceived was heard.

Determine whether the object that was perceived has become inaudible.

Determine whether the object that was perceived was seen.

Determine whether the object that was perceived has vanished.

Get the last object that was perceived by the caller

Traps

Determine if oCreature has detected oTrapObject

Determine if oTrapObject is disarmable.

Determine if oTrapObject is detectable.

Determine if oTrapObject has been flagged as visible to all creatures.

Determine if oTrapObject is one-shot (i.e. it does not reset itself after firing.

Disable oTrap

Get the trap base type (TRAP_BASE_TYPE_*) of oTrapObject.

Get the creator of oTrapObject, the creature that set the trap.

Get the DC for detecting oTrapObject.

Get the DC for disarming oTrapObject.

Get the tag of the key that will disarm oTrapObject.

Set oDetector to have detected oTrap.

Core AI Functions

Functions used in the Generic Scripts - no documentation currently

Activate Flee to Exit

AnalyzeCombatSituation()

Associate Check

Bash Door Check

Return the number of enemies on a target.

Returns the number of persons who are considered friendly to the the target

Check is Unlocked

Check Waypoints

Compare Last Spell Cast

Create Sign Post NPC

Determine Class To Use

DetermineCombatRound(object oIntruder = OBJECT_INVALID, int nAI_Difficulty = 10)

DetermineEnemies()

DetermineSpecialBehavior(object oIntruder = OBJECT_INVALID)

Equip Appropriate Weapons

Find a single target who is an enemy with 30m of self

GetAlliedHD()

Get Associate Max Challenge Rating

Get Assosicate Heal Master

Get Associate Start Location

Get Associate State

Get Attack Compatibility

Get Behavior State

Get Character Level

GetEnemyHD()

GetFleeToExit()

GetFollowDistance()

Checks the target for a specific EFFECT_TYPE constant value

Determine if the NPC has an attempted spell or attack target

Determine if the object has any posts or waypoints to walk

Return a SPELL_ constant for the last spell used

Get the nearest locked object to the master

GetMatchCompatibility(talent tUse, string sClass, int nType)

GetMostDangerousClass(struct sEnemies sCount)

Returns the nearest object that can be seen, then checks for the nearest heard target.

GetNPCWarningStatus()

Calculate the number of people currently attacking self.

Calculate the number of people currently attacking self from beyond 5 meters.

Determine the percentage of HP object-self has left

Determine the number of targets within 20m that are of the specified racial-type

GetRangedAttackGroup(int bAllowFriendlyFire = FALSE)

GetSpawnInCondition(int nCondition)

GetToughestAttacker()

GetToughestMeleeAttacker()

MatchCombatProtections(talent tUse)

MatchElementalProtections(talent tUse)

MatchFortAttacks(talent tUse)

MatchReflexAttacks(talent tUse)

MatchSpellProtections(talent tUse)

PlayImmobileAmbientAnimations()

PlayMobileAmbientAnimations()

If using ambient sleep this will remove the effect

Reset henchman State

nDetermineClassToUse(object oCharacter)

DetermineCombatRound

RespondToShout(object oShouter, int nShoutIndex, object oIntruder = OBJECT_INVALID)

RunCircuit(int nTens, int nNum, int nRun = FALSE, float fPause = 1.0)

RunNextCircuit(int nRun = FALSE, float fPause = 1.0)

SetAssociateStartLocation()

SetAssociateState(int nCondition, int bValid = TRUE)

SetBehaviorState(int nCondition, int bValid = TRUE)

Sets a local variable for the last spell used

SetListeningPatterns()

SetNPCWarningStatus(int nStatus = TRUE)

SetSpawnInCondition(int nCondition, int bValid = TRUE)

SetSpawnInLocals(int nCondition)

SetSummonHelpIfAttacked()

talent StartAttackLoop()

talent StartProtectionLoop()

UniversalSpellMatch(talent tUse)

VerifyCombatMeleeTalent(talent tUse, object oTarget)

VerifyDisarm(talent tUse, object oTarget)

CreateGenericExotic(object oTarget, object oAdventurer, int nModifier = 0)

Core AI TALENT Functions

TalentAdvancedBuff(float fDistance)

TalentAdvancedProtectSelf()

TalentBardSong()

TalentBuffSelf()

TalentCureCondition()

TalentDragonCombat(object oIntruder = OBJECT_INVALID)

TalentEnhanceOthers()

TalentFlee(object oIntruder = OBJECT_INVALID)

TalentHeal(int nForce = FALSE)

TalentHealingSelf()

TalentMeleeAttack(object oIntruder = OBJECT_INVALID)

TalentMeleeAttacked(object oIntruder = OBJECT_INVALID)

TalentPersistentAbilities()

TalentRangedAttackers(object oIntruder = OBJECT_INVALID)

TalentRangedEnemies(object oIntruder = OBJECT_INVALID)

TalentSeeInvisible()

TalentSneakAttack()

TalentSpellAttack(object oIntruder)

TalentSummonAllies()

TalentUseEnhancementOnSelf()

TalentUseProtectionOnSelf()

TalentUseProtectionOthers()

TalentUseTurning()

// Maths operation: integer absolute value of nValue

// * Return value on error: 0

int abs(int nValue)



// Maths operation: arccosine of fValue

// * Returns zero if fValue > 1 or fValue < -1

float acos(float fValue)



// Attack oAttackee.

// - bPassive: If this is TRUE, attack is in passive mode.

void ActionAttack(object oAttackee, int bPassive=FALSE)



// The action subject will fake casting a spell at lLocation; the conjure and

// cast animations and visuals will occur, nothing else.

// - nSpell

// - lTarget

// - nProjectilePathType: PROJECTILE_PATH_TYPE_*

void ActionCastFakeSpellAtLocation(int nSpell, location lTarget, int nProjectilePathType=PROJECTILE_PATH_TYPE_DEFAULT)



// The action subject will fake casting a spell at oTarget; the conjure and cast

// animations and visuals will occur, nothing else.

// - nSpell

// - oTarget

// - nProjectilePathType: PROJECTILE_PATH_TYPE_*

void ActionCastFakeSpellAtObject(int nSpell, object oTarget, int nProjectilePathType=PROJECTILE_PATH_TYPE_DEFAULT)



// - nSpell: SPELL_*

// - lTargetLocation

// - nMetaMagic: METAMAGIC_*

// - bCheat: If this is TRUE, then the executor of the action doesn't have to be

// able to cast the spell.

// - nProjectilePathType: PROJECTILE_PATH_TYPE_*

// - bInstantSpell: If this is TRUE, the spell is cast immediately; this allows

// the end-user to simulate

// a high-level magic user having lots of advance warning of impending trouble.

void ActionCastSpellAtLocation(int nSpell, location lTargetLocation, int nMetaMagic=METAMAGIC_ANY, int bCheat=FALSE, int nProjectilePathType=PROJECTILE_PATH_TYPE_DEFAULT, int bInstantSpell=FALSE)



// - oTarget: Target for the spell

// - nMetamagic: METAMAGIC_*

// - bCheat: If this is TRUE, then the executor of the action doesn't have to be

// able to cast the spell.

// - nDomainLevel: TBD - SS

// - nProjectilePathType: PROJECTILE_PATH_TYPE_*

// - bInstantSpell: If this is TRUE, the spell is cast immediately. This allows

// the end-user to simulate a high-level magic-user having lots of advance

// warning of impending trouble

void ActionCastSpellAtObject(int nSpell, object oTarget, int nMetaMagic=METAMAGIC_ANY, int bCheat=FALSE, int nDomainLevel=0, int nProjectilePathType=PROJECTILE_PATH_TYPE_DEFAULT, int bInstantSpell=FALSE)



// Cause the action subject to close oDoor

void ActionCloseDoor(object oDoor)



// Counterspell oCounterSpellTarget.

void ActionCounterSpell(object oCounterSpellTarget)



// Do aActionToDo.

void ActionDoCommand(action aActionToDo)



// Equip oItem into nInventorySlot.

// - nInventorySlot: INVENTORY_SLOT_*

// * No return value, but if an error occurs the log file will contain

// "ActionEquipItem failed."

void ActionEquipItem(object oItem, int nInventorySlot)



// The creature will equip the melee weapon in its possession that can do the

// most damage. If no valid melee weapon is found, it will equip the most

// damaging range weapon. This function should only ever be called in the

// EndOfCombatRound scripts, because otherwise it would have to stop the combat

// round to run simulation.

// - oVersus: You can try to get the most damaging weapon against oVersus

// - bOffHand

void ActionEquipMostDamagingMelee(object oVersus=OBJECT_INVALID, int bOffHand=FALSE)



// The creature will equip the range weapon in its possession that can do the

// most damage.

// If no valid range weapon can be found, it will equip the most damaging melee

// weapon.

// - oVersus: You can try to get the most damaging weapon against oVersus

void ActionEquipMostDamagingRanged(object oVersus=OBJECT_INVALID)



// The creature will equip the armour in its possession that has the highest

// armour class.

void ActionEquipMostEffectiveArmor()



// The action subject will follow oFollow until a ClearAllActions() is called.

// - oFollow: this is the object to be followed

// - fFollowDistance: follow distance in metres

// * No return value

void ActionForceFollowObject(object oFollow, float fFollowDistance=0.0f)



// Force the action subject to move to lDestination.

void ActionForceMoveToLocation(location lDestination, int bRun=FALSE, float fTimeout=30.0f)



// Force the action subject to move to oMoveTo.

void ActionForceMoveToObject(object oMoveTo, int bRun=FALSE, float fRange=1.0f, float fTimeout=30.0f)



// Give oItem to oGiveTo

// If oItem is not a valid item, or oGiveTo is not a valid object, nothing will

// happen.

void ActionGiveItem(object oItem, object oGiveTo)



// Use oPlaceable.

void ActionInteractObject(object oPlaceable)



// The subject will jump to lLocation instantly (even between areas).

// If lLocation is invalid, nothing will happen.

void ActionJumpToLocation(location lLocation)



// Jump to an object ID, or as near to it as possible.

void ActionJumpToObject(object oToJumpTo, int bWalkStraightLineToPoint=TRUE)



// The action subject will lock oTarget, which can be a door or a placeable

// object.

void ActionLockObject(object oTarget)



// Causes the action subject to move away from lMoveAwayFrom.

void ActionMoveAwayFromLocation(location lMoveAwayFrom, int bRun=FALSE, float fMoveAwayRange=40.0f)



// Cause the action subject to move to a certain distance away from oFleeFrom.

// - oFleeFrom: This is the object we wish the action subject to move away from.

// If oFleeFrom is not in the same area as the action subject, nothing will

// happen.

// - bRun: If this is TRUE, the action subject will run rather than walk

// - fMoveAwayRange: This is the distance we wish the action subject to put

// between themselves and oFleeFrom

// * No return value, but if an error occurs the log file will contain

// "ActionMoveAwayFromObject failed."

void ActionMoveAwayFromObject(object oFleeFrom, int bRun=FALSE, float fMoveAwayRange=40.0f)



// The action subject will move to lDestination.

// - lDestination: The object will move to this location. If the location is

// invalid or a path cannot be found to it, the command does nothing.

// - bRun: If this is TRUE, the action subject will run rather than walk

// * No return value, but if an error occurs the log file will contain

// "MoveToPoint failed."

void ActionMoveToLocation(location lDestination, int bRun=FALSE)



// Cause the action subject to move to a certain distance from oMoveTo.

// If there is no path to oMoveTo, this command will do nothing.

// - oMoveTo: This is the object we wish the action subject to move to

// - bRun: If this is TRUE, the action subject will run rather than walk

// - fRange: This is the desired distance between the action subject and oMoveTo

// * No return value, but if an error occurs the log file will contain

// "ActionMoveToObject failed."

void ActionMoveToObject(object oMoveTo, int bRun=FALSE, float fRange=1.0f)



// Cause the action subject to open oDoor

void ActionOpenDoor(object oDoor)



// Pause the current conversation.

void ActionPauseConversation()



// Pick up oItem from the ground.

// * No return value, but if an error occurs the log file will contain

// "ActionPickUpItem failed."

void ActionPickUpItem(object oItem)



// Cause the action subject to play an animation

// - nAnimation: ANIMATION_*

// - fSpeed: Speed of the animation

// - fDurationSeconds: Duration of the animation (this is not used for Fire and

// Forget animations)

void ActionPlayAnimation(int nAnimation, float fSpeed=1.0, float fDurationSeconds=0.0)



// Put down oItem on the ground.

// * No return value, but if an error occurs the log file will contain

// "ActionPutDownItem failed."

void ActionPutDownItem(object oItem)



// The action subject will generate a random location near its current location

// and pathfind to it. All commands will remove a RandomWalk() from the action

// queue if there is one in place.

// * No return value, but if an error occurs the log file will contain

// "ActionRandomWalk failed."

void ActionRandomWalk()



// The creature will rest.

void ActionRest()



// Resume a conversation after it has been paused.

void ActionResumeConversation()



// Sit in oChair.

// Note: not all creatures will be able to sit.

void ActionSit(object oChair)



// Add a speak action to the action subject.

// - sStringToSpeak: String to be spoken

// - nTalkVolume: TALKVOLUME_*

void ActionSpeakString(string sStringToSpeak, int nTalkVolume=TALKVOLUME_TALK)



// Causes the creature to speak a translated string.

// - nStrRef: Reference of the string in the talk table

// - nTalkVolume: TALKVOLUME_*

void ActionSpeakStringByStrRef(int nStrRef, int nTalkVolume=TALKVOLUME_TALK)



// Starts a conversation with oObjectToConverseWith - this will cause their

// OnDialog event to fire.

// - oObjectToConverseWith

// - sDialogResRef: If this is blank, the creature's own dialogue file will be used

// - bPrivateConversation

void ActionStartConversation(object oObjectToConverseWith, string sDialogResRef="", int bPrivateConversation=FALSE)



// Take oItem from oTakeFrom

// If oItem is not a valid item, or oTakeFrom is not a valid object, nothing

// will happen.

void ActionTakeItem(object oItem, object oTakeFrom)



// Unequip oItem from whatever slot it is currently in.

void ActionUnequipItem(object oItem)



// The action subject will unlock oTarget, which can be a door or a placeable

// object.

void ActionUnlockObject(object oTarget)



// Use nFeat on oTarget.

// - nFeat: FEAT_*

// - oTarget

void ActionUseFeat(int nFeat, object oTarget)



// Runs the action "UseSkill" on the current creature

// Use nSkill on oTarget.

// - nSkill: SKILL_*

// - oTarget

// - nSubSkill: SUBSKILL_*

// - oItemUsed: Item to use in conjunction with the skill

void ActionUseSkill(int nSkill, object oTarget, int nSubSkill=0, object oItemUsed=OBJECT_INVALID )



// Use tChosenTalent at lTargetLocation.

void ActionUseTalentAtLocation(talent tChosenTalent, location lTargetLocation)



// Use tChosenTalent on oTarget.

void ActionUseTalentOnObject(talent tChosenTalent, object oTarget)



// Do nothing for fSeconds seconds.

void ActionWait(float fSeconds)



void ActivateFleeToExit()



// - bSeamless: if this is set, the client wil not be prompted with the

// information window telling them about the server, and they will not be

// allowed to save a copy of their character if they are using a local vault

// character.

void ActivatePortal(object oTarget, string sIPaddress="", string sPassword="", string sWaypointTag="", int bSeemless=FALSE)



// Add oHenchman as a henchman to oMaster

void AddHenchman(object oMaster, object oHenchman=OBJECT_SELF)



// - bAllPlayers: If this is TRUE, the entry will show up in the journal of

// everyone in the world

// - bAllowOverrideHigher: If this is TRUE, you can set the state to a lower

// number than the one it is currently on

void AddJournalQuestEntry(string szPlotID, int nState, object oCreature, int bAllPartyMembers=TRUE, int bAllPlayers=FALSE, int bAllowOverrideHigher=FALSE)



// Add oPC to oPartyLeader's party. This will only work on two PCs.

// - oPC: player to add to a party

// - oPartyLeader: player already in the party

void AddToParty(object oPC, object oPartyLeader)



// Adjust the alignment of oSubject.

// - oSubject

// - nAlignment:

// -> ALIGNMENT_LAW/ALIGNMENT_CHAOS/ALIGNMENT_GOOD/ALIGNMENT_EVIL: oSubject's

// alignment will be shifted in the direction specified

// -> ALIGNMENT_ALL: nShift will be added to oSubject's law/chaos and

// good/evil alignment values

// -> ALIGNMENT_NEUTRAL: nShift is applied to oSubject's law/chaos and

// good/evil alignment values in the direction which is towards neutrality.

// e.g. If oSubject has a law/chaos value of 10 (i.e. chaotic) and a

// good/evil value of 80 (i.e. good) then if nShift is 15, the

// law/chaos value will become (10+15)=25 and the good/evil value will

// become (80-25)=55

// Furthermore, the shift will at most take the alignment value to 50 and

// not beyond.

// e.g. If oSubject has a law/chaos value of 40 and a good/evil value of 70,

// then if nShift is 15, the law/chaos value will become 50 and the

// good/evil value will become 55

// - nShift: this is the desired shift in alignment

// * No return value

void AdjustAlignment(object oSubject, int nAlignment, int nShift)



// Adjust how oSourceFactionMember's faction feels about oTarget by the

// specified amount.

// Note: This adjusts Faction Reputation, how the entire faction that

// oSourceFactionMember is in, feels about oTarget.

// * No return value

void AdjustReputation(object oTarget, object oSourceFactionMember, int nAdjustment)



// Change the ambient day track for oArea to nTrack.

// - oArea

// - nTrack

void AmbientSoundChangeDay(object oArea, int nTrack)



// Change the ambient night track for oArea to nTrack.

// - oArea

// - nTrack

void AmbientSoundChangeNight(object oArea, int nTrack)



// Play the ambient sound for oArea.

void AmbientSoundPlay(object oArea)



// Set the ambient day volume for oArea to nVolume.

// - oArea

// - nVolume: 0 - 100

void AmbientSoundSetDayVolume(object oArea, int nVolume)



// Set the ambient night volume for oArea to nVolume.

// - oArea

// - nVolume: 0 - 100

void AmbientSoundSetNightVolume(object oArea, int nVolume)



// Stop the ambient sound for oArea.

void AmbientSoundStop(object oArea)



struct sSpellSelect AnalyzeCombatSituation()



// Convert fAngle to a vector

vector AngleToVector(float fAngle)



// Apply eEffect at lLocation.

void ApplyEffectAtLocation(int nDurationType, effect eEffect, location lLocation, float fDuration=0.0f)



// Apply eEffect to oTarget.

void ApplyEffectToObject(int nDurationType, effect eEffect, object oTarget, float fDuration=0.0f)



// Maths operation: arcsine of fValue

// * Returns zero if fValue >1 or fValue < -1

float asin(float fValue)



// Assign aActionToAssign to oActionSubject.

// * No return value, but if an error occurs, the log file will contain

// "AssignCommand failed."

// (If the object doesn't exist, nothing happens.)

void AssignCommand(object oActionSubject,action aActionToAssign)



//Returns true if self is a henchmen

int AssociateCheck(object oCheck)



// Maths operation: arctan of fValue

float atan(float fValue)



int BashDoorCheck(object oIntruder = OBJECT_INVALID)



// Use this in an OnDialog script to start up the dialog tree.

// - sResRef: if this is not specified, the default dialog file will be used

// - oObjectToDialog: if this is not specified the person that triggered the

// event will be used

int BeginConversation(string sResRef="", object oObjectToDialog=OBJECT_INVALID)



// Remove oPlayer from the server.

void BootPC(object oPlayer)



// Make oObjectToChangeFaction join the faction of oMemberOfFactionToJoin.

// NB. ** This will only work for two NPCs **

void ChangeFaction(object oObjectToChangeFaction, object oMemberOfFactionToJoin)



// Make oCreatureToChange join one of the standard factions.

// ** This will only work on an NPC **

// - nStandardFaction: STANDARD_FACTION_*

void ChangeToStandardFaction(object oCreatureToChange, int nStandardFaction)



//Returns the number of enemies on a target.

int CheckEnemyGroupingOnTarget(object oTarget, float fDistance = 5.0)



//Returns the number of persons who are considered friendly to the the target.

int CheckFriendlyFireOnTarget(object oTarget, float fDistance = 5.0)



void CheckIsUnlocked(object oLastObject)



int CheckWayPoints(object oWalker = OBJECT_SELF)



// Clear all the actions of the caller. (This will only work on Creatures)

// * No return value, but if an error occurs, the log file will contain

// "ClearAllActions failed.".

void ClearAllActions()



// Clear all personal feelings that oSource has about oTarget.

void ClearPersonalReputation(object oTarget, object oSource=OBJECT_SELF)



//Compares the current spell with the last one cast

int CompareLastSpellCast(int nSpell)



// Maths operation: cosine of fValue

float cos(float fValue)



void CreateGenericDruidWeapon(object oTarget, object oAdventurer, int nModifier = 0)



void CreateGenericMonkWeapon(object oTarget, object oAdventurer, int nModifier = 0)



void CreateGenericWizardWeapon(object oTarget, object oAdventurer, int nModifier = 0)



// Create an item with the template sItemTemplate in oTarget's inventory.

// - nStackSize: This is the stack size of the item to be created

// * Return value: The object that has been created. On error, this returns

// OBJECT_INVALID.

object CreateItemOnObject(string sItemTemplate, object oTarget=OBJECT_SELF, int nStackSize=1)



// Create an object of the specified type at lLocation.

// - nObjectType: OBJECT_TYPE_ITEM, OBJECT_TYPE_CREATURE, OBJECT_TYPE_PLACEABLE,

// OBJECT_TYPE_STORE

// - sTemplate

// - lLocation

// - bUseAppearAnimation

object CreateObject(int nObjectType, string sTemplate, location lLocation, int bUseAppearAnimation=FALSE)



void CreateSignPostNPC(string sTag, location lLocal)



void CreateSpecificDruidWeapon(object oTarget, object oAdventurer, int nModifier = 0)



void CreateSpecificMonkWeapon(object oTarget, object oAdventurer, int nModifier = 0)



void CreateSpecificWizardWeapon(object oTarget, object oAdventurer, int nModifier = 0)



// Get the total from rolling (nNumDice x d10 dice).

// - nNumDice: If this is less than 1, the value 1 will be used.

int d10(int nNumDice=1)

// Get the total from rolling (nNumDice x d100 dice).

// - nNumDice: If this is less than 1, the value 1 will be used.

int d100(int nNumDice=1)

// Get the total from rolling (nNumDice x d12 dice).

// - nNumDice: If this is less than 1, the value 1 will be used.

int d12(int nNumDice=1)

// Get the total from rolling (nNumDice x d2 dice).

// - nNumDice: If this is less than 1, the value 1 will be used.

int d2(int nNumDice=1)

// Get the total from rolling (nNumDice x d20 dice).

// - nNumDice: If this is less than 1, the value 1 will be used.

int d20(int nNumDice=1)

// Get the total from rolling (nNumDice x d3 dice).

// - nNumDice: If this is less than 1, the value 1 will be used.

int d3(int nNumDice=1)

// Get the total from rolling (nNumDice x d4 dice).

// - nNumDice: If this is less than 1, the value 1 will be used.

int d4(int nNumDice=1)

// Get the total from rolling (nNumDice x d6 dice).

// - nNumDice: If this is less than 1, the value 1 will be used.

int d6(int nNumDice=1)

// Get the total from rolling (nNumDice x d8 dice).

// - nNumDice: If this is less than 1, the value 1 will be used.

int d8(int nNumDice=1)



// Delay aActionToDelay by fSeconds.

// * No return value, but if an error occurs, the log file will contain

// "DelayCommand failed.".

void DelayCommand(float fSeconds, action aActionToDelay)



// Delete oObject's local float variable sVarName

void DeleteLocalFloat(object oObject, string sVarName)



// Delete oObject's local integer variable sVarName

void DeleteLocalInt(object oObject, string sVarName)



// Delete oObject's local location variable sVarName

void DeleteLocalLocation(object oObject, string sVarName)



// Delete oObject's local object variable sVarName

void DeleteLocalObject(object oObject, string sVarName)



// Delete oObject's local string variable sVarName

void DeleteLocalString(object oObject, string sVarName)



// Destroy oObject (irrevocably).

// This will not work on modules and areas.

void DestroyObject(object oDestroy, float fDelay=0.0f)



int DetermineClassToUse()



//CORE AI FUNCTIONS

void DetermineCombatRound(object oIntruder = OBJECT_INVALID, int nAI_Difficulty = 10)



struct sEnemies DetermineEnemies()



void DetermineSpecialBehavior(object oIntruder = OBJECT_INVALID)



// Perform nDoorAction on oTargetDoor.

void DoDoorAction(object oTargetDoor, int nDoorAction)



// The caller performs nPlaceableAction on oPlaceable.

// - oPlaceable

// - nPlaceableAction: PLACEABLE_ACTION_*

void DoPlaceableObjectAction(object oPlaceable, int nPlaceableAction)



// Only if we are in a single player game, AutoSave the game.

void DoSinglePlayerAutoSave()



//Prints a log string with the ID of the passed in talent.

void DubugPrintTalentID(talent tTalent)



// Create an Ability Decrease effect.

// - nAbility: ABILITY_*

// - nModifyBy: This is the amount by which to decrement the ability

effect EffectAbilityDecrease(int nAbility, int nModifyBy)



// Create an Ability Increase effect

// - bAbilityToIncrease: ABILITY_*

effect EffectAbilityIncrease(int nAbilityToIncrease, int nModifyBy)



// - nValue

// - nModifyType: AC_*

// - nDamageType: DAMAGE_TYPE_*

// * Default value for nDamageType should only ever be used in this function prototype.

effect EffectACDecrease(int nValue, int nModifyType=AC_DODGE_BONUS, int nDamageType=AC_VS_DAMAGE_TYPE_ALL)



// - nValue: size of AC increase

// - nModifyType: AC_*_BONUS

// - nDamageType: DAMAGE_TYPE_*

// * Default value for nDamageType should only ever be used in this function prototype.

effect EffectACIncrease(int nValue, int nModifyType=AC_DODGE_BONUS, int nDamageType=AC_VS_DAMAGE_TYPE_ALL)



// Create an Appear effect to make the object "fly in".

effect EffectAppear()



// Create an Area Of Effect effect in the area of the creature it is applied to.

// If the scripts are not specified, default ones will be used.

effect EffectAreaOfEffect(int nAreaEffectId, string sOnEnterScript="", string sHeartbeatScript="", string sOnExitScript="")



// Create an Attack Decrease effect.

// - nPenalty

// - nModifierType: ATTACK_BONUS_*

effect EffectAttackDecrease(int nPenalty, int nModifierType=ATTACK_BONUS_MISC)



// Create an Attack Increase effect

// - nBonus: size of attack bonus

// - nModifierType: ATTACK_BONUS_*

effect EffectAttackIncrease(int nBonus, int nModifierType=ATTACK_BONUS_MISC)



// Create a Beam effect.

// - nBeamVisualEffect: VFX_BEAM_*

// - oEffector: the beam is emitted from this creature

// - nBodyPart: BODY_NODE_*

// - bMissEffect: If this is TRUE, the beam will fire to a random vector near or

// past the target

// * Returns an effect of type EFFECT_TYPE_INVALIDEFFECT if nBeamVisualEffect is

// not valid.

effect EffectBeam(int nBeamVisualEffect, object oEffector, int nBodyPart, int bMissEffect=FALSE)



// Create a Blindness effect.

effect EffectBlindness()



// Create a Charm effect

effect EffectCharmed()



// Create a Concealment effect.

// - nPercentage: 1-100 inclusive

// * Returns an effect of type EFFECT_TYPE_INVALIDEFFECT if nPercentage < 1 or

// nPercentage > 100.

effect EffectConcealment(int nPercentage)



// Create a Confuse effect

effect EffectConfused()



// Create a Curse effect.

// - nStrMod: strength modifier

// - nDexMod: dexterity modifier

// - nConMod: constitution modifier

// - nIntMod: intelligence modifier

// - nWisMod: wisdom modifier

// - nChaMod: charisma modifier

effect EffectCurse(int nStrMod=1, int nDexMod=1, int nConMod=1, int nIntMod=1, int nWisMod=1, int nChaMod=1)



// Create a Damage effect

// - nDamageAmount: amount of damage to be dealt. This should be applied as an

// instantaneous effect.

// - nDamageType: DAMAGE_TYPE_*

// - nDamagePower: DAMAGE_POWER_*

effect EffectDamage(int nDamageAmount, int nDamageType=DAMAGE_TYPE_MAGICAL, int nDamagePower=DAMAGE_POWER_NORMAL)



// Create a Damage Decrease effect.

// - nPenalty

// - nDamageType: DAMAGE_TYPE_*

effect EffectDamageDecrease(int nPenalty, int nDamageType=DAMAGE_TYPE_MAGICAL)



// Create a Damage Immunity Decrease effect.

// - nDamageType: DAMAGE_TYPE_*

// - nPercentImmunity

effect EffectDamageImmunityDecrease(int nDamageType, int nPercentImmunity)



// Creates a Damage Immunity Increase effect.

// - nDamageType: DAMAGE_TYPE_*

// - nPercentImmunity

effect EffectDamageImmunityIncrease(int nDamageType, int nPercentImmunity)



// Create a Damage Increase effect

// - nBonus: DAMAGE_BONUS_*

// - nDamageType: DAMAGE_TYPE_*

effect EffectDamageIncrease(int nBonus, int nDamageType=DAMAGE_TYPE_MAGICAL)



// Create a Damage Reduction effect

// - nAmount: amount of damage reduction

// - nDamagePower: DAMAGE_POWER_*

// - nLimit: How much damage the effect can absorb before disappearing.

// Set to zero for infinite

effect EffectDamageReduction(int nAmount, int nDamagePower, int nLimit=0)



// Create a Damage Resistance effect that removes the first nAmount points of

// damage of type nDamageType, up to nLimit (or infinite if nLimit is 0)

// - nDamageType: DAMAGE_TYPE_*

// - nAmount

// - nLimit

effect EffectDamageResistance(int nDamageType, int nAmount, int nLimit=0)



// Create a Damage Shield effect which does (nDamageAmount + nRandomAmount)

// damage to any melee attacker on a successful attack of damage type nDamageType.

// - nDamageAmount: an integer value

// - nRandomAmount: DAMAGE_BONUS_*

// - nDamageType: DAMAGE_TYPE_*

effect EffectDamageShield(int nDamageAmount, int nRandomAmount, int nDamageType)



// Create a Darkness effect.

effect EffectDarkness()



// Create a Daze effect

effect EffectDazed()



// Create a Deaf effect

effect EffectDeaf()



// Create a Death effect

// - nSpectacularDeath: if this is TRUE, the creature to which this effect is

// applied will die in an extraordinary fashion

// - nDisplayFeedback

effect EffectDeath(int nSpectacularDeath=FALSE, int nDisplayFeedback=TRUE)



// Create a Disappear effect to make the object "fly away" and then destroy

// itself.

effect EffectDisappear()



// Create a Disappear/Appear effect.

// The object will "fly away" for the duration of the effect and will reappear

// at lLocation.

effect EffectDisappearAppear(location lLocation)



// Create a Disease effect.

// - nDiseaseType: DISEASE_*

effect EffectDisease(int nDiseaseType)



// Create a Dispel Magic All effect.

effect EffectDispelMagicAll(int nCasterLevel)



// Create a Dispel Magic Best effect.

effect EffectDispelMagicBest(int nCasterLevel)



// Create a Dominate effect

effect EffectDominated()



// Create an Entangle effect

// When applied, this effect will restrict the creature's movement and apply a

// (-2) to all attacks and a -4 to AC.

effect EffectEntangle()



// Create a Frighten effect

effect EffectFrightened()



// Create a Haste effect.

effect EffectHaste()



// Create a Heal effect. This should be applied as an instantaneous effect.

// * Returns an effect of type EFFECT_TYPE_INVALIDEFFECT if nDamageToHeal < 0.

effect EffectHeal(int nDamageToHeal)



// Create a Hit Point Change When Dying effect.

// - fHitPointChangePerRound: this can be positive or negative, but not zero.

// * Returns an effect of type EFFECT_TYPE_INVALIDEFFECT if fHitPointChangePerRound is 0.

effect EffectHitPointChangeWhenDying(float fHitPointChangePerRound)



// Create an Immunity effect.

// - nImmunityType: IMMUNITY_TYPE_*

effect EffectImmunity(int nImmunityType)



// Create an Invisibility effect.

// - nInvisibilityType: INVISIBILITY_TYPE_*

// * Returns an effect of type EFFECT_TYPE_INVALIDEFFECT if nInvisibilityType

// is invalid.

effect EffectInvisibility(int nInvisibilityType)



// Create a Knockdown effect

// This effect knocks creatures off their feet, they will sit until the effect

// is removed. This should be applied as a temporary effect with a 3 second

// duration minimum (1 second to fall, 1 second sitting, 1 second to get up).

effect EffectKnockdown()



// Link the two supplied effects, returning eChildEffect as a child of

// eParentEffect.

// Note: When applying linked effects if the target is immune to all valid

// effects all other effects will be removed as well. This means that if you

// apply a visual effect and a silence effect (in a link) and the target is

// immune to the silence effect that the visual effect will get removed as well.

// Visual Effects are not considered "valid" effects for the purposes of

// determining if an effect will be removed or not and as such should never be

// packaged *only* with other visual effects in a link.

effect EffectLinkEffects(effect eChildEffect, effect eParentEffect )



// Create a Miss Chance effect.

// - nPercentage: 1-100 inclusive

// * Returns an effect of type EFFECT_TYPE_INVALIDEFFECT if nPercentage < 1 or

// nPercentage > 100.

effect EffectMissChance(int nPercentage)



// Create a Modify Attacks effect to add attacks.

// - nAttacks: maximum is 5, even with the effect stacked

// * Returns an effect of type EFFECT_TYPE_INVALIDEFFECT if nAttacks > 5.

effect EffectModifyAttacks(int nAttacks)



// Create a Movement Speed Decrease effect.

// - nPercentChange

effect EffectMovementSpeedDecrease(int nPercentChange)



// Create a Movement Speed Increase effect.

// - nPercentChange: percentage change in movement speed

effect EffectMovementSpeedIncrease(int nPercentChange)



// Create a Negative Level effect.

// - nNumLevels: the number of negative levels to apply.

// * Returns an effect of type EFFECT_TYPE_INVALIDEFFECT if nNumLevels > 100.

effect EffectNegativeLevel(int nNumLevels)



// Create a Paralyze effect

effect EffectParalyze()



// Create a Poison effect.

// - nPoisonType: POISON_*

effect EffectPoison(int nPoisonType)



// Create a Polymorph effect.

effect EffectPolymorph(int nPolymorphSelection)



// Create a Regenerate effect.

// - nAmount: amount of damage to be regenerated per time interval

// - fIntervalSeconds: length of interval in seconds

effect EffectRegenerate(int nAmount, float fIntervalSeconds)



// Create a Resurrection effect. This should be applied as an instantaneous effect.

effect EffectResurrection()



// Create a Sanctuary effect.

// - nDifficultyClass: must be a non-zero, positive number

// * Returns an effect of type EFFECT_TYPE_INVALIDEFFECT if nDifficultyClass <= 0.

effect EffectSanctuary(int nDifficultyClass)



// Create a Saving Throw Decrease effect.

// - nSave

// - nValue

// - nSaveType: SAVING_THROW_TYPE_*

effect EffectSavingThrowDecrease(int nSave, int nValue, int nSaveType=SAVING_THROW_TYPE_ALL)



// Create an AC Decrease effect

// - nSave: SAVING_THROW_* (not SAVING_THROW_TYPE_*)

// - nValue: size of AC decrease

// - nSaveType: SAVING_THROW_TYPE_*

effect EffectSavingThrowIncrease(int nSave, int nValue, int nSaveType=SAVING_THROW_TYPE_ALL)



// Create a See Invisible effect.

effect EffectSeeInvisible()



// Create a Silence effect.

effect EffectSilence()

// Create a Skill Decrease effect.

// * Returns an effect of type EFFECT_TYPE_INVALIDEFFECT if nSkill is invalid.

effect EffectSkillDecrease(int nSkill, int nValue)



// Create a Skill Increase effect.

// - nSkill: SKILL_*

// - nValue

// * Returns an effect of type EFFECT_TYPE_INVALIDEFFECT if nSkill is invalid.

effect EffectSkillIncrease(int nSkill, int nValue)



// Create a Sleep effect

effect EffectSleep()



// Create a Slow effect.

effect EffectSlow()



// Create a Spell Immunity effect.

// There is a known bug with this function. There *must* be a parameter specified

// when this is called (even if the desired parameter is SPELL_ALL_SPELLS),

// otherwise an effect of type EFFECT_TYPE_INVALIDEFFECT will be returned.

// - nImmunityToSpell: SPELL_*

// * Returns an effect of type EFFECT_TYPE_INVALIDEFFECT if nImmunityToSpell is

// invalid.

effect EffectSpellImmunity(int nImmunityToSpell=SPELL_ALL_SPELLS)



// Create a Spell Level Absorption effect.

// - nMaxSpellLevelAbsorbed: maximum spell level that will be absorbed by the

// effect

// - nTotalSpellLevelsAbsorbed: maximum number of spell levels that will be

// absorbed by the effect

// - nSpellSchool: SPELL_SCHOOL_*

// * Returns an effect of type EFFECT_TYPE_INVALIDEFFECT if:

// nMaxSpellLevelAbsorbed is not between -1 and 9 inclusive, or nSpellSchool

// is invalid.

effect EffectSpellLevelAbsorption(int nMaxSpellLevelAbsorbed, int nTotalSpellLevelsAbsorbed=0, int nSpellSchool=SPELL_SCHOOL_GENERAL )



// Create a Spell Resistance Decrease effect.

effect EffectSpellResistanceDecrease(int nValue)



// Create a Spell Resistance Increase effect.

// - nValue: size of spell resistance increase

effect EffectSpellResistanceIncrease(int nValue)



// Create a Stun effect

effect EffectStunned()

// - sCreatureResref: Identifies the creature to be summoned

// - nVisualEffectId: VFX_*

// - fDelaySeconds: There can be delay between the visual effect being played, and the

// creature being added to the area

effect EffectSummonCreature(string sCreatureResref, int nVisualEffectId=VFX_NONE, float fDelaySeconds=0.0f)



// Create a Swarm effect.

// - nLooping: If this is TRUE, for the duration of the effect when one creature

// created by this effect dies, the next one in the list will be created. If

// the last creature in the list dies, we loop back to the beginning and

// sCreatureTemplate1 will be created, and so on...

// - sCreatureTemplate1

// - sCreatureTemplate2

// - sCreatureTemplate3

// - sCreatureTemplate4

effect EffectSwarm(int nLooping, string sCreatureTemplate1, string sCreatureTemplate2="", string sCreatureTemplate3="", string sCreatureTemplate4="")



// Create a Temporary Hitpoints effect.

// - nHitPoints: a positive integer

// * Returns an effect of type EFFECT_TYPE_INVALIDEFFECT if nHitPoints < 0.

effect EffectTemporaryHitpoints(int nHitPoints)



// Create a Time Stop effect.

effect EffectTimeStop()



// Create a True Seeing effect.

effect EffectTrueSeeing()



// Create a Turned effect.

effect EffectTurned()



// Create a Turn Resistance Decrease effect.

// - nHitDice: a positive number representing the number of hit dice for the

/// decrease

effect EffectTurnResistanceDecrease(int nHitDice)



// Create a Turn Resistance Increase effect.

// - nHitDice: a positive number representing the number of hit dice for the

// increase

effect EffectTurnResistanceIncrease(int nHitDice)



// Create an Ultravision effect.

effect EffectUltravision()



// * Create a Visual Effect that can be applied to an object.

// - nVisualEffectId

// - nMissEffect: if this is TRUE, a random vector near or past the target will

// be generated, on which to play the effect

effect EffectVisualEffect(int nVisualEffectId, int nMissEffect=FALSE)



// End the currently running game, play sEndMovie then return all players to the

// game's main menu.

void EndGame(string sEndMovie)



//Equip the weapon appropriate to enemy and position

void EquipAppropriateWeapons(object oTarget)



// Activate oItem.

event EventActivateItem(object oItem, location lTarget, object oTarget=OBJECT_INVALID)



// Conversation event.

event EventConversation()



// Create an event which triggers the "SpellCastAt" script

event EventSpellCastAt(object oCaster, int nSpell, int bHarmful=TRUE)



// Create an event of the type nUserDefinedEventNumber

event EventUserDefined(int nUserDefinedEventNumber)



// Make oTarget run sScript and then return execution to the calling script.

// If sScript does not specify a compiled script, nothing happens.

void ExecuteScript(string sScript, object oTarget)



// Expose the entire map of oArea to oPlayer.

void ExploreAreaForPlayer(object oArea, object oPlayer)



// Force all the characters of the players who are currently in the game to

// be exported to their respective directories i.e. LocalVault/ServerVault/ etc.

void ExportAllCharacters()



// Set the subtype of eEffect to Extraordinary and return eEffect.

// (Effects default to magical if the subtype is not set)

effect ExtraordinaryEffect(effect eEffect)



// Maths operation: absolute value of fValue

float fabs(float fValue)



// Convert fFeet into a number of meters.

float FeetToMeters(float fFeet)



//Find a single target who is an enemy with 30m of self

object FindSingleRangedTarget()



// Find the position of sSubstring inside sString

int FindSubString(string sString, string sSubString)



// Display floaty text above the specified creature.

// The text will also appear in the chat buffer of each player that receives the

// floaty text.

// - sStringToDisplay: String

// - oCreatureToFloatAbove

// - bBroadcastToFaction: If this is TRUE then only creatures in the same faction

// as oCreatureToFloatAbove

// will see the floaty text, and only if they are within range (30 metres).

void FloatingTextStringOnCreature(string sStringToDisplay, object oCreatureToFloatAbove, int bBroadcastToFaction=TRUE)



// Display floaty text above the specified creature.

// The text will also appear in the chat buffer of each player that receives the

// floaty text.

// - nStrRefToDisplay: String ref (therefore text is translated)

// - oCreatureToFloatAbove

// - bBroadcastToFaction: If this is TRUE then only creatures in the same faction

// as oCreatureToFloatAbove

// will see the floaty text, and only if they are within range (30 metres).

void FloatingTextStrRefOnCreature(int nStrRefToDisplay, object oCreatureToFloatAbove, int bBroadcastToFaction=TRUE)



// Convert fFloat into the nearest integer.

int FloatToInt(float fFloat)



// Convert fFloat into a string.

// - nWidth should be a value from 0 to 18 inclusive.

// - nDecimals should be a value from 0 to 9 inclusive.

string FloatToString(float fFloat, int nWidth=18, int nDecimals=9)



// Do a Fortitude Save check for the given DC

// - oCreature

// - nDC: Difficulty check

// - nSaveType: SAVING_THROW_TYPE_*

// - oSaveVersus

// Returns: 0 if the saving throw roll failed

// Returns: 1 if the saving throw roll succeeded

// Returns: 2 if the target was immune to the save type specified

int FortitudeSave(object oCreature, int nDC, int nSaveType=SAVING_THROW_TYPE_NONE, object oSaveVersus=OBJECT_SELF)

// Returns the ability modifier for the specified ability

// Get oCreature's ability modifier for nAbility.

// - nAbility: ABILITY_*

// - oCreature

int GetAbilityModifier(int nAbility, object oCreature=OBJECT_SELF)



// Get the ability score of type nAbility for a creature (otherwise 0)

// - oCreature: the creature whose ability score we wish to find out

// - nAbilityType: ABILITY_*

// Return value on error: 0

int GetAbilityScore(object oCreature, int nAbilityType)



// If oObject is a creature, this will return that creature's armour class

// If oObject is an item, door or placeable, this will return zero.

// - nForFutureUse: this parameter is not currently used

// * Return value if oObject is not a creature, item, door or placeable: -1

int GetAC(object oObject, int nForFutureUse=0)



// Get oCreature's age.

// * Returns 0 if oCreature is invalid.

int GetAge(object oCreature)



// Return an ALIGNMENT_* constant to represent oCreature's good/evil alignment

// * Return value if oCreature is not a valid creature: -1

int GetAlignmentGoodEvil(object oCreature)



// Return an ALIGNMENT_* constant to represent oCreature's law/chaos alignment

// * Return value if oCreature is not a valid creature: -1

int GetAlignmentLawChaos(object oCreature)



int GetAlliedHD()



// Get oCreature's animal companion creature type

// (ANIMAL_COMPANION_CREATURE_TYPE_*).

// * Returns ANIMAL_COMPANION_CREATURE_TYPE_NONE if oCreature is invalid or does

// not currently have an animal companion.

int GetAnimalCompanionCreatureType(object oCreature)



// Get oCreature's animal companion's name.

// * Returns "" if oCreature is invalid, does not currently

// have an animal companion or if the animal companion's name is blank.

string GetAnimalCompanionName(object oTarget)



// Get the area that oTarget is currently in

// * Return value on error: OBJECT_INVALID

object GetArea(object oTarget)

// Get the area's object ID from lLocation.

object GetAreaFromLocation(location lLocation)



// This returns the creator of oAreaOfEffectObject.

// * Returns OBJECT_INVALID if oAreaOfEffectObject is not a valid Area of Effect object.

object GetAreaOfEffectCreator(object oAreaOfEffectObject=OBJECT_SELF)



// Get the associate of type nAssociateType belonging to oMaster.

// - nAssociateType: ASSOCIATE_TYPE_*

// - nMaster

// * Returns OBJECT_INVALID if no such associate exists.

object GetAssociate(int nAssociateType, object oMaster=OBJECT_SELF)



//ASSOCIATE FUNCTIONS

int GetAssociateCRMax()



int GetAssociateHealMaster()



location GetAssociateStartLocation()



int GetAssociateState(int nCondition)



int GetAttackCompatibility(talent tUse, int nClass)



// Get the attack target of oCreature.

// This only works when oCreature is in combat.

object GetAttackTarget(object oCreature=OBJECT_SELF)



// Get the target that the caller attempted to attack - this should be used in

// conjunction with GetAttackTarget(). This value is set every time an attack is

// made, and is reset at the end of combat.

// * Returns OBJECT_INVALID if the caller is not a valid creature.

object GetAttemptedAttackTarget()



// Get the target at which the caller attempted to cast a spell.

// This value is set every time a spell is cast and is reset at the end of

// combat.

// * Returns OBJECT_INVALID if the caller is not a valid creature.

object GetAttemptedSpellTarget()



// Get the base item type (BASE_ITEM_*) of oItem.

// * Returns BASE_ITEM_INVALID if oItem is an invalid item.

int GetBaseItemType(object oItem)



int GetBehaviorState(int nCondition)



// Get the last blocking door encountered by the caller of this function.

// * Returns OBJECT_INVALID if the caller is not a valid creature.

object GetBlockingDoor()



// Get the current calendar day.

int GetCalendarDay()



// Get the current calendar month.

int GetCalendarMonth()



// Get the current calendar year.

int GetCalendarYear()



// Get the Caster Level of oCreature.

// * Return value on error: 0;

int GetCasterLevel(object oCreature)



// Get oCreature's challenge rating.

// * Returns 0.0 if oCreature is invalid.

float GetChallengeRating(object oCreature)



//Adds all three of the class levels together. Used before GetHitDice became available

int GetCharacterLevel(object oTarget)



// A creature can have up to three classes. This function determines the

// creature's class (CLASS_TYPE_*) based on nClassPosition.

// - nClassPosition: 1, 2 or 3

// - oCreature

// * Returns CLASS_TYPE_INVALID if the oCreature does not have a class in

// nClassPosition (i.e. a single-class creature will only have a value in

// nClassLocation=1) or if oCreature is not a valid creature.

int GetClassByPosition(int nClassPosition, object oCreature=OBJECT_SELF)



// Use this in a trigger's OnClick event script to get the object that last

// clicked on it.

// This is identical to GetEnteringObject.

object GetClickingObject()



// Determine whether oTarget's action stack can be modified.

int GetCommandable(object oTarget=OBJECT_SELF)



// Determine whether oCreature has tTalent.

int GetCreatureHasTalent(talent tTalent, object oCreature=OBJECT_SELF)



// Get the size (CREATURE_SIZE_*) of oCreature.

int GetCreatureSize(object oCreature)



// Get the best talent (i.e. closest to nCRMax without going over) of oCreature,

// within nCategory.

// - nCategory: TALENT_CATEGORY_*

// - nCRMax: Challenge Rating of the talent

// - oCreature

talent GetCreatureTalentBest(int nCategory, int nCRMax, object oCreature=OBJECT_SELF)



// Get a random talent of oCreature, within nCategory.

// - nCategory: TALENT_CATEGORY_*

// - oCreature

talent GetCreatureTalentRandom(int nCategory, object oCreature=OBJECT_SELF)



// Get the current action (ACTION_*) that oObject is executing.

int GetCurrentAction(object oObject=OBJECT_SELF)



// Get the current hitpoints of oObject

// * Return value on error: 0

int GetCurrentHitPoints(object oObject=OBJECT_SELF)



// Get the amount of damage of type nDamageType that has been dealt to the caller.

// - nDamageType: DAMAGE_TYPE_*

int GetDamageDealtByType(int nDamageType)



// Get the name of oCreature's deity.

// * Returns "" if oCreature is invalid (or if the deity name is blank for

// oCreature).

string GetDeity(object oCreature)



// Get the distance in metres between oObjectA and oObjectB.

// * Return value if either object is invalid: 0.0f

float GetDistanceBetween(object oObjectA, object oObjectB)



// Get the distance between lLocationA and lLocationB.

float GetDistanceBetweenLocations(location lLocationA, location lLocationB)



// Get the distance from the caller to oObject in metres.

// * Return value on error: -1.0f

float GetDistanceToObject(object oObject)



// Get the object that created eEffect.

// * Returns OBJECT_INVALID if eEffect is not a valid effect.

object GetEffectCreator(effect eEffect)



// Get the duration type (DURATION_TYPE_*) of eEffect.

// * Return value if eEffect is not valid: -1

int GetEffectDurationType(effect eEffect)



// Get the spell (SPELL_*) that applied eSpellEffect.

// * Returns -1 if eSpellEffect was applied outside a spell script.

int GetEffectSpellId(effect eSpellEffect)



// Get the subtype (SUBTYPE_*) of eEffect.

// * Return value on error: 0

int GetEffectSubType(effect eEffect)



// Get the effect type (EFFECT_TYPE_*) of eEffect.

// * Return value if eEffect is invalid: EFFECT_INVALIDEFFECT

int GetEffectType(effect eEffect)



// Determine whether oEncounter is active.

int GetEncounterActive(object oEncounter=OBJECT_SELF)



// Get the difficulty level of oEncounter.

int GetEncounterDifficulty(object oEncounter=OBJECT_SELF)



// Get the number of times that oEncounter has spawned so far

int GetEncounterSpawnsCurrent(object oEncounter=OBJECT_SELF)



// Get the maximum number of times that oEncounter will spawn.

int GetEncounterSpawnsMax(object oEncounter=OBJECT_SELF)



int GetEnemyHD()



// The value returned by this function depends on the object type of the caller:

// 1) If the caller is a door or placeable it returns the object that last

// triggered it.

// 2) If the caller is a trigger, area of effect, module, area or encounter it

// returns the object that last entered it.

// * Return value on error: OBJECT_INVALID

object GetEnteringObject()



// Get the object that last left the caller. This function works on triggers,

// areas of effect, modules, areas and encounters.

// * Return value on error: OBJECT_INVALID

object GetExitingObject()



// Get the direction in which oTarget is facing, expressed as a float between

// 0.0f and 360.0f

// * Return value on error: -1.0f

float GetFacing(object oTarget)



// Get the orientation value from lLocation.

float GetFacingFromLocation(location lLocation)



// Get an integer between 0 and 100 (inclusive) that represents the average

// good/evil alignment of oFactionMember's faction.

// * Return value on error: -1

int GetFactionAverageGoodEvilAlignment(object oFactionMember)



// Get an integer between 0 and 100 (inclusive) that represents the average

// law/chaos alignment of oFactionMember's faction.

// * Return value on error: -1

int GetFactionAverageLawChaosAlignment(object oFactionMember)



// Get the average level of the members of the faction.

// * Return value on error: -1

int GetFactionAverageLevel(object oFactionMember)



// Get an integer between 0 and 100 (inclusive) that represents how

// oSourceFactionMember's faction feels about oTarget.

// * Return value on error: -1

int GetFactionAverageReputation(object oSourceFactionMember, object oTarget)



// Get the average XP of the members of the faction.

// * Return value on error: -1

int GetFactionAverageXP(object oFactionMember)



// Get the object faction member with the highest armour class.

// * Returns OBJECT_INVALID if oFactionMember's faction is invalid.

object GetFactionBestAC(object oFactionMember=OBJECT_SELF, int bMustBeVisible=TRUE)



// * Returns TRUE if the Faction Ids of the two objects are the same

int GetFactionEqual(object oFirstObject, object oSecondObject=OBJECT_SELF)



// Get the amount of gold held by oFactionMember's faction.

// * Returns -1 if oFactionMember's faction is invalid.

int GetFactionGold(object oFactionMember)



// Get the leader of the faction of which oMemberOfFaction is a member.

// * Returns OBJECT_INVALID if oMemberOfFaction is not a valid creature.

object GetFactionLeader(object oMemberOfFaction)



// Get the member of oFactionMember's faction that has taken the fewest hit

// points of damage.

// * Returns OBJECT_INVALID if oFactionMember's faction is invalid.

object GetFactionLeastDamagedMember(object oFactionMember=OBJECT_SELF, int bMustBeVisible=TRUE)

// Get the member of oFactionMember's faction that has taken the most hit points

// of damage.

// * Returns OBJECT_INVALID if oFactionMember's faction is invalid.

object GetFactionMostDamagedMember(object oFactionMember=OBJECT_SELF, int bMustBeVisible=TRUE)



// Get the most frequent class in the faction - this can be compared with the

// constants CLASS_TYPE_*.

// * Return value on error: -1

int GetFactionMostFrequentClass(object oFactionMember)



// Get the strongest member of oFactionMember's faction.

// * Returns OBJECT_INVALID if oFactionMember's faction is invalid.

object GetFactionStrongestMember(object oFactionMember=OBJECT_SELF, int bMustBeVisible=TRUE)



// Get the weakest member of oFactionMember's faction.

// * Returns OBJECT_INVALID if oFactionMember's faction is invalid.

object GetFactionWeakestMember(object oFactionMember=OBJECT_SELF, int bMustBeVisible=TRUE)



// Get the object faction member with the lowest armour class.

// * Returns OBJECT_INVALID if oFactionMember's faction is invalid.

object GetFactionWorstAC(object oFactionMember=OBJECT_SELF, int bMustBeVisible=TRUE)



// Get oCreature's familiar creature type (FAMILIAR_CREATURE_TYPE_*).

// * Returns FAMILIAR_CREATURE_TYPE_NONE if oCreature is invalid or does not

// currently have a familiar.

int GetFamiliarCreatureType(object oCreature)



// Get oCreature's familiar's name.

// * Returns "" if oCreature is invalid, does not currently

// have a familiar or if the familiar's name is blank.

string GetFamiliarName(object oCreature)



// Get the first in-game effect on oCreature.

effect GetFirstEffect(object oCreature)



// Get the first member of oMemberOfFaction's faction (start to cycle through

// oMemberOfFaction's faction).

// * Returns OBJECT_INVALID if oMemberOfFaction's faction is invalid.

object GetFirstFactionMember(object oMemberOfFaction, int bPCOnly=TRUE)



// Get the first object within oPersistentObject.

// - oPersistentObject

// - nResidentObjectType: OBJECT_TYPE_*

// - nPersistentZone: PERSISTENT_ZONE_ACTIVE. [This could also take the value

// PERSISTENT_ZONE_FOLLOW, but this is no longer used.]

// * Returns OBJECT_INVALID if no object is found.

object GetFirstInPersistentObject(object oPersistentObject=OBJECT_SELF, int nResidentObjectType=OBJECT_TYPE_CREATURE, int nPersistentZone=PERSISTENT_ZONE_ACTIVE)



// Get the first item in oTarget's inventory (start to cycle through oTarget's

// inventory).

// * Returns OBJECT_INVALID if the caller is not a creature, item, placeable or store,

// or if no item is found.

object GetFirstItemInInventory(object oTarget=OBJECT_SELF)



// Get the first object in oArea.

// If no valid area is specified, it will use the caller's area.

// * Return value on error: OBJECT_INVALID

object GetFirstObjectInArea(object oArea=OBJECT_INVALID)



// Get the first object in nShape

// - nShape: SHAPE_*

// - fSize:

// -> If nShape == SHAPE_SPHERE, this is the radius of the sphere

// -> If nShape == SHAPE_SPELLCYLINDER, this is the radius of the cylinder

// -> If nShape == SHAPE_CONE, this is the widest radius of the cone

// -> If nShape == SHAPE_CUBE, this is half the length of one of the sides of

// the cube

// - lTarget: This is the centre of the effect, usually GetSpellTargetPosition(),

// or the end of a cylinder or cone.

// - bLineOfSight: This controls whether to do a line-of-sight check on the

// object returned.

// (This can be used to ensure that spell effects do not go through walls.)

// - nObjectFilter: This allows you to filter out undesired object types, using

// bitwise "or".

// For example, to return only creatures and doors, the value for this

// parameter would be OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR

// - vOrigin: This is only used for cylinders and cones, and specifies the

// origin of the effect(normally the spell-caster's position).

// Return value on error: OBJECT_INVALID

object GetFirstObjectInShape(int nShape, float fSize, location lTarget, int bLineOfSight=FALSE, int nObjectFilter=OBJECT_TYPE_CREATURE, vector vOrigin=[0.0,0.0,0.0])



// Get the first PC in the player list.

// This resets the position in the player list for GetNextPC().

object GetFirstPC()



int GetFleeToExit()



float GetFollowDistance()



// Get oTarget's base fortitude saving throw value (this will only work for

// creatures, doors, and placeables).

// * Returns 0 if oTarget is invalid.

int GetFortitudeSavingThrow(object oTarget)



// Get the game difficulty (GAME_DIFFICULTY_*).

int GetGameDifficulty()



// Get the gender of oCreature.

int GetGender(object oCreature)



// Get the creature that is going to attack oTarget.

// Note: This value is cleared out at the end of every combat round and should

// not be used in any case except when getting a "going to be attacked" shout

// from the master creature (and this creature is a henchman)

// * Returns OBJECT_INVALID if oTarget is not a valid creature.

object GetGoingToBeAttackedBy(object oTarget)



// Get the amount of gold possessed by oTarget.

int GetGold(object oTarget=OBJECT_SELF)



// Get the gold piece value of oItem.

// * Returns 0 if oItem is not a valid item.

int GetGoldPieceValue(object oItem)



// Get an integer between 0 and 100 (inclusive) to represent oCreature's

// Good/Evil alignment

// (100=good, 0=evil)

// * Return value if oCreature is not a valid creature: -1

int GetGoodEvilValue(object oCreature)



//Checks the target for a specific EFFECT_TYPE constant value

int GetHasEffect(int nEffectType, object oTarget = OBJECT_SELF)



// Determine whether oCreature has nFeat, and nFeat is useable.

// - nFeat: FEAT_*

// - oCreature

int GetHasFeat(int nFeat, object oCreature=OBJECT_SELF)



// - nFeat: FEAT_*

// - oObject

// * Returns TRUE if oObject has effects on it originating from nFeat.

int GetHasFeatEffect(int nFeat, object oObject=OBJECT_SELF)



// Determine whether oObject has an inventory.

// * Returns TRUE for creatures and stores, and checks to see if an item or placeable object is a container.

// * Returns FALSE for all other object types.

int GetHasInventory(object oObject)



// Determine whether oCreature has nSkill, and nSkill is useable.

// - nSkill: SKILL_*

// - oCreature

int GetHasSkill(int nSkill, object oCreature=OBJECT_SELF)



// Determine whether oCreature has nSpell memorised.

// - nSpell: SPELL_*

// - oCreature

int GetHasSpell(int nSpell, object oCreature=OBJECT_SELF)



// Determine if oObject has effects originating from nSpell.

// - nSpell: SPELL_*

// - oObject

int GetHasSpellEffect(int nSpell, object oObject=OBJECT_SELF)



// Get the henchman belonging to oMaster.

// * Return OBJECT_INVALID if oMaster does not have a henchman.

object GetHenchman(object oMaster=OBJECT_SELF)



// Get the number of hitdice for oCreature.

// * Return value if oCreature is not a valid creature: 0

int GetHitDice(object oCreature)



// Determined whether oItem has been identified.

int GetIdentified(object oItem)



// Get the ID of tTalent. This could be a SPELL_*, FEAT_* or SKILL_*.

int GetIdFromTalent(talent tTalent)



// get the item that caused the caller's OnInventoryDisturbed script to fire.

// * Returns OBJECT_INVALID if the caller is not a valid object.

object GetInventoryDisturbItem()



// Get the type of disturbance (INVENTORY_DISTURB_*) that caused the caller's

// OnInventoryDisturbed script to fire. This will only work for creatures and

// placeables.

int GetInventoryDisturbType()



// * Returns TRUE if it is currently dawn.

int GetIsDawn()



// * Returns TRUE if it is currently day.

int GetIsDay()



// * Returns TRUE if oCreature is a dead NPC, dead PC or a dying PC.

int GetIsDead(object oCreature)



// * Returns TRUE if oCreature is controlled by the Dungeon Master.

int GetIsDM(object oCreature)



// - oTargetDoor

// - nDoorAction: DOOR_ACTION_*

// * Returns TRUE if nDoorAction can be performed on oTargetDoor.

int GetIsDoorActionPossible(object oTargetDoor, int nDoorAction)



// * Returns TRUE if it is currently dusk.

int GetIsDusk()



// * Returns TRUE if eEffect is a valid effect.

int GetIsEffectValid(effect eEffect)



// * Returns TRUE if oCreature was spawned from an encounter.

int GetIsEncounterCreature(object oCreature=OBJECT_SELF)



// * Returns TRUE if oSource considers oTarget as an enemy.

int GetIsEnemy(object oTarget, object oSource=OBJECT_SELF)



//Does a check to determine if the NPC has an attempted spell or attack target

int GetIsFighting(object oFighting)



// * Returns TRUE if oSource considers oTarget as a friend.

int GetIsFriend(object oTarget, object oSource=OBJECT_SELF)



// - oCreature

// - nImmunityType: IMMUNITY_TYPE_*

// - oVersus: if this is specified, then we also check for the race and

// alignment of oVersus

// * Returns TRUE if oCreature has immunity of type nImmunity versus oVersus.

int GetIsImmune(object oCreature, int nImmunityType, object oVersus=OBJECT_INVALID)



// * Returns TRUE if oCreature is in combat.

int GetIsInCombat(object oCreature=OBJECT_SELF)



// * Returns TRUE if oObject is listening for something

int GetIsListening(object oObject)



// * Returns TRUE if oSource considers oTarget as neutral.

int GetIsNeutral(object oTarget, object oSource=OBJECT_SELF)



// * Returns TRUE if it is currently night.

int GetIsNight()



// * Returns TRUE if oObject is a valid object.

int GetIsObjectValid(object oObject)



// * Returns TRUE if oObject (which is a placeable or a door) is currently open.

int GetIsOpen(object oObject)



// * Returns TRUE if oCreature is a Player Controlled character.

int GetIsPC(object oCreature)



// - oPlaceable

// - nPlaceableAction: PLACEABLE_ACTION_*

// * Returns TRUE if nPlacebleAction is valid for oPlaceable.

int GetIsPlaceableObjectActionPossible(object oPlaceable, int nPlaceableAction)



// * Returns TRUE if oCreature is of a playable racial type.

int GetIsPlayableRacialType(object oCreature)



//Returns true if the object has any posts or waypoints to walk

int GetIsPostOrWalking(object oWalker = OBJECT_SELF)



// Determine whether oSource has a friendly reaction towards oTarget, depending

// on the reputation, PVP setting and (if both oSource and oTarget are PCs),

// oSource's Like/Dislike setting for oTarget.

// Note: If you just want to know how two objects feel about each other in terms

// of faction and personal reputation, use GetIsFriend() instead.

// * Returns TRUE if oSource has a friendly reaction towards oTarget

int GetIsReactionTypeFriendly(object oTarget, object oSource=OBJECT_SELF)



// Determine whether oSource has a Hostile reaction towards oTarget, depending

// on the reputation, PVP setting and (if both oSource and oTarget are PCs),

// oSource's Like/Dislike setting for oTarget.

// Note: If you just want to know how two objects feel about each other in terms

// of faction and personal reputation, use GetIsEnemy() instead.

// * Returns TRUE if oSource has a hostile reaction towards oTarget

int GetIsReactionTypeHostile(object oTarget, object oSource=OBJECT_SELF)



// Determine whether oSource has a neutral reaction towards oTarget, depending

// on the reputation, PVP setting and (if both oSource and oTarget are PCs),

// oSource's Like/Dislike setting for oTarget.

// Note: If you just want to know how two objects feel about each other in terms

// of faction and personal reputation, use GetIsNeutral() instead.

// * Returns TRUE if oSource has a neutral reaction towards oTarget

int GetIsReactionTypeNeutral(object oTarget, object oSource=OBJECT_SELF)



// * Returns TRUE if oCreature is resting.

int GetIsResting(object oCreature=OBJECT_SELF)



// * Returns TRUE if tTalent is valid.

int GetIsTalentValid(talent tTalent)



// Note: Only placeables, doors and triggers can be trapped.

// * Returns TRUE if oObject is trapped.

int GetIsTrapped(object oObject)



// * Returns TRUE if the weapon equipped is capable of damaging oVersus.

int GetIsWeaponEffective(object oVersus=OBJECT_INVALID, int bOffHand=FALSE)



// Use this in an OnItemActivated module script to get the item that was activated.

object GetItemActivated()



// Use this in an OnItemActivated module script to get the item's target.

object GetItemActivatedTarget()



// Use this in an OnItemActivated module script to get the location of the item's

// target.

location GetItemActivatedTargetLocation()



// Use this in an OnItemActivated module script to get the creature that

// activated the item.

object GetItemActivator()



// Get the Armour Class of oItem.

// * Return 0 if the oItem is not a valid item, or if oItem has no armour value.

int GetItemACValue(object oItem)



// Determines whether oItem has nProperty.

// - oItem

// - nProperty: ITEM_PROPERTY_*

// * Returns FALSE if oItem is not a valid item, or if oItem does not have

// nProperty.

int GetItemHasItemProperty(object oItem, int nProperty)



// Get the object which is in oCreature's specified inventory slot

// - nInventorySlot: INVENTORY_SLOT_*

// - oCreature

// * Returns OBJECT_INVALID if oCreature is not a valid creature or there is no

// item in nInventorySlot.

object GetItemInSlot(int nInventorySlot, object oCreature=OBJECT_SELF)



// Get the object possessed by oCreature with the tag sItemTag

// * Return value on error: OBJECT_INVALID

object GetItemPossessedBy(object oCreature, string sItemTag)



// Get the possessor of oItem

// * Return value on error: OBJECT_INVALID

object GetItemPossessor(object oItem)



// Get the experience assigned in the journal editor for szPlotID.

int GetJournalQuestExperience(string szPlotID)



// Get the last command (ASSOCIATE_COMMAND_*) issued to oAssociate.

int GetLastAssociateCommand(object oAssociate=OBJECT_SELF)



// Get the last attacker of oAttackee. This should only be used ONLY in the

// OnAttacked events for creatures, placeables and doors.

// * Return value on error: OBJECT_INVALID

object GetLastAttacker(object oAttackee=OBJECT_SELF)



// Get the attack mode (COMBAT_MODE_*) of oCreature's last attack.

// This only works when oCreature is in combat.

int GetLastAttackMode(object oCreature=OBJECT_SELF)



// Get the attack type (SPECIAL_ATTACK_*) of oCreature's last attack.

// This only works when oCreature is in combat.

int GetLastAttackType(object oCreature=OBJECT_SELF)



// Use this in an OnClosed script to get the object that closed the door or placeable.

// * Returns OBJECT_INVALID if the caller is not a valid door or placeable.

object GetLastClosedBy()



// Get the last object that damaged the caller.

// * Returns OBJECT_INVALID if the caller is not a valid object.

object GetLastDamager()



// Get the last object that disarmed the trap on the caller.

// * Returns OBJECT_INVALID if the caller is not a valid placeable, trigger or

// door.

object GetLastDisarmed()



// Get the last object that disturbed the inventory of the caller.

// * Returns OBJECT_INVALID if the caller is not a valid creature or placeable.

object GetLastDisturbed()



//Returns a SPELL_ constant for the last spell used

int GetLastGenericSpellCast()



// Get the last object that was sent as a GetLastAttacker(), GetLastDamager(),

// GetLastSpellCaster() (for a hostile spell), or GetLastDisturbed() (when a

// creature is pickpocketed).

// Note: Return values may only ever be:

// 1) A Creature

// 2) Plot Characters will never have this value set

// 3) Area of Effect Objects will return the AOE creator if they are registered

// as this value, otherwise they will return INVALID_OBJECT_ID

// 4) Traps will not return the creature that set the trap.

// 5) This value will never be overwritten by another non-creature object.

// 6) This value will never be a dead/destroyed creature

object GetLastHostileActor(object oVictim=OBJECT_SELF)



// Get the object that killed the caller.

object GetLastKiller()



// Get the last object that locked the caller.

// * Returns OBJECT_INVALID if the caller is not a valid door or placeable.

object GetLastLocked()



// Get the last creature that opened the caller.

// * Returns OBJECT_INVALID if the caller is not a valid door or placeable.

object GetLastOpenedBy()



// Get the last PC that has rested in the module.

object GetLastPCRested()



// Use this in an OnPerception script to get the object that was perceived.

// * Returns OBJECT_INVALID if the caller is not a valid creature.

object GetLastPerceived()



// Use this in an OnPerception script to determine whether the object that was

// perceived was heard.

int GetLastPerceptionHeard()



// Use this in an OnPerception script to determine whether the object that was

// perceived has become inaudible.

int GetLastPerceptionInaudible()



// Use this in an OnPerception script to determine whether the object that was

// perceived was seen.

int GetLastPerceptionSeen()



// Use this in an OnPerception script to determine whether the object that was

// perceived has vanished.

int GetLastPerceptionVanished()



// Use this in an OnPlayerDeath module script to get the last player that died.

object GetLastPlayerDied()



// Use this in an OnPlayerDying module script to get the last player who is dying.

object GetLastPlayerDying()



// Use this in an OnRespawnButtonPressed module script to get the object id of

// the player who last pressed the respawn button.

object GetLastRespawnButtonPresser()



// Determine the type (REST_EVENTTYPE_REST_*) of the last rest event (as

// returned from the OnPCRested module event).

int GetLastRestEventType()



// Use this in a conversation script to get the person with whom you are conversing.

// * Returns OBJECT_INVALID if the caller is not a valid creature.

object GetLastSpeaker()



// This is for use in a "Spell Cast" script, it gets the ID of the spell that

// was cast.

int GetLastSpell()



// This is for use in a "Spell Cast" script, it gets who cast the spell.

// The spell could have been cast by a creature, placeable or door.

// * Returns OBJECT_INVALID if the caller is not a creature, placeable or door.

object GetLastSpellCaster()



// Use this in a SpellCast script to determine whether the spell was considered

// harmful.

// * Returns TRUE if the last spell cast was harmful.

int GetLastSpellHarmful()



// Get the last trap detected by oTarget.

// * Return value on error: OBJECT_INVALID

object GetLastTrapDetected(object oTarget=OBJECT_SELF)



// Get the last object that unlocked the caller.

// * Returns OBJECT_INVALID if the caller is not a valid door or placeable.

object GetLastUnlocked()

// Get the last object that used the placeable object that is calling this function.

// * Returns OBJECT_INVALID if it is called by something other than a placeable or

// a door.

object GetLastUsedBy()



// Get the last weapon that oCreature used in an attack.

// * Returns OBJECT_INVALID if oCreature did not attack, or has no weapon equipped.

object GetLastWeaponUsed(object oCreature)



// Get an integer between 0 and 100 (inclusive) to represent oCreature's

// Law/Chaos alignment

// (100=law, 0=chaos)

// * Return value if oCreature is not a valid creature: -1

int GetLawChaosValue(object oCreature)



// Determine the levels that oCreature holds in nClassType.

// - nClassType: CLASS_TYPE_*

// - oCreature

int GetLevelByClass(int nClassType, object oCreature=OBJECT_SELF)



// A creature can have up to three classes. This function determines the

// creature's class level based on nClass Position.

// - nClassPosition: 1, 2 or 3

// - oCreature

// * Returns 0 if oCreature does not have a class in nClassPosition

// (i.e. a single-class creature will only have a value in nClassLocation=1)

// or if oCreature is not a valid creature.

int GetLevelByPosition(int nClassPosition, object oCreature=OBJECT_SELF)



// In an onConversation script this gets the number of the string pattern

// matched (the one that triggered the script).

// * Returns -1 if no string matched

int GetListenPatternNumber()



// Get oObject's local float variable sVarName

// * Return value on error: 0.0f

float GetLocalFloat(object oObject, string sVarName)



// Get oObject's local integer variable sVarName

// * Return value on error: 0

int GetLocalInt(object oObject, string sVarName)



// Get oObject's local location variable sVarname

location GetLocalLocation(object oObject, string sVarName)



// Get oObject's local object variable sVarName

// * Return value on error: OBJECT_INVALID

object GetLocalObject(object oObject, string sVarName)



// Get oObject's local string variable sVarName

// * Return value on error: ""

string GetLocalString(object oObject, string sVarName)



// Get the location of oObject.

location GetLocation(object oObject)



// Get the locked state of oTarget, which can be a door or a placeable object.

int GetLocked(object oTarget)



//Searches for the nearest locked object to the master

object GetLockedObject(object oMaster)



// * Returns TRUE if a specific key is required to open the lock on oObject.

int GetLockKeyRequired(object oObject)



// Get the tag of the key that will open the lock on oObject.

int GetLockKeyTag(object oObject)



// * Returns TRUE if the lock on oObject is lockable.

int GetLockLockable(object oObject)



// Get the DC for locking oObject.

int GetLockLockDC(object oObject)



// Get the DC for unlocking oObject.

int GetLockUnlockDC(object oObject)



// Get the master of oAssociate.

object GetMaster(object oAssociate=OBJECT_SELF)



int GetMatchCompatibility(talent tUse, string sClass, int nType)



// Get the appropriate matched string (this should only be used in

// OnConversation scripts).

// * Returns the appropriate matched string, otherwise returns ""

string GetMatchedSubstring(int nString)



// Get the number of string parameters available.

// * Returns -1 if no string matched (this could be because of a dialogue event)

int GetMatchedSubstringsCount()



// Get the maximum hitpoints of oObject

// * Return value on error: 0

int GetMaxHitPoints(object oObject=OBJECT_SELF)



// Get the metamagic type (METAMAGIC_*) of the last spell cast by the caller

// * Return value if the caster is not a valid object: -1

int GetMetaMagicFeat()



// Get the module.

// * Return value on error: OBJECT_INVALID

object GetModule()



// Use this in an OnItemAcquired script to get the item that was acquired.

// * Returns OBJECT_INVALID if the module is not valid.

object GetModuleItemAcquired()



// Use this in an OnItemAcquired script to get the creatre that previously

// possessed the item.

// * Returns OBJECT_INVALID if the item was picked up from the ground.

object GetModuleItemAcquiredFrom()



// Use this in an OnItemLost script to get the item that was lost/dropped.

// * Returns OBJECT_INVALID if the module is not valid.

object GetModuleItemLost()



// Use this in an OnItemLost script to get the creature that lost the item.

// * Returns OBJECT_INVALID if the module is not valid.

object GetModuleItemLostBy()



// Get the module's name in the language of the server that's running it.

// * If there is no entry for the language of the server, it will return an

// empty string

string GetModuleName()



string GetMostDangerousClass(struct sEnemies sCount)



// Get oCreature's movement rate.

// * Returns 0 if oCreature is invalid.

int GetMovementRate(object oCreature)



// Get the name of oObject.

string GetName(object oObject)



// Get the creature nearest to oTarget, subject to all the criteria specified.

// - nFirstCriteriaType: CREATURE_TYPE_*

// - nFirstCriteriaValue:

// -> CLASS_TYPE_* if nFirstCriteriaType was CREATURE_TYPE_CLASS

// -> SPELL_* if nFirstCriteriaType was CREATURE_TYPE_DOES_NOT_HAVE_SPELL_EFFECT

// or CREATURE_TYPE_HAS_SPELL_EFFECT

// -> TRUE or FALSE if nFirstCriteriaType was CREATURE_TYPE_IS_ALIVE

// -> PERCEPTION_* if nFirstCriteriaType was CREATURE_TYPE_PERCEPTION

// -> PLAYER_CHAR_IS_PC or PLAYER_CHAR_NOT_PC if nFirstCriteriaType was

// CREATURE_TYPE_PLAYER_CHAR

// -> RACIAL_TYPE_* if nFirstCriteriaType was CREATURE_TYPE_RACIAL_TYPE

// -> REPUTATION_TYPE_* if nFirstCriteriaType was CREATURE_TYPE_REPUTATION

// For example, to get the nearest PC, use:

// (CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC)

// - oTarget: We're trying to find the creature of the specified type that is

// nearest to oTarget

// - nNth: We don't have to find the first nearest: we can find the Nth nearest...

// - nSecondCriteriaType: This is used in the same way as nFirstCriteriaType to

// further specify the type of creature that we are looking for.

// - nSecondCriteriaValue: This is used in the same way as nFirstCriteriaValue

// to further specify the type of creature that we are looking for.

// - nThirdCriteriaType: This is used in the same way as nFirstCriteriaType to

// further specify the type of creature that we are looking for.

// - nThirdCriteriaValue: This is used in the same way as nFirstCriteriaValue to

// further specify the type of creature that we are looking for.

// * Return value on error: OBJECT_INVALID

object GetNearestCreature(int nFirstCriteriaType, int nFirstCriteriaValue, object oTarget=OBJECT_SELF, int nNth=1, int nSecondCriteriaType=-1, int nSecondCriteriaValue=-1, int nThirdCriteriaType=-1, int nThirdCriteriaValue=-1 )



// Get the creature nearest to lLocation, subject to all the criteria specified.

// - nFirstCriteriaType: CREATURE_TYPE_*

// - nFirstCriteriaValue:

// -> CLASS_TYPE_* if nFirstCriteriaType was CREATURE_TYPE_CLASS

// -> SPELL_* if nFirstCriteriaType was CREATURE_TYPE_DOES_NOT_HAVE_SPELL_EFFECT

// or CREATURE_TYPE_HAS_SPELL_EFFECT

// -> TRUE or FALSE if nFirstCriteriaType was CREATURE_TYPE_IS_ALIVE

// -> PERCEPTION_* if nFirstCriteriaType was CREATURE_TYPE_PERCEPTION

// -> PLAYER_CHAR_IS_PC or PLAYER_CHAR_NOT_PC if nFirstCriteriaType was

// CREATURE_TYPE_PLAYER_CHAR

// -> RACIAL_TYPE_* if nFirstCriteriaType was CREATURE_TYPE_RACIAL_TYPE

// -> REPUTATION_TYPE_* if nFirstCriteriaType was CREATURE_TYPE_REPUTATION

// For example, to get the nearest PC, use

// (CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC)

// - lLocation: We're trying to find the creature of the specified type that is

// nearest to lLocation

// - nNth: We don't have to find the first nearest: we can find the Nth nearest....

// - nSecondCriteriaType: This is used in the same way as nFirstCriteriaType to

// further specify the type of creature that we are looking for.

// - nSecondCriteriaValue: This is used in the same way as nFirstCriteriaValue

// to further specify the type of creature that we are looking for.

// - nThirdCriteriaType: This is used in the same way as nFirstCriteriaType to

// further specify the type of creature that we are looking for.

// - nThirdCriteriaValue: This is used in the same way as nFirstCriteriaValue to

// further specify the type of creature that we are looking for.

// * Return value on error: OBJECT_INVALID

object GetNearestCreatureToLocation(int nFirstCriteriaType, int nFirstCriteriaValue, location lLocation, int nNth=1, int nSecondCriteriaType=-1, int nSecondCriteriaValue=-1, int nThirdCriteriaType=-1, int nThirdCriteriaValue=-1 )



// Get the Nth object nearest to oTarget that is of the specified type.

// - nObjectType: OBJECT_TYPE_*

// - oTarget

// - nNth

// * Return value on error: OBJECT_INVALID

object GetNearestObject(int nObjectType=OBJECT_TYPE_ALL, object oTarget=OBJECT_SELF, int nNth=1)



// Get the nth Object nearest to oTarget that has sTag as its tag.

// * Return value on error: OBJECT_INVALID

object GetNearestObjectByTag(string sTag, object oTarget=OBJECT_SELF, int nNth=1)



// Get the nNth object nearest to lLocation that is of the specified type.

// - nObjectType: OBJECT_TYPE_*

// - lLocation

// - nNth

// * Return value on error: OBJECT_INVALID

object GetNearestObjectToLocation(int nObjectType, location lLocation, int nNth=1)



//Returns the nearest object that can be seen, then checks for the nearest heard target.

object GetNearestSeenOrHeardEnemy()



// Get the trap nearest to oTarget.

// Note : "trap objects" are actually any trigger, placeable or door that is

// trapped in oTarget's area.

// - oTarget

// - nTrapDetected: if this is TRUE, the trap returned has to have been detected

// by oTarget.

object GetNearestTrapToObject(object oTarget=OBJECT_SELF, int nTrapDetected=TRUE)



// Get the next in-game effect on oCreature.

effect GetNextEffect(object oCreature)



// Get the next member of oMemberOfFaction's faction (continue to cycle through

// oMemberOfFaction's faction).

// * Returns OBJECT_INVALID if oMemberOfFaction's faction is invalid.

object GetNextFactionMember(object oMemberOfFaction, int bPCOnly=TRUE)



// - oPersistentObject

// - nResidentObjectType: OBJECT_TYPE_*

// - nPersistentZone: PERSISTENT_ZONE_ACTIVE. [This could also take the value

// PERSISTENT_ZONE_FOLLOW, but this is no longer used.]

// * Returns OBJECT_INVALID if no object is found.

object GetNextInPersistentObject(object oPersistentObject=OBJECT_SELF, int nResidentObjectType=OBJECT_TYPE_CREATURE, int nPersistentZone=PERSISTENT_ZONE_ACTIVE)



// Get the next item in oTarget's inventory (continue to cycle through oTarget's

// inventory).

// * Returns OBJECT_INVALID if the caller is not a creature, item, placeable or store,

// or if no item is found.

object GetNextItemInInventory(object oTarget=OBJECT_SELF)



// Get the next object in oArea.

// If no valid area is specified, it will use the caller's area.

// * Return value on error: OBJECT_INVALID

object GetNextObjectInArea(object oArea=OBJECT_INVALID)



// Get the next object in nShape

// - nShape: SHAPE_*

// - fSize:

// -> If nShape == SHAPE_SPHERE, this is the radius of the sphere

// -> If nShape == SHAPE_SPELLCYLINDER, this is the radius of the cylinder

// -> If nShape == SHAPE_CONE, this is the widest radius of the cone

// -> If nShape == SHAPE_CUBE, this is half the length of one of the sides of

// the cube

// - lTarget: This is the centre of the effect, usually GetSpellTargetPosition(),

// or the end of a cylinder or cone.

// - bLineOfSight: This controls whether to do a line-of-sight check on the

// object returned. (This can be used to ensure that spell effects do not go

// through walls.)

// - nObjectFilter: This allows you to filter out undesired object types, using

// bitwise "or". For example, to return only creatures and doors, the value for

// this parameter would be OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR

// - vOrigin: This is only used for cylinders and cones, and specifies the origin

// of the effect (normally the spell-caster's position).

// Return value on error: OBJECT_INVALID

object GetNextObjectInShape(int nShape, float fSize, location lTarget, int bLineOfSight=FALSE, int nObjectFilter=OBJECT_TYPE_CREATURE, vector vOrigin=[0.0,0.0,0.0])



// Get the next PC in the player list.

// This picks up where the last GetFirstPC() or GetNextPC() left off.

object GetNextPC()



int GetNPCWarningStatus()



//Calculate the number of people currently attacking self.

int GetNumberOfMeleeAttackers()



//Calculate the number of people attacking self from beyond 5m

int GetNumberOfRangedAttackers()



// Get the number of stacked items that oItem comprises.

int GetNumStackedItems(object oItem)



// Get the nNth object with the specified tag.

// - sTag

// - nNth: the nth object with this tag may be requested

// * Returns OBJECT_INVALID if the object cannot be found.

object GetObjectByTag(string sTag, int nNth=0)



// Determine whether oSource hears oTarget.

int GetObjectHeard(object oTarget, object oSource=OBJECT_SELF)



// Determine whether oSource sees oTarget.

int GetObjectSeen(object oTarget, object oSource=OBJECT_SELF)



// Get the object type (OBJECT_TYPE_*) of oTarget

// * Return value if oTarget is not a valid object: -1

int GetObjectType(object oTarget)



// Get the IP address from which oPlayer has connected.

string GetPCIPAddress(object oPlayer)



// Get the last PC that levelled up.

object GetPCLevellingUp()



// Get the name of oPlayer.

string GetPCPlayerName(object oPlayer)



// Get the public part of the CD Key that oPlayer used when logging in.

string GetPCPublicCDKey(object oPlayer)



// Get the PC that is involved in the conversation.

// * Returns OBJECT_INVALID on error.

object GetPCSpeaker()



//Determine the percentage of HP object-self has left

int GetPercentageHPLoss(object oWounded)



// * Returns TRUE if the illumination for oPlaceable is on

int GetPlaceableIllumination(object oPlaceable=OBJECT_SELF)



// Determine whether oTarget is a plot object.

int GetPlotFlag(object oTarget=OBJECT_SELF)



// Get the position of oTarget

// * Return value on error: vector (0.0f, 0.0f, 0.0f)

vector GetPosition(object oTarget)



// Get the position vector from lLocation.

vector GetPositionFromLocation(location lLocation)



// Get the racial type (RACIAL_TYPE_*) of oCreature

// * Return value if oCreature is not a valid creature: RACIAL_TYPE_INVALID

int GetRacialType(object oCreature)



//Determine the number of targets within 20m that are of the specified racial-type

int GetRacialTypeCount(int nRacial_Type)



object GetRangedAttackGroup(int bAllowFriendlyFire = FALSE)



// Use this in spell scripts to get nDamage adjusted by oTarget's reflex and

// evasion saves.

// - nDamage

// - oTarget

// - nDC: Difficulty check

// - nSaveType: SAVING_THROW_TYPE_*

// - oSaveVersus

int GetReflexAdjustedDamage(int nDamage, object oTarget, int nDC, int nSaveType=SAVING_THROW_TYPE_NONE, object oSaveVersus=OBJECT_SELF)



// Get oTarget's base reflex saving throw value (this will only work for

// creatures, doors, and placeables).

// * Returns 0 if oTarget is invalid.

int GetReflexSavingThrow(object oTarget)



// Get an integer between 0 and 100 (inclusive) that represents how oSource

// feels about oTarget.

// -> 0-10 means oSource is hostile to oTarget

// -> 11-89 means oSource is neutral to oTarget

// -> 90-100 means oSource is friendly to oTarget

// * Returns -1 if oSource or oTarget does not identify a valid object

int GetReputation(object oSource, object oTarget)

// Get the creature that is currently sitting on the specified object.

// - oChair

// * Returns OBJECT_INVALID if oChair is not a valid placeable.

object GetSittingCreature(object oChair)



// Get the number of ranks that oTarget has in nSkill.

// - nSkill: SKILL_*

// - oTarget

// * Returns -1 if oTarget doesn't have nSkill.

// * Returns 0 if nSkill is untrained.

int GetSkillRank(int nSkill, object oTarget=OBJECT_SELF)



int GetSpawnInCondition(int nCondition)



// Use this in a spell script to get the item used to cast the spell.

object GetSpellCastItem()



// This is for use in a Spell script, it gets the ID of the spell that is being

// cast (SPELL_*).

int GetSpellId()



// Get the DC to save against for a spell (10 + spell level + relevant ability

// bonus). This can be called by a creature or by an Area of Effect object.

int GetSpellSaveDC()



// Get the location of the caller's last spell target.

location GetSpellTargetLocation()



// Get the object at which the caller last cast a spell

// * Return value on error: OBJECT_INVALID

object GetSpellTargetObject()



// Find out how nStandardFaction feels about oCreature.

// - nStandardFaction: STANDARD_FACTION_*

// - oCreature

int GetStandardFactionReputation(int nStandardFaction, object oCreature=OBJECT_SELF)



// Get the starting location of the module.

location GetStartingLocation()



// Get a string from the talk table using nStrRef.

string GetStringByStrRef(int nStrRef)



// Get nCounter characters from the left end of sString

// * Return value on error: ""

string GetStringLeft(string sString, int nCount)

// Get the length of sString

// * Return value on error: -1

int GetStringLength(string sString)



// Convert sString into lower case

// * Return value on error: ""

string GetStringLowerCase(string sString)



// Get nCount characters from the right end of sString

// * Return value on error: ""

string GetStringRight(string sString, int nCount)



// Convert sString into upper case

// * Return value on error: ""

string GetStringUpperCase(string sString)



// Get the duration (in seconds) of the sound attached to nStrRef

// * Returns 0.0f if no duration is stored or if no sound is attached

float GetStrRefSoundDuration(int nStrRef)



// Get the name of oCreature's sub race.

// * Returns "" if oCreature is invalid (or if sub race is blank for oCreature).

string GetSubRace(object oTarget)



// Get nCount characters from sString, starting at nStart

// * Return value on error: ""

string GetSubString(string sString, int nStart, int nCount)



// Get the Tag of oObject

// * Return value if oObject is not a valid object: ""

string GetTag(object oObject)



// Get the color (TILE_MAIN_LIGHT_COLOR_*) for the main light 1 of the tile at

// lTile.

// - lTile: the vector part of this is the tile grid (x,y) coordinate of the tile.

int GetTileMainLight1Color(location lTile)



// Get the color (TILE_MAIN_LIGHT_COLOR_*) for the main light 2 of the tile at

// lTile.

// - lTile: the vector part of this is the tile grid (x,y) coordinate of the

// tile.

int GetTileMainLight2Color(location lTile)



// Get the color (TILE_SOURCE_LIGHT_COLOR_*) for the source light 1 of the tile

// at lTile.

// - lTile: the vector part of this is the tile grid (x,y) coordinate of the

// tile.

int GetTileSourceLight1Color(location lTile)



// Get the color (TILE_SOURCE_LIGHT_COLOR_*) for the source light 2 of the tile

// at lTile.

// - lTile: the vector part of this is the tile grid (x,y) coordinate of the

// tile.

int GetTileSourceLight2Color(location lTile)



// Get the current hour.

int GetTimeHour()



// Get the current millisecond

int GetTimeMillisecond()



// Get the current minute

int GetTimeMinute()



// Get the current second

int GetTimeSecond()



// Get the total amount of damage that has been dealt to the caller.

int GetTotalDamageDealt()



object GetToughestAttacker()



object GetToughestMeleeAttacker()



// Get the destination (a waypoint or a door) for a trigger or a door.

// * Returns OBJECT_INVALID if oTransition is not a valid trigger or door.

object GetTransitionTarget(object oTransition)



// Get the trap base type (TRAP_BASE_TYPE_*) of oTrapObject.

// - oTrapObject: a placeable, door or trigger

int GetTrapBaseType(object oTrapObject)



// Get the creator of oTrapObject, the creature that set the trap.

// - oTrapObject: a placeable, door or trigger

// * Returns OBJECT_INVALID if oTrapObject was created in the toolset.

object GetTrapCreator(object oTrapObject)



// - oTrapObject: a placeable, door or trigger

// * Returns TRUE if oTrapObject is detectable.

int GetTrapDetectable(object oTrapObject)



// Get the DC for detecting oTrapObject.

// - oTrapObject: a placeable, door or trigger

int GetTrapDetectDC(object oTrapObject)



// - oTrapObject: a placeable, door or trigger

// - oCreature

// * Returns TRUE if oCreature has detected oTrapObject

int GetTrapDetectedBy(object oTrapObject, object oCreature)



// - oTrapObject: a placeable, door or trigger

// * Returns TRUE if oTrapObject is disarmable.

int GetTrapDisarmable(object oTrapObject)



// Get the DC for disarming oTrapObject.

// - oTrapObject: a placeable, door or trigger

int GetTrapDisarmDC(object oTrapObject)



// - oTrapObject: a placeable, door or trigger

// * Returns TRUE if oTrapObject has been flagged as visible to all creatures.

int GetTrapFlagged(object oTrapObject)



// Get the tag of the key that will disarm oTrapObject.

// - oTrapObject: a placeable, door or trigger

string GetTrapKeyTag(object oTrapObject)



// - oTrapObject: a placeable, door or trigger

// * Returns TRUE if oTrapObject is one-shot (i.e. it does not reset itself

// after firing.

int GetTrapOneShot(object oTrapObject)



// Get the number of Hitdice worth of Turn Resistance that oUndead may have.

// This will only work on undead creatures.

int GetTurnResistanceHD(object oUndead=OBJECT_SELF)



// Get the type (TALENT_TYPE_*) of tTalent.

int GetTypeFromTalent(talent tTalent)



// This is for use in a user-defined script, it gets the event number.

int GetUserDefinedEventNumber()



// Get the first waypoint with the specified tag.

// * Returns OBJECT_INVALID if the waypoint cannot be found.

object GetWaypointByTag(string sWaypointTag)



// * Returns TRUE if oItem is a ranged weapon.

int GetWeaponRanged(object oItem)



// Get oTarget's base will saving throw value (this will only work for creatures,

// doors, and placeables).

// * Returns 0 if oTarget is invalid.

int GetWillSavingThrow(object oTarget)



// Get oCreature's experience.

int GetXP(object oCreature)



// Give nGP gold to oCreature.

void GiveGoldToCreature(object oCreature, int nGP)



// Gives nXpAmount to oCreature.

void GiveXPToCreature(object oCreature, int nXpAmount)



// Convert nHours into a number of seconds

// The result will depend on how many minutes there are per hour (game-time)

float HoursToSeconds(int nHours)



// Insert sString into sDestination at nPosition

// * Return value on error: ""

string InsertString(string sDestination, string sString, int nPosition)



// Convert nInteger into a floating point number.

float IntToFloat(int nInteger)



// Convert nInteger to hex, returning the hex value as a string.

// * Return value has the format "0x????????" where each ? will be a hex digit

// (8 digits in total).

string IntToHexString(int nInteger)



// Convert nInteger into a string.

// * Return value on error: ""

string IntToString(int nInteger)



// Determine whether oObject is in conversation.

int IsInConversation(object oObject)



// Jump to lDestination. The action is added to the TOP of the action queue.

void JumpToLocation(location lDestination)



// Jump to oToJumpTo (the action is added to the top of the action queue).

void JumpToObject(object oToJumpTo, int nWalkStraightLineToPoint=1)



// Create a location.

location Location(object oArea, vector vPosition, float fOrientation)



// Maths operation: log of fValue

// * Returns zero if fValue <= zero

float log(float fValue)



// Set the subtype of eEffect to Magical and return eEffect.

// (Effects default to magical if the subtype is not set)

effect MagicalEffect(effect eEffect)



int MatchCombatProtections(talent tUse)

int MatchElementalProtections(talent tUse)

int MatchFortAttacks(talent tUse)

int MatchReflexAttacks(talent tUse)

int MatchSpellProtections(talent tUse)



// Change the background day track for oArea to nTrack.

// - oArea

// - nTrack

void MusicBackgroundChangeDay(object oArea, int nTrack)



// Change the background night track for oArea to nTrack.

// - oArea

// - nTrack

void MusicBackgroundChangeNight(object oArea, int nTrack)



// Get the Battle Track for oArea.

int MusicBackgroundGetBattleTrack(object oArea)



// Get the Day Track for oArea.

int MusicBackgroundGetDayTrack(object oArea)



// Get the Night Track for oArea.

int MusicBackgroundGetNightTrack(object oArea)



// Play the background music for oArea.

void MusicBackgroundPlay(object oArea)



// Set the delay for the background music for oArea.

// - oArea

// - nDelay: delay in milliseconds

void MusicBackgroundSetDelay(object oArea, int nDelay)



// Stop the background music for oArea.

void MusicBackgroundStop(object oArea)



// Change the battle track for oArea.

// - oArea

// - nTrack

void MusicBattleChange(object oArea, int nTrack)



// Play the battle music for oArea.

void MusicBattlePlay(object oArea)



// Stop the battle music for oArea.

void MusicBattleStop(object oArea)



//Inserts a debug print string into the log.

void MyPrintString(string sString)



int nDetermineClassToUse(object oCharacter)



// Convert oObject into a hexadecimal string.

string ObjectToString(object oObject)



// Open oStore for oPC.

void OpenStore(object oStore, object oPC, int nBonusMarkUp=0, int nBonusMarkDown=0)



// Play nAnimation immediately.

// - nAnimation: ANIMATION_*

// - fSpeed

// - fSeconds

void PlayAnimation(int nAnimation, float fSpeed=1.0, float fSeconds=0.0)



void PlayImmobileAmbientAnimations()



//AMBIENT ANIMATION COMMANDS

void PlayMobileAmbientAnimations()



// Play sSoundName

// - sSoundName: TBD - SS

void PlaySound(string sSoundName)



// Play a voice chat.

// - nVoiceChatID: VOICE_CHAT_*

// - oTarget

void PlayVoiceChat(int nVoiceChatID, object oTarget=OBJECT_SELF)



// - oPC

// - bRespawnButtonEnabled: if this is TRUE, the "Respawn" button will be enabled

// on the Death GUI.

// - bWaitForHelpButtonEnabled: if this is TRUE, the "Wait For Help" button will

// be enabled on the Death GUI.

// - nHelpStringReference

// - sHelpString

void PopUpDeathGUIPanel(object oPC, int bRespawnButtonEnabled=TRUE, int bWaitForHelpButtonEnabled=TRUE, int nHelpStringReference=0, string sHelpString="")



// Spawn a GUI panel for the client that controls oPC.

// - oPC

// - nGUIPanel: GUI_PANEL_*

// * Nothing happens if oPC is not a player character or if an invalid value is

// used for nGUIPanel.

void PopUpGUIPanel(object oPC, int nGUIPanel)



// Maths operation: fValue is raised to the power of fExponent

// * Returns zero if fValue ==0 and fExponent <0

float pow(float fValue, float fExponent)



// Output a formatted float to the log file.

// - nWidth should be a value from 0 to 18 inclusive.

// - nDecimals should be a value from 0 to 9 inclusive.

void PrintFloat(float fFloat, int nWidth=18, int nDecimals=9)



// Output nInteger to the log file.

void PrintInteger(int nInteger)



// Output oObject's ID to the log file.

void PrintObject(object oObject)



// Output sString to the log file.

void PrintString(string sString)



// Output vVector to the logfile.

// - vVector

// - bPrepend: if this is TRUE, the message will be prefixed with "PRINTVECTOR:"

void PrintVector(vector vVector, int bPrepend)



// Get an integer between 0 and nMaxInteger-1.

// Return value on error: 0

int Random(int nMaxInteger)



// Generate a random name.

string RandomName()



// All clients in oArea will recompute the static lighting.

// This can be used to update the lighting after changing any tile lights or if

// placeables with lights have been added/deleted.

void RecomputeStaticLighting(object oArea)



// Does a Reflex Save check for the given DC

// - oCreature

// - nDC: Difficulty check

// - nSaveType: SAVING_THROW_TYPE_*

// - oSaveVersus

// Returns: 0 if the saving throw roll failed

// Returns: 1 if the saving throw roll succeeded

// Returns: 2 if the target was immune to the save type specified

int ReflexSave(object oCreature, int nDC, int nSaveType=SAVING_THROW_TYPE_NONE, object oSaveVersus=OBJECT_SELF)



//If using ambient sleep this will remove the effect

void RemoveAmbientSleep()



// Remove eEffect from oCreature.

// * No return value

void RemoveEffect(object oCreature, effect eEffect)



// Remove oPC from their current party. This will only work on a PC.

// - oPC: removes this player from whatever party they're currently in.

void RemoveFromParty(object oPC)



// Remove oHenchman from the service of oMaster, returning them to their original faction.

void RemoveHenchman(object oMaster, object oHenchman=OBJECT_SELF)



// Remove a journal quest entry from oCreature.

// - szPlotID: the plot identifier used in the toolset's Journal Editor

// - oCreature

// - bAllPartyMembers: If this is TRUE, the entry will be removed from the

// journal of everyone in the party

// - bAllPlayers: If this is TRUE, the entry will be removed from the journal of

// everyone in the world

void RemoveJournalQuestEntry(string szPlotID, object oCreature, int bAllPartyMembers=TRUE, int bAllPlayers=FALSE)



// Removes oAssociate from the service of oMaster, returning them to their

// original faction.

void RemoveSummonedAssociate(object oMaster, object oAssociate=OBJECT_SELF)



//Returns the henchmen to a commandable state of grace

void ResetHenchmenState()



// Do a Spell Resistance check between oCaster and oTarget, returning TRUE if

// the spell was resisted.

// * Return value if oCaster or oTarget is an invalid object: FALSE

int ResistSpell(object oCaster, object oTarget)

void RespondToShout(object oShouter, int nShoutIndex, object oIntruder = OBJECT_INVALID)



// Convert nRounds into a number of seconds

// A round is always 6.0 seconds

float RoundsToSeconds(int nRounds)



void RunCircuit(int nTens, int nNum, int nRun = FALSE, float fPause = 1.0)



void RunNextCircuit(int nRun = FALSE, float fPause = 1.0)



// Sends szMessage to all the Dungeon Masters currently on the server.

void SendMessageToAllDMs(string szMessage)



// Send a server message (szMessage) to the oPlayer.

void SendMessageToPC(object oPlayer, string szMessage)



// Set the transition bitmap of a player; this should only be called in area

// transition scripts. This action should be run by the person "clicking" the

// area transition via AssignCommand.

// - nPredefinedAreaTransition:

// -> To use a predefined area transition bitmap, use one of AREA_TRANSITION_*

// -> To use a custom, user-defined area transition bitmap, use

// AREA_TRANSITION_USER_DEFINED and specify the filename in the second

// parameter

// - sCustomAreaTransitionBMP: this is the filename of a custom, user-defined

// area transition bitmap

void SetAreaTransitionBMP(int nPredefinedAreaTransition, string sCustomAreaTransitionBMP="")



// Initialise oTarget to listen for the standard Associates commands.

void SetAssociateListenPatterns(object oTarget=OBJECT_SELF)



void SetAssociateStartLocation()



//ASSOCIATE MASTER VARIABLE FUNCTIONS

void SetAssociateState(int nCondition, int bValid = TRUE)



//BEHAVIOR LOCAL FUNCTIONS

void SetBehaviorState(int nCondition, int bValid = TRUE)



// Set the calendar to the specified date.

// - nYear should be from 0 to 32000 inclusive

// - nMonth should be from 1 to 12 inclusive

// - nDay should be from 1 to 28 inclusive

// 1) Time can only be advanced forwards; attempting to set the time backwards

// will result in no change to the calendar.

// 2) If values larger than the month or day are specified, they will be wrapped

// around and the overflow will be used to advance the next field.

// e.g. Specifying a year of 1350, month of 33 and day of 10 will result in

// the calender being set to a year of 1352, a month of 9 and a day of 10.

void SetCalendar(int nYear,int nMonth, int nDay)



// Change the direction in which the camera is facing

// - fDirection is expressed as anticlockwise degrees from Due East.

// (0.0f=East, 90.0f=North, 180.0f=West, 270.0f=South)

// This can be used to change the way the camera is facing after the player

// emerges from an area transition.

void SetCameraFacing(float fDirection)



// Set the camera mode for oPlayer.

// - oPlayer

// - nCameraMode: CAMERA_MODE_*

// * If oPlayer is not player-controlled or nCameraMode is invalid, nothing

// happens.

void SetCameraMode(object oPlayer, int nCameraMode)



// Set whether oTarget's action stack can be modified

void SetCommandable(int bCommandable, object oTarget=OBJECT_SELF)



// Set the value for a custom token.

void SetCustomToken(int nCustomTokenNumber, string sTokenValue)



// Set oEncounter's active state to nNewValue.

// - nNewValue: TRUE/FALSE

// - oEncounter

void SetEncounterActive(int nNewValue, object oEncounter=OBJECT_SELF)



// Set the difficulty level of oEncounter.

// - nEncounterDifficulty: ENCOUNTER_DIFFICULTY_*

// - oEncounter

void SetEncounterDifficulty(int nEncounterDifficulty, object oEncounter=OBJECT_SELF)



// Set the number of times that oEncounter has spawned so far

void SetEncounterSpawnsCurrent(int nNewValue, object oEncounter=OBJECT_SELF)



// Set the maximum number of times that oEncounter can spawn

void SetEncounterSpawnsMax(int nNewValue, object oEncounter=OBJECT_SELF)



// Cause the caller to face fDirection.

// - fDirection is expressed as anticlockwise degrees from Due East.

// DIRECTION_EAST, DIRECTION_NORTH, DIRECTION_WEST and DIRECTION_SOUTH are

// predefined. (0.0f=East, 90.0f=North, 180.0f=West, 270.0f=South)

void SetFacing(float fDirection)



// Cause the caller to face vTarget

void SetFacingPoint(vector vTarget)



// Set whether oItem has been identified.

void SetIdentified(object oItem, int bIdentified)



// Set the destroyable status of the caller.

// - bDestroyable: If this is FALSE, the caller does not fade out on death, but

// sticks around as a corpse.

// - bRaiseable: If this is TRUE, the caller can be raised via resurrection.

// - bSelectableWhenDead: If this is TRUE, the caller is selectable after death.

void SetIsDestroyable(int bDestroyable, int bRaiseable=TRUE, int bSelectableWhenDead=FALSE)



// Make oSource into a temporary enemy of oTarget using personal reputation.

// - oTarget

// - oSource

// - bDecays: If this is TRUE, the enmity decays over fDurationInSeconds;

// otherwise it is indefinite.

// - fDurationInSeconds: This is only used if bDecays is TRUE, it is how long

// the enmity lasts.

// Note: If bDecays is TRUE, the personal reputation amount decreases in size

// over fDurationInSeconds. Enmity will only be in effect as long as

// (faction reputation + total personal reputation) <= REPUTATION_TYPE_ENEMY.

void SetIsTemporaryEnemy(object oTarget, object oSource=OBJECT_SELF, int bDecays=FALSE, float fDurationInSeconds=180.0f)



// Make oSource into a temporary friend of oTarget using personal reputation.

// - oTarget

// - oSource

// - bDecays: If this is TRUE, the friendship decays over fDurationInSeconds;

// otherwise it is indefinite.

// - fDurationInSeconds: This is only used if bDecays is TRUE, it is how long

// the friendship lasts.

// Note: If bDecays is TRUE, the personal reputation amount decreases in size

// over fDurationInSeconds. Friendship will only be in effect as long as

// (faction reputation + total personal reputation) >= REPUTATION_TYPE_FRIEND.

void SetIsTemporaryFriend(object oTarget, object oSource=OBJECT_SELF, int bDecays=FALSE, float fDurationInSeconds=180.0f)

// Make oSource temporarily neutral to oTarget using personal reputation.

// - oTarget

// - oSource

// - bDecays: If this is TRUE, the neutrality decays over fDurationInSeconds;

// otherwise it is indefinite.

// - fDurationInSeconds: This is only used if bDecays is TRUE, it is how long

// the neutrality lasts.

// Note: If bDecays is TRUE, the personal reputation amount decreases in size

// over fDurationInSeconds. Neutrality will only be in effect as long as

// (faction reputation + total personal reputation) > REPUTATION_TYPE_ENEMY and

// (faction reputation + total personal reputation) < REPUTATION_TYPE_FRIEND.

void SetIsTemporaryNeutral(object oTarget, object oSource=OBJECT_SELF, int bDecays=FALSE, float fDurationInSeconds=180.0f)



//Sets a local variable for the last spell used

void SetLastGenericSpellCast(int nSpell)



// Set whether oObject is listening.

void SetListening(object oObject, int bValue)



void SetListeningPatterns()



// Set the string for oObject to listen for.

// Note: this does not set oObject to be listening.

void SetListenPattern(object oObject, string sPattern, int nNumber=0)



// Set oObject's local float variable sVarName to nValue

void SetLocalFloat(object oObject, string sVarName, float fValue)



// Set oObject's local integer variable sVarName to nValue

void SetLocalInt(object oObject, string sVarName, int nValue)



// Set oObject's local location variable sVarname to lValue

void SetLocalLocation(object oObject, string sVarName, location lValue)



// Set oObject's local object variable sVarName to nValue

void SetLocalObject(object oObject, string sVarName, object oValue)



// Set oObject's local string variable sVarName to nValue

void SetLocalString(object oObject, string sVarName, string sValue)



// Set the locked state of oTarget, which can be a door or a placeable object.

void SetLocked(object oTarget, int bLocked)



// Set whether oMapPin is enabled.

// - oMapPin

// - nEnabled: 0=Off, 1=On

void SetMapPinEnabled(object oMapPin, int nEnabled)



//PLOT FUNCTIONS

void SetNPCWarningStatus(int nStatus = TRUE)



// Make the corresponding panel button on the player's client start or stop

// flashing.

// - oPlayer

// - nButton: PANEL_BUTTON_*

// - nEnableFlash: if this is TRUE nButton will start flashing. It if is FALSE,

// nButton will stop flashing.

void SetPanelButtonFlash(object oPlayer, int nButton, int nEnableFlash)



// Sets oPlayer and oTarget to dislike each other.

void SetPCDislike(object oPlayer, object oTarget)



// Sets oPlayer and oTarget to like each other.

void SetPCLike(object oPlayer, object oTarget)



// Set the status of the illumination for oPlaceable.

// - oPlaceable

// - bIlluminate: if this is TRUE, oPlaceable's illumination will be turned on.

// If this is FALSE, oPlaceable's illumination will be turned off.

// Note: You must call RecomputeStaticLighting() after calling this function in

// order for the changes to occur visually for the players.

// SetPlaceableIllumination() buffers the illumination changes, which are then

// sent out to the players once RecomputeStaticLighting() is called. As such,

// it is best to call SetPlaceableIllumination() for all the placeables you wish

// to set the illumination on, and then call RecomputeStaticLighting() once after

// all the placeable illumination has been set.

// * If oPlaceable is not a placeable object, or oPlaceable is a placeable that

// doesn't have a light, nothing will happen.

void SetPlaceableIllumination(object oPlaceable=OBJECT_SELF, int bIlluminate=TRUE)



// Set oTarget's plot object status.

void SetPlotFlag(object oTarget, int nPlotFlag)



//MASTER LOCAL FUNCTIONS

void SetSpawnInCondition(int nCondition, int bValid = TRUE)



void SetSpawnInLocals(int nCondition)



// Set how nStandardFaction feels about oCreature.

// - nStandardFaction: STANDARD_FACTION_*

// - nNewReputation: 0-100 (inclusive)

// - oCreature

void SetStandardFactionReputation(int nStandardFaction, int nNewReputation, object oCreature=OBJECT_SELF)



void SetSummonHelpIfAttacked()



// Set the main light color on the tile at lTileLocation.

// - lTileLocation: the vector part of this is the tile grid (x,y) coordinate of

// the tile.

// - nMainLight1Color: TILE_MAIN_LIGHT_COLOR_*

// - nMainLight2Color: TILE_MAIN_LIGHT_COLOR_*

void SetTileMainLightColor(location lTileLocation, int nMainLight1Color, int nMainLight2Color)



// Set the source light color on the tile at lTileLocation.

// - lTileLocation: the vector part of this is the tile grid (x,y) coordinate of

// the tile.

// - nSourceLight1Color: TILE_SOURCE_LIGHT_COLOR_*

// - nSourceLight2Color: TILE_SOURCE_LIGHT_COLOR_*

void SetTileSourceLightColor(location lTileLocation, int nSourceLight1Color, int nSourceLight2Color)



// Set the time to the time specified.

// - nHour should be from 0 to 23 inclusive

// - nMinute should be from 0 to 59 inclusive

// - nSecond should be from 0 to 59 inclusive

// - nMillisecond should be from 0 to 999 inclusive

// 1) Time can only be advanced forwards; attempting to set the time backwards

// will result in the day advancing and then the time being set to that

// specified, e.g. if the current hour is 15 and then the hour is set to 3,

// the day will be advanced by 1 and the hour will be set to 3.

// 2) If values larger than the max hour, minute, second or millisecond are

// specified, they will be wrapped around and the overflow will be used to

// advance the next field, e.g. specifying 62 hours, 250 minutes, 10 seconds

// and 10 milliseconds will result in the calendar day being advanced by 2

// and the time being set to 18 hours, 10 minutes, 10 milliseconds.

void SetTime(int nHour,int nMinute,int nSecond,int nMillisecond)



// Set oDetector to have detected oTrap.

int SetTrapDetectedBy(object oTrap, object oDetector)



// Disable oTrap.

// - oTrap: a placeable, door or trigger.

void SetTrapDisabled(object oTrap)



// Set the weather for oTarget.

// - oTarget: if this is GetModule(), all outdoor areas will be modified by the

// weather constant. If it is an area, oTarget will play the weather only if

// it is an outdoor area.

// - nWeather: WEATHER_*

// -> WEATHER_USER_AREA_SETTINGS will set the area back to random weather.

// -> WEATHER_CLEAR, WEATHER_RAIN, WEATHER_SNOW will make the weather go to

// the appropriate precipitation *without stopping*.

void SetWeather(object oTarget, int nWeather)



// Sets oCreature's experience to nXpAmount.

void SetXP(object oCreature, int nXpAmount)



// Cause oObject to run evToRun

void SignalEvent(object oObject, event evToRun)



// Maths operation: sine of fValue

float sin(float fValue)



// Play oSound.

void SoundObjectPlay(object oSound)



// Set the position of oSound.

void SoundObjectSetPosition(object oSound, vector vPosition)



// Set the volume of oSound.

// - oSound

// - nVolume: 0-127

void SoundObjectSetVolume(object oSound, int nVolume)



// Stop playing oSound.

void SoundObjectStop(object oSound)



// Immediately speak a conversation one-liner.

// - sDialogResRef

// - oTokenTarget: This must be specified if there are creature-specific tokens

// in the string.

void SpeakOneLinerConversation(string sDialogResRef="", object oTokenTarget=OBJECT_TYPE_INVALID)



// The caller will immediately speak sStringToSpeak (this is different from

// ActionSpeakString)

// - sStringToSpeak

// - nTalkVolume: TALKVOLUME_*

void SpeakString(string sStringToSpeak, int nTalkVolume=TALKVOLUME_TALK)



// Maths operation: square root of fValue

// * Returns zero if fValue <0

float sqrt(float fValue)



talent StartAttackLoop()



// Shut down the currently loaded module and start a new one (moving all

// currently-connected players to the starting point.

void StartNewModule(string sModuleName)



talent StartProtectionLoop()



// Convert sNumber into a floating point number.

float StringToFloat(string sNumber)



// Convert sNumber into an integer.

int StringToInt(string sNumber)



// Summon an Animal Companion

void SummonAnimalCompanion(object oMaster=OBJECT_SELF)



// Summon a Familiar

void SummonFamiliar(object oMaster=OBJECT_SELF)



// Set the subtype of eEffect to Supernatural and return eEffect.

// (Effects default to magical if the subtype is not set)

effect SupernaturalEffect(effect eEffect)



// Use this on an NPC to cause all creatures within a 10-metre radius to stop

// what they are doing and sets the NPC's enemies within this range to be

// neutral towards the NPC for roughly 3 minutes. If this command is run on a PC

// or an object that is not a creature, nothing will happen.

void SurrenderToEnemies()



// Take nAmount of gold from oCreatureToTakeFrom.

// - nAmount

// - oCreatureToTakeFrom: If this is not a valid creature, nothing will happen.

// - bDestroy: If this is TRUE, the caller will not get the gold. Instead, the

// gold will be destroyed and will vanish from the game.

void TakeGoldFromCreature(int nAmount, object oCreatureToTakeFrom, int bDestroy=FALSE)



int TalentAdvancedBuff(float fDistance)



int TalentAdvancedProtectSelf()



int TalentBardSong()



int TalentBuffSelf()



int TalentCureCondition()



int TalentDragonCombat(object oIntruder = OBJECT_INVALID)



int TalentEnhanceOthers()



// Create a Feat Talent.

// - nFeat: FEAT_*

talent TalentFeat(int nFeat)



int TalentFlee(object oIntruder = OBJECT_INVALID)



int TalentHeal(int nForce = FALSE)



int TalentHealingSelf()



int TalentMeleeAttack(object oIntruder = OBJECT_INVALID)



int TalentMeleeAttacked(object oIntruder = OBJECT_INVALID)



int TalentPersistentAbilities()



int TalentRangedAttackers(object oIntruder = OBJECT_INVALID)



int TalentRangedEnemies(object oIntruder = OBJECT_INVALID)



int TalentSeeInvisible()



// Create a Skill Talent.

// - nSkill: SKILL_*

talent TalentSkill(int nSkill)



int TalentSneakAttack()



// Create a Spell Talent.

// - nSpell: SPELL_*

talent TalentSpell(int nSpell)



int TalentSpellAttack(object oIntruder)



int TalentSummonAllies()



int TalentUseEnhancementOnSelf()



//CURRENT TALENT FUNCTIONS

int TalentUseProtectionOnSelf()



int TalentUseProtectionOthers()



int TalentUseTurning()



// Maths operation: tan of fValue

float tan(float fValue)



// * Returns TRUE if sStringToTest matches sPattern.

int TestStringAgainstPattern(string sPattern, string sStringToTest)



// The caller will perform a Melee Touch Attack on oTarget

// This is not an action, and it assumes the caller is already within range of

// oTarget

// * Returns 0 on a miss, 1 on a hit and 2 on a critical hit

int TouchAttackMelee(object oTarget, int bDisplayFeedback=TRUE)



// The caller will perform a Ranged Touch Attack on oTarget

// * Returns 0 on a miss, 1 on a hit and 2 on a critical hit

int TouchAttackRanged(object oTarget, int bDisplayFeedback=TRUE)



// Convert nTurns into a number of seconds

// A turn is always 60.0 seconds

float TurnsToSeconds(int nTurns)



int UniversalSpellMatch(talent tUse)



// Create a vector with the specified values for x, y and z

vector Vector(float x=0.0f, float y=0.0f, float z=0.0f)



// Get the magnitude of vVector; this can be used to determine the

// distance between two points.

// * Return value on error: 0.0f

float VectorMagnitude(vector vVector)



// Normalize vVector

vector VectorNormalize(vector vVector)



// Convert vVector to an angle

float VectorToAngle(vector vVector)



int VerifyCombatMeleeTalent(talent tUse, object oTarget)



int VerifyDisarm(talent tUse, object oTarget)



// Set eEffect to be versus a specific alignment.

// - eEffect

// - nLawChaos: ALIGNMENT_LAWFUL/ALIGNMENT_CHAOTIC/ALIGNMENT_ALL

// - nGoodEvil: ALIGNMENT_GOOD/ALIGNMENT_EVIL/ALIGNMENT_ALL

effect VersusAlignmentEffect(effect eEffect, int nLawChaos=ALIGNMENT_ALL, int nGoodEvil=ALIGNMENT_ALL)



// Set eEffect to be versus nRacialType.

// - eEffect

// - nRacialType: RACIAL_TYPE_*

effect VersusRacialTypeEffect(effect eEffect, int nRacialType)



// Set eEffect to be versus traps.

effect VersusTrapEffect(effect eEffect)



//* Declarations

void CreateGenericExotic(object oTarget, object oAdventurer, int nModifier = 0)



void WalkWayPoints(int nRun = FALSE, float fPause = 1.0)



// Does a Will Save check for the given DC

// - oCreature

// - nDC: Difficulty check

// - nSaveType: SAVING_THROW_TYPE_*

// - oSaveVersus

// Returns: 0 if the saving throw roll failed

// Returns: 1 if the saving throw roll succeeded

// Returns: 2 if the target was immune to the save type specified

int WillSave(object oCreature, int nDC, int nSaveType=SAVING_THROW_TYPE_NONE, object oSaveVersus=OBJECT_SELF)



// Write sLogEntry as a timestamped entry into the log file

void WriteTimestampedLogEntry(string sLogEntry)



// Convert fYards into a number of meters.

float YardsToMeters(float fYards)

2