Indent by 2 spaces for each level of nesting ( Do not use tabs!. )
An indented section is only run if the last function proceeded ( eg. didn't fail )
Order of operations are read from left to the right
Only the tmp* variable can be set, others only read
Don't do something like tmpx = -tmpy... Instead do tmpx = 0-tmpy...
Each script runs from top to bottom, 50 times per second
Commenting actually works in script files ( Use //)
Script errors are logged into log.txt (Located under main folder).
An AI script cannot have more than 2560 lines (Which should be more than enough).
Last updated: 16-05-2009
SOME SCRIPTS MAY ONLY WORK IN LATER VERISONS
SCRIPT FUNCTIONS
Code: Select all
--------------------------------------------------------------------------------
IfSpawned
// This function proceeds if the character was spawned this update
--------------------------------------------------------------------------------
IfTimeOut
// This function proceeds if the character's aitime is 0... Use
// in conjunction with SetTime
--------------------------------------------------------------------------------
IfAtWaypoint
// This function proceeds if the character reached its waypoint this
// update
--------------------------------------------------------------------------------
IfAtLastWaypoint
// This function proceeds if the character reached its last waypoint this
// update
--------------------------------------------------------------------------------
IfPutAway
// This function proceeds if the character ( an item ) was put in its
// owner's pocket this update
--------------------------------------------------------------------------------
IfAttacked
// This function proceeds if the character sustained more than a point of
// damage this update
--------------------------------------------------------------------------------
IfBumped
// This function proceeds if the character was bumped by another character
// this update
--------------------------------------------------------------------------------
IfOrdered
// This function proceeds if the character got an order from another
// character on its team this update
--------------------------------------------------------------------------------
IfCalledForHelp
// This function proceeds if one of the character's teammates was nearly
// killed this update
--------------------------------------------------------------------------------
SetContent
// This function sets the content variable... Used in conjunction with
// GetContent... Content is preserved from update to update
tmpargument = 5
SetContent
--------------------------------------------------------------------------------
IfKilled
// This function proceeds if the character was killed this update
--------------------------------------------------------------------------------
IfTargetKilled
// This function proceeds if the character's target from last update was
// killed during this update
--------------------------------------------------------------------------------
ClearWaypoints
// This function is used to move a character around... Do this before
// AddWaypoint
--------------------------------------------------------------------------------
AddWaypoint
// This function tells the character where to move next
ClearWaypoints
tmpx = targetx
tmpy = targety
AddWaypoint
--------------------------------------------------------------------------------
FindPath
//This function makes life easier through setting tmpx, tmpy, tmpturn, waypoints
//tmpdistance and movement speed automatically. You only need to specify
//which type of movement you want. You also might want to clear
//existing waypoints. Movement modes are set in tmpdistance as constants.
SetTargetToWideEnemy
ClearWaypoints
tmpdistance = MOVECHARGE
FindPath //Charge the found enemy
Else
SetTargetToLeader
ClearWaypoints
tmpdistance = MOVEFOLLOW
FindPath //Follow the leader
--------------------------------------------------------------------------------
Compass
// This function modifies tmpx and tmpy, depending on the setting of
// tmpdistance and tmpturn. It acts like one of those Compass thing
// with the two little needle legs
tmpx = selfx
tmpy = selfy
tmpturn = selfturn
tmpdistance = 500
Compass
// tmpx and tmpy are now 500 units in front of the character
--------------------------------------------------------------------------------
GetTargetArmorPrice
// This function returns the cost of the desired skin upgrade, setting
// tmpx to the price
tmpargument = 0 // Find price for skin0.bmp
GetTargetArmorPrice
--------------------------------------------------------------------------------
SetTime
// This function sets the character's time... 50 clicks per second...
// Used in conjunction with IfTimeOut
tmpargument = 200
SetTime
--------------------------------------------------------------------------------
GetContent
// This function sets tmpargument to the character's content variable...
// Used in conjunction with SetContent, or as a NOP to space out an Else
--------------------------------------------------------------------------------
JoinTargetTeam
// This function lets a character join a different team... Used
// mostly for pets
--------------------------------------------------------------------------------
SetTargetToNearbyEnemy
// This function sets the target to a nearby enemy, failing if there are none
--------------------------------------------------------------------------------
SetTargetToTargetLeftHand
// This function sets the target to the item in the target's left hand,
// failing if the target has no left hand item
--------------------------------------------------------------------------------
SetTargetToTargetRightHand
// This function sets the target to the item in the target's right hand,
// failing if the target has no right hand item
--------------------------------------------------------------------------------
SetTargetToWhoeverAttacked
// This function sets the target to whoever attacked the character last...
IfAttacked
SetTargetToWhoeverAttacked
--------------------------------------------------------------------------------
SetTargetToWhoeverHealed
// This function sets the target to whoever attacked the character last...
// Sometimes, attacks actually heal the character, so it makes more sense
// to use this instead of the above function...
IfHealed
SetTargetToWhoeverHealed
--------------------------------------------------------------------------------
SetTargetToWhoeverBumped
// This function sets the target to whoever bumped the character last...
IfBumped
SetTargetToWhoeverBumped
--------------------------------------------------------------------------------
SetTargetToWhoeverCalledForHelp
// This function sets the target to whoever called for help last...
IfCalledForHelp
SetTargetToWhoeverCalledForHelp
--------------------------------------------------------------------------------
SetTargetToOldTarget
// This function sets the target to the target from last update, used to
// undo other SetTarget functions
SetTargetToNearbyEnemy
tmpargument = [HUMA]
IfTargetHasID
SetTargetToOldTarget
--------------------------------------------------------------------------------
SetTurnModeToVelocity
// This function sets the character's movement mode to the default
--------------------------------------------------------------------------------
SetTurnModeToWatch
// This function makes the character look at its next waypoint, usually
// used with close waypoints or the Stop function
--------------------------------------------------------------------------------
SetTurnModeToSpin
// This function makes the character spin around in a circle, usually
// used for magical items and such
--------------------------------------------------------------------------------
SetBumpHeight
// This function makes the character taller or shorter, usually used when
// the character dies
IfKilled
tmpargument = 45
SetBumpHeight
--------------------------------------------------------------------------------
IfTargetHasID
// This function proceeds if the target has either a parent or type IDSZ
// matching tmpargument...
tmpargument = [HUMA]
IfTargetHasID
KillTarget
--------------------------------------------------------------------------------
IfTargetHasItemID
// This function proceeds if the target has a matching item in his/her
// pockets or hands.
tmpargument = [SWOR]
IfTargetHasItemID
KillTarget
--------------------------------------------------------------------------------
IfTargetHoldingItemID
// This function proceeds if the target has a matching item in his/her
// hands. It also sets tmpargument to the proper latch button to press
// to use that item
tmpargument = [SWOR]
IfTargetHoldingItemID
PressLatch
--------------------------------------------------------------------------------
IfTargetHasSkillID
// This function proceeds if the target has a matching skill IDSZ
tmpargument = [DISA]
IfTargetHasSkillID
DoNothing //Used because you need some padding before an Else
Else
KillTarget
--------------------------------------------------------------------------------
Else
// This function proceeds if the last function failed... Need padding
// before it... See the above function for an example...
--------------------------------------------------------------------------------
Run
// This function sets the character's maximum acceleration to its
// actual maximum
--------------------------------------------------------------------------------
Walk
// This function sets the character's maximum acceleration to 66%
// of its actual maximum
--------------------------------------------------------------------------------
Sneak
// This function sets the character's maximum acceleration to 33%
// of its actual maximum
--------------------------------------------------------------------------------
DoAction
// This function makes the character do a given action if it isn't doing
// anything better. Fails if the character is busy.
tmpargument = ACTIONDB
DoAction
--------------------------------------------------------------------------------
KeepAction
// This function makes the character's animation stop on its last frame
// and stay there... Usually used for dropped items
--------------------------------------------------------------------------------
IssueOrder
// This function tells all of the character's teammates to do something,
// though each teammate needs to interpret the order using IfOrdered in
// its own script...
SetTargetToNearbyEnemy
tmpargument = 5 // The type of order
IssueOrder
--------------------------------------------------------------------------------
DropWeapons
// This function drops the character's in-hand items... It will also
// buck the rider if the character is a mount
--------------------------------------------------------------------------------
TargetDoAction
// The function makes the target do a specific action
tmpargument = ACTIONMG
TargetDoAction
--------------------------------------------------------------------------------
OpenPassage
// This function allows movement over the given passage area. Passage
// areas are defined in passage.txt. Fails if the passage is already open
tmpargument = passage // passage is set in spawn.txt for the given character
OpenPassage
--------------------------------------------------------------------------------
ClosePassage
// This function prohibits movement over the given passage area, proceeding
// if the passage isn't blocked. Crushable characters within the passage
// are crushed.
tmpargument = passage
ClosePassage
tmpargument = 0
SendMessage
--------------------------------------------------------------------------------
IfPassageOpen
// This function proceeds if the given passage is open to movement... Used
// mostly by door characters to tell them when to run their open animation.
tmpargument = 2 // Check passage 2
IfPassageOpen
tmpargument = ACTIONMA
DoAction
--------------------------------------------------------------------------------
GoPoof
// This function removes the character from the game entirely... This
// doesn't work on players
IfCrushed
GoPoof
--------------------------------------------------------------------------------
CostTargetItemID
// This function proceeds if the target has a matching item, and poofs
// that item... For one use keys and such
IfBumped
SetTargetToWhoeverBumped
tmpargument = [KEYA]
CostTargetItemID
tmpargument = passage
OpenPassage
--------------------------------------------------------------------------------
DoActionOverride
// This function makes the character do a given action no matter what
tmpargument = ACTIONDB
DoAction
--------------------------------------------------------------------------------
IfHealed
// This function proceeds if the character was healed by a healing particle
--------------------------------------------------------------------------------
SendMessage
// This function sends a message... All players will see the message
tmpargument = MESSAGEDEATH
SendMessage
--------------------------------------------------------------------------------
CallForHelp
// This function calls all of the character's teammates for help... The
// teammates must use IfCalledForHelp in their scripts
--------------------------------------------------------------------------------
AddIDSZ
// This function slaps an expansion IDSZ onto the module description...
// Used to show completion of special quests for a given module
tmpargument = [QUES]
AddIDSZ
--------------------------------------------------------------------------------
End
// This is the last function in a script
--------------------------------------------------------------------------------
SetState
// This function sets the character's state... VERY IMPORTANT...
// State is preserved from update to update
tmpargument = 5
SetState
--------------------------------------------------------------------------------
GetState
// This function sets tmpargument to the character's state...
--------------------------------------------------------------------------------
IfStateIs
// This function proceeds if the character's state equals tmpargument
tmpargument = 1
IfStateIs
tmpargument = ACTIONMG
DoAction
--------------------------------------------------------------------------------
IfTargetCanOpenStuff
// This function proceeds if the target can open stuff ( set in data.txt )
// Used by chests and buttons and such so only "smart" creatures can operate
// them
--------------------------------------------------------------------------------
IfGrabbed
// This function proceeds if the character was grabbed this update...
// Used mostly by item characters
--------------------------------------------------------------------------------
IfMounted
// This function proceeds if a rider jumped on the character's back this
// update
--------------------------------------------------------------------------------
IfDropped
// This function proceeds if the character was dropped this update...
// Used mostly by item characters
--------------------------------------------------------------------------------
IfDismounted
// This function proceeds if the character's rider jumped off this update...
--------------------------------------------------------------------------------
SetTargetToWhoeverIsHolding
// This function sets the target to the character's holder or mount,
// failing if the character is not held
--------------------------------------------------------------------------------
DamageTarget
// This function damages the target
tmpargument = rand & 4095 + 2048
DamageTarget
--------------------------------------------------------------------------------
IfXIsLessThanY
// This function proceeds if tmpx is less than tmpy...
tmpx = 0
tmpy = 1
IfXIsLessThanY
DebugMessage
--------------------------------------------------------------------------------
IfYIsMoreThanX
// This function proceeds if tmpy is more than tmpx...
tmpx = 0
tmpy = 1
IfYIsMoreThanX
DebugMessage
--------------------------------------------------------------------------------
SetWeatherTime
// This function can be used to slow down or speed up or stop rain and
// other weather effects
tmpargument = 0
SetWeatherTime
--------------------------------------------------------------------------------
GetBumpHeight
// This function sets tmpargument to the character's height
--------------------------------------------------------------------------------
IfReaffirmed
// This function proceeds if the character was damaged by its reaffirm
// damage type... Used to relight the torch...
--------------------------------------------------------------------------------
UnkeepAction
// This function undoes KeepAction
--------------------------------------------------------------------------------
IfTargetIsOnOtherTeam
// This function proceeds if the target is on another team
--------------------------------------------------------------------------------
IfTargetIsOnHatedTeam
// This function proceeds if the target is on an enemy team
--------------------------------------------------------------------------------
PressLatchButton
// This function emulates joystick button presses
tmpargument = LATCHBUTTONLEFT
PressLatchButton
--------------------------------------------------------------------------------
SetTargetToTargetOfLeader
// This function sets the target to the team's leader's target
--------------------------------------------------------------------------------
IfLeaderKilled
// This function proceeds if the team's leader died this update
--------------------------------------------------------------------------------
BecomeLeader
// This function makes the character the leader of the team
--------------------------------------------------------------------------------
ChangeTargetArmor
// This function sets the armor type of the target... Used for chests
// Sets tmpargument as the old type and tmpx as the new type
tmpargument = 0
ChangeTargetArmor
--------------------------------------------------------------------------------
GiveMoneyToTarget
// This function increases the target's money, while decreasing the
// character's own money. tmpargument is set to the amount transferred
tmpargument = 50
GiveMoneyToTarget
--------------------------------------------------------------------------------
DropKeys
// This function drops all of the keys in the character's inventory.
// This does NOT drop keys in the character's hands.
--------------------------------------------------------------------------------
IfLeaderIsAlive
// This function proceeds if the team has a leader
--------------------------------------------------------------------------------
IfTargetIsOldTarget
// This function proceeds if the target is the same as it was last update
--------------------------------------------------------------------------------
SetTargetToLeader
// This function sets the target to the leader, proceeding if their is
// a valid leader for the character's team
--------------------------------------------------------------------------------
SpawnCharacter
// This function spawns a character of the same type as the spawner...
// This is horribly complicated to use, so see ANIMATE.OBJ for an example
// tmpx and tmpy give the coodinates, tmpturn gives the new character's
// direction, and tmpdistance gives the new character's initial velocity
tmpx = selfx + 100
tmpy = selfy
tmpturn = selfturn
tmpdistance = 0
SpawnCharacter
--------------------------------------------------------------------------------
RespawnCharacter
// This function respawns the character at its starting location...
// Often used with the Clean functions
IfCleanedUp
RespawnCharacter
--------------------------------------------------------------------------------
ChangeTile
// This function changes the tile under the character to the new tile type,
// which is highly module dependent
tmpargument = 50
ChangeTile
--------------------------------------------------------------------------------
IfUsed
// This function proceeds if the character was used by its holder or rider...
// Character's cannot be used if their reload time is greater than 0
--------------------------------------------------------------------------------
DropMoney
// This function drops a certain amount of money, if the character has that
// much
tmpargument = 1
DropMoney
--------------------------------------------------------------------------------
SetOldTarget
// This function sets the old target to the current target... To allow
// greater manipulations of the target
SetOldTarget
SetTargetToNearbyEnemy
tmpx = targetx
tmpy = targety
SetTargetToOldTarget
--------------------------------------------------------------------------------
DetachFromHolder
// This function drops the character or makes it get off its mount
// Can be used to make slippery weapons, or to make certain characters
// incapable of wielding certain weapons... A troll can't grab a torch...
--------------------------------------------------------------------------------
IfTargetHasVulnerabilityID
// This function proceeds if the target is vulnerable to the given IDSZ...
tmpargument = [SILV]
IfTargetHasVulnerabilityID
tmpargument = 0
SendMessageNear
--------------------------------------------------------------------------------
CleanUp
// This function tells all the dead characters on the team to clean
// themselves up... Usually done by the boss creature every second or so
--------------------------------------------------------------------------------
IfCleanedUp
// This function proceeds if the character is dead and if the boss told it
// to clean itself up
IfCleanedUp
RespawnCharacter
--------------------------------------------------------------------------------
IfSitting
// This function proceeds if the character is riding a mount
--------------------------------------------------------------------------------
IfHeld
// This function proceeds if the character is held by another character
--------------------------------------------------------------------------------
IfTargetIsHurt
// This function proceeds if the target has lost more than a point of life
--------------------------------------------------------------------------------
IfTargetIsAPlayer
// This function proceeds if the target is controlled by a human
--------------------------------------------------------------------------------
PlaySound
// This function plays one of the character's sounds... The sound fades
// out depending on its distance from the viewer
tmpargument = 0 // sound0.wav
tmpdistance = 11025 // the frequency
PlaySound
--------------------------------------------------------------------------------
SpawnParticle
// This function spawns a particle, offset from the character's location
tmpargument = 0 // part0.txt
tmpdistance = GRIPLEFT // Offset from the character's left hand
tmpx = 100 // Offset amount
tmpy = 100 // Offset amount
SpawnParticle
--------------------------------------------------------------------------------
IfTargetIsAlive
// This function proceeds if the target is alive
--------------------------------------------------------------------------------
Stop
// This function sets the character's maximum acceleration to 0... Used
// along with Walk and Run and Sneak
--------------------------------------------------------------------------------
DisaffirmCharacter
// This function removes all the attached particles from a character
// ( stuck arrows, flames, etc )
--------------------------------------------------------------------------------
ReaffirmCharacter
// This function makes sure it has all of its reaffirmation particles
// attached to it... Used to make the torch light again
--------------------------------------------------------------------------------
IfTargetIsSelf
// This function proceeds if the character is targeting itself
--------------------------------------------------------------------------------
IfTargetIsMale
// This function proceeds if the target is male
--------------------------------------------------------------------------------
IfTargetIsFemale
// This function proceeds if the target is female
--------------------------------------------------------------------------------
SetTargetToSelf
// This function sets the target to the character itself
--------------------------------------------------------------------------------
SetTargetToRider
// This function sets the target to whoever is riding the character,
// failing if there is no rider
--------------------------------------------------------------------------------
GetAttackTurn
// This function sets tmpturn to the direction from which the last attack
// came... Not particularly useful in most cases, but it could be...
IfAttacked
GetAttackTurn
tmpdistance = 500
tmpx = selfx
tmpy = selfy
Compass
ClearWaypoints
AddWaypoint
--------------------------------------------------------------------------------
GetDamageType
// This function sets tmpargument to the damage type of the last attack that
// hit the character
IfAttacked
GetDamageType
tmpx = tmpargument
tmpy = DAMAGESLASH
IfXIsEqualToY
tmpargument = 0
SendMessageNear
--------------------------------------------------------------------------------
BecomeSpell
// This function turns a spellbook character into a spell... TOO COMPLICATED
// TO EXPLAIN... SHOULDN'T EVER BE NEEDED BY YOU...
--------------------------------------------------------------------------------
BecomeSpellbook
// This function turns a spell character into a spellbook... TOO COMPLICATED
// TO EXPLAIN... Just copy the spells that already exist, and don't change
// them too much
--------------------------------------------------------------------------------
IfScoredAHit
// This function proceeds if the character damaged another character this
// update...
--------------------------------------------------------------------------------
IfDisaffirmed
// This function proceeds if the character was disaffirmed... This doesn't
// seem useful anymore...
--------------------------------------------------------------------------------
TranslateOrder
// This function translates a packed order into understandable values...
// See CreateOrder for more... This function sets tmpx, tmpy, tmpargument,
// and possibly sets the target ( which may not be good )
IfOrdered
SetOldTarget // Save the current target
TranslateOrder
SetTargetToOldTarget // Make sure the target doesn't change
SetState
--------------------------------------------------------------------------------
SetTargetToWhoeverWasHit
// This function sets the target to whoever was hit by the character last
IfScoredAHit
SetTargetToWhoeverWasHit
IfTargetIsOnSameTeam
tmpargument = 0
SendMessageNear // Sorry 'bout that...
--------------------------------------------------------------------------------
SetTargetToWideEnemy
// This function sets the target to an enemy in the vicinity around the
// character, failing if there are none
--------------------------------------------------------------------------------
IfChanged
// This function proceeds if the character has changed shape... Needed
// for morph spells and such
--------------------------------------------------------------------------------
IfInWater
// This function proceeds if the character has just entered into some water
// this update ( and the water is really water, not fog or another effect )
--------------------------------------------------------------------------------
IfBored
// This function proceeds if the character has been standing idle too long
--------------------------------------------------------------------------------
IfTooMuchBaggage
// This function proceeds if the character tries to put an item in his/her
// pockets, but the character already has 6 items in the inventory...
// Used to tell the players what's going on...
--------------------------------------------------------------------------------
IfGrogged
// This function proceeds if the character has been grogged ( a type of
// confusion ) this update
--------------------------------------------------------------------------------
IfDazed
// This function proceeds if the character has been dazed ( a type of
// confusion ) this update
--------------------------------------------------------------------------------
IfTargetHasSpecialID
// This function proceeds if the character has a special IDSZ ( in data.txt )
tmpargument = [GOOD]
IfTargetHasSpecialID
tmpargument = 0
SendMessageNear
--------------------------------------------------------------------------------
PressTargetLatchButton
// This function mimics joystick button presses for the target...
// For making items force their own usage and such
tmpargument = LATCHLEFT
PressTargetLatchButton
--------------------------------------------------------------------------------
IfInvisible
// This function proceeds if the character is invisible
--------------------------------------------------------------------------------
IfArmorIs
// This function proceeds if the character's skin type equals tmpargument
tmpargument = 1
IfArmorIs
tmpargument = 0
SendMessageNear
--------------------------------------------------------------------------------
GetTargetGrogTime
// This function sets tmpargument to the number of updates before the
// character is ungrogged, proceeding if the number is greater than 0
--------------------------------------------------------------------------------
GetTargetDazeTime
// This function sets tmpargument to the number of updates before the
// character is undazed, proceeding if the number is greater than 0
--------------------------------------------------------------------------------
SetDamageType
// This function lets a weapon change the type of damage it inflicts
tmpargument = DAMAGESLASH
SetDamageType
--------------------------------------------------------------------------------
SetWaterLevel
// This function raises or lowers the water in the module
tmpargument = 100
SetWaterLevel
--------------------------------------------------------------------------------
EnchantTarget
// This function enchants the target with the enchantment given
// in enchant.txt... Make sure you use SetOwnerToTarget before
// doing this...
SetTargetToWhoeverIsHolding
SetOwnerToTarget
EnchantTarget
--------------------------------------------------------------------------------
EnchantChild
// This function enchants the last character spawned with the enchantment
// given in enchant.txt... Make sure you use SetOwnerToTarget before
// doing this...
--------------------------------------------------------------------------------
TeleportTarget
// This function makes the target move instantly to the x, y location
SetTargetToNearestEnemy
tmpx = selfx - 200
tmpy = selfy - 200
TeleportTarget
--------------------------------------------------------------------------------
GiveExperienceToTarget
// This function gives experience to the target
tmpargument = 40 // The base amount of experience
tmpdistance = EXPROLEPLAY // The type of experience
GiveExperienceToTarget
--------------------------------------------------------------------------------
IncreaseAmmo
// This function increases the character's ammo by 1
--------------------------------------------------------------------------------
UnkurseTarget
// This function unkurses the target
--------------------------------------------------------------------------------
GiveExperienceToTargetTeam
// This function gives experience to everyone on the target's team
tmpargument = 40 // The base amount of experience
tmpdistance = EXPQUEST // The type of experience
GiveExperienceToTargetTeam
--------------------------------------------------------------------------------
IfUnarmed
// This function proceeds if the character is holding no items in hand...
--------------------------------------------------------------------------------
RestockTargetAmmoIDAll
// This function restocks the ammo of all of the target's items, if those
// items have a matching parent or type IDSZ
tmpargument = [XBOW]
RestockTargetAmmoIDAll
--------------------------------------------------------------------------------
RestockTargetAmmoIDFirst
// This function restocks the ammo of the first of the target's items that
// matches the IDSZ
tmpargument = [LBOW]
RestockTargetAmmoIDFirst
--------------------------------------------------------------------------------
FlashTarget
// This function makes the target flash
--------------------------------------------------------------------------------
SetRedShift
// This function sets the character's red shift ( 0 - 3 ), higher values
// making the character less red and darker
tmpargument = 3
SetRedShift
--------------------------------------------------------------------------------
SetGreenShift
// This function sets the character's red shift ( 0 - 3 ), higher values
// making the character less green and darker
tmpargument = 1
SetGreenShift
--------------------------------------------------------------------------------
SetBlueShift
// This function sets the character's red shift ( 0 - 3 ), higher values
// making the character less blue and darker
tmpargument = 2
SetBlueShift
--------------------------------------------------------------------------------
SetLight
// This function alters the character's transparency ( 0 - 255 )
tmpargument = 128
SetLight
--------------------------------------------------------------------------------
SetAlpha
// This function alters the character's transparency ( 0 - 255 )
tmpargument = 128
SetLight
--------------------------------------------------------------------------------
IfHitFromBehind
// This function proceeds if the last attack to the character came
// from behind
IfAttacked
IfHitFromBehind
tmpargument = ACTIONHA
DoActionOverride
--------------------------------------------------------------------------------
IfHitFromFront
// This function proceeds if the last attack to the character came
// from the front
IfAttacked
IfHitFromFront
tmpargument = ACTIONHB
DoActionOverride
--------------------------------------------------------------------------------
IfHitFromLeft
// This function proceeds if the last attack to the character came
// from the left
IfAttacked
IfHitFromLeft
tmpargument = ACTIONHC
DoActionOverride
--------------------------------------------------------------------------------
IfHitFromRight
// This function proceeds if the last attack to the character came
// from the right
IfAttacked
IfHitFromRight
tmpargument = ACTIONHD
DoActionOverride
--------------------------------------------------------------------------------
IfTargetIsOnSameTeam
// This function proceeds if the target is on the character's team
--------------------------------------------------------------------------------
KillTarget
// This function kills the target
--------------------------------------------------------------------------------
UndoEnchant
// This function removes the last enchantment spawned by the character,
// proceeding if an enchantment was removed
--------------------------------------------------------------------------------
GetWaterLevel
// This function sets tmpargument to the current water level * 10...
// A waterlevel in wawalight of 85 would set tmpargument to 850
GetWaterLevel
tmpargument = tmpargument - 1
SetWaterLevel
--------------------------------------------------------------------------------
CostTargetMana
// This function costs the target a specific amount of mana, proceeding
// if the target was able to pay the price... The amounts are * 256
tmpargument = 256 // Cost one point of mana
CostTargetMana
tmpargument = 0
SendMessageNear
--------------------------------------------------------------------------------
IfTargetHasAnyID
// This function proceeds if the target has any IDSZ that matches the given
// one
tmpargument = [XFIR]
IfTargetHasAnyID
tmpargument = 0
SendMessageNear
--------------------------------------------------------------------------------
SetBumpSize
// This function sets the how wide the character is
tmpargument = 60
SetBumpSize
--------------------------------------------------------------------------------
IfNotDropped
// This function proceeds if the character is kursed and another character
// was holding it and tried to drop it
--------------------------------------------------------------------------------
IfYIsLessThanX
// This function proceeds if tmpy is less than tmpx
tmpx = 1
tmpy = 0
IfXIsLessThanY
DebugMessage
--------------------------------------------------------------------------------
IfXIsMoreThanY
// This function proceeds if tmpx is more than tmpy
tmpx = 1
tmpy = 0
IfXIsLessThanY
DebugMessage
--------------------------------------------------------------------------------
SetFlyHeight
// This function makes the character fly ( or fall to ground if 0 )
tmpargument = 50
SetFlyHeight
--------------------------------------------------------------------------------
IfBlocked
// This function proceeds if the character blocked the attack of another
// character this update
--------------------------------------------------------------------------------
IfTargetIsDefending
// This function proceeds if the target is holding up a shield or similar
// defense
--------------------------------------------------------------------------------
IfTargetIsAttacking
// This function proceeds if the target is doing an attack action
--------------------------------------------------------------------------------
IfStateIs0
IfStateIsParry // Same as 0
IfStateIs1
IfStateIsWander // Same as 1
IfStateIs2
IfStateIsGuard // Same as 2
IfStateIs3
IfStateIsFollow // Same as 3
IfStateIs4
IfStateIsSurround // Same as 4
IfStateIs5
IfStateIsRetreat // Same as 5
IfStateIs6
IfStateIsCharge // Same as 6
IfStateIs7
IfStateIsCombat // Same as 7
IfStateIs8
IfStateIs9
IfStateIs10
IfStateIs11
IfStateIs12
IfStateIs13
IfStateIs14
IfStateIs15
// These functions proceed if the state matches
--------------------------------------------------------------------------------
IfContentIs
// This function proceeds if the content matches tmpargument
tmpargument = 0
IfContentIs
tmpargument = 1
SendMessageNear
--------------------------------------------------------------------------------
SetTurnModeToWatchTarget
// This function makes the character face its target, no matter what
// direction it is moving in... Undo this with SetTurnModeToVelocity
--------------------------------------------------------------------------------
IfStateIsNot
// This function proceeds if the character's state does not equal tmpargument
tmpargument = 0
IfStateIsNot
tmpargument = 1
SendMessageNear
--------------------------------------------------------------------------------
IfXIsEqualToY
IfYIsEqualToX
// These functions proceed if tmpx and tmpy are the same
tmpx = 0
tmpy = 0
IfXIsEqualToY
DebugMessage
--------------------------------------------------------------------------------
DebugMessage
// This function spits out some useful numbers
--------------------------------------------------------------------------------
BlackTarget
// The opposite of FlashTarget, causing the target to turn black
--------------------------------------------------------------------------------
SendMessageNear
// This function sends a message to all nearby players
tmpargument = 0 // Message 0
SendMessageNear
--------------------------------------------------------------------------------
IfHitGround
// This function proceeds if a character hit the ground this update...
// Used to determine when to play the sound for a dropped item
--------------------------------------------------------------------------------
IfNameIsKnown
// This function proceeds if the character's name is known
--------------------------------------------------------------------------------
IfUsageIsKnown
// This function proceeds if the character's usage is known
--------------------------------------------------------------------------------
IfHoldingItemID
// This function proceeds if the character is holding a specified item
// in hand, setting tmpargument to the latch button to press to use it
tmpargument = [SWOR]
IfHoldingItemID
PressLatchButton
--------------------------------------------------------------------------------
IfHoldingRangedWeapon
// This function proceeds if the character is holding a specified item
// in hand, setting tmpargument to the latch button to press to use it
IfHoldingRangedWeapon
PressLatchButton
--------------------------------------------------------------------------------
IfHoldingMeleeWeapon
// This function proceeds if the character is holding a specified item
// in hand, setting tmpargument to the latch button to press to use it
IfHoldingMeleeWeapon
tmpargument = tmpargument < 5 // Put it away
PressLatchButton
--------------------------------------------------------------------------------
IfHoldingShield
// This function proceeds if the character is holding a specified item
// in hand, setting tmpargument to the latch button to press to use it...
// The button will need to be held down...
IfHoldingMeleeWeapon
tmpargument = tmpargument < 3 // Drop it on the ground
PressLatchButton
--------------------------------------------------------------------------------
IfKursed
// This function proceeds if the character is kursed
--------------------------------------------------------------------------------
IfTargetIsKursed
// This function proceeds if the target is kursed
--------------------------------------------------------------------------------
IfTargetIsDressedUp
// This function proceeds if the target is dressed in facy clothes
--------------------------------------------------------------------------------
IfOverWater
// This function proceeds if the character is on a water tile
--------------------------------------------------------------------------------
IfThrown
// This function proceeds if the character was thrown this update...
--------------------------------------------------------------------------------
MakeNameKnown
// This function makes the name of the character known, for identifying
// weapons and spells and such
--------------------------------------------------------------------------------
MakeUsageKnown
// This function makes the usage known for this type of object
--------------------------------------------------------------------------------
StopTargetMovement
// This function sets the target's x and y velocities to 0, and
// sets the z velocity to 0 if the character is moving upwards...
// This is a special function for the IronBall object
--------------------------------------------------------------------------------
SetXY
// This function sets one of the 16 permanent storage variable slots
// ( each of which holds an x,y pair )
tmpargument = 0 // slot 0 to 7
tmpx = selfx
tmpy = selfy
SetXY
--------------------------------------------------------------------------------
GetXY
// This function reads one of the 8 permanent storage variable slots,
// setting tmpx and tmpy accordingly
tmpargument = 3 // slot 0 to 7
GetXY
--------------------------------------------------------------------------------
AddXY
// This function alters the contents of one of the 8 permanent storage
// slots
tmpargument = 7 // slot 0 to 7
tmpx = 0
tmpy = 50
SetXY // slot 7 now contains ( 0 and 50 )
tmpx = 100
tmpy = 50
AddXY // slot 7 now contains ( 100 and 100 )
--------------------------------------------------------------------------------
MakeAmmoKnown
// This function makes the character's ammo known ( for items )
--------------------------------------------------------------------------------
SpawnAttachedParticle
// This function spawns a particle attached to the character
tmpargument = 0 // part0.txt
tmpdistance = GRIPRIGHT // the character's right hand
SpawnAttachedParticle
--------------------------------------------------------------------------------
SpawnExactParticle
// This function spawns a particle at a specific x, y, z position
tmpargument = 0 // part0.txt
tmpx = selfx // x
tmpy = selfy // y
tmpdistance = selfz // z
SpawnExactParticle
--------------------------------------------------------------------------------
AccelerateTarget
// This function changes the x and y speeds of the target
tmpx = 10
tmpy = 0
AccelerateTarget
--------------------------------------------------------------------------------
IfDistanceIsMoreThanTurn
// This function proceeds if tmpdistance is more than tmpturn
tmpturn = 0
tmpdistance = 50
IfDistanceIsMoreThanTurn
DebugMessage
--------------------------------------------------------------------------------
IfCrushed
// This function proceeds if the character was crushed in a passage this
// update...
--------------------------------------------------------------------------------
MakeCrushValid
// This function makes a character able to be crushed by closing doors
// and such
--------------------------------------------------------------------------------
SetTargetToLowestTarget
// This function sets the target to the absolute bottom character...
// The holder of the target, or the holder of the holder of the target, or
// the holder of the holder of ther holder of the target, etc...
--------------------------------------------------------------------------------
IfNotPutAway
// This function proceeds if the character couldn't be put into another
// character's pockets for some reasong... It might be kursed or too big
// or something
--------------------------------------------------------------------------------
IfNotTakenOut
// This function proceeds if the character is equiped in another's inventory,
// and the holder tried to unequip it ( take it out of pack ), but the
// item was kursed and didn't cooperate
--------------------------------------------------------------------------------
IfTakenOut
// This function proceeds if the character is removed from another's
// inventory
--------------------------------------------------------------------------------
IfAmmoOut
// This function proceeds if the character itself has no ammo left...
// This is for crossbows and such, not archers...
--------------------------------------------------------------------------------
PlaySoundLooped //!!BAD!! DOESN'T WORK !!BAD!!
// This function starts playing a continuous sound
tmpargument = 0 // sound0.wav
tmpdistance = 8000 // frequency
PlaySoundLooped
--------------------------------------------------------------------------------
StopSound //!!BAD!! DOESN'T WORK !!BAD!!
// This function stops the playing of a continuous sound
tmpargument = 0 // sound0.wav
StopSound
--------------------------------------------------------------------------------
HealSelf
// This function gives life back to the character... Values given as * 256
// This does NOT remove [HEAL] enchants ( poisons )
tmpargument = 256 // One point of life
HealSelf
--------------------------------------------------------------------------------
Equip
// This function flags the character as being equipped... This is used
// by equipment items when they are placed in the inventory
--------------------------------------------------------------------------------
IfTargetHasItemIDEquipped
// This function proceeds if the target already wearing a matching item
tmpargument = [RING]
IfTargetHasItemIDEquipped
tmpargument = 0
SendMessageNear
--------------------------------------------------------------------------------
SetOwnerToTarget
// This function must be called before enchanting anything... The owner
// is the character that pays the sustain costs and such for the enchantment
--------------------------------------------------------------------------------
SetTargetToOwner
// This function sets the target to whoever was previously declared as the
// owner...
--------------------------------------------------------------------------------
SetFrame
// This function sets the .MD2 frame for the character... Values are * 4
tmpargument = 8 // Frame 2
SetFrame
--------------------------------------------------------------------------------
BreakPassage
// This function causes the tiles of a passage to increment if stepped on.
// tmpx and tmpy are both set to the location of whoever broke the tile if
// the function passed...
tmpargument = 20 // The passage to check
tmpturn = 200 // The starting tile type
tmpdistance = 4 // The number of frames ( tiles 200, 201, 202, 203 )
tmpx = 0 // Don't animate
tmpy = FXANIM // Become an animated tile
BreakPassage
DebugMessage // Done every time the tile changes
// Or...
tmpargument = 20 // The passage to check
tmpturn = 200 // Start at tile 200
tmpdistance = 5 // Tiles 200, 201, 202, 203, tmpx
tmpx = 204 // Set it as an animated tile ( 204, 205, 206, 207 )
// Number of animated frames is in WAWALITE.TXT
tmpy = FXANIM + FXWATER + FXDAMAGE
BreakPassage
DebugMessage // Done every time the tile changes
--------------------------------------------------------------------------------
SetReloadTime
// This function stops a character from being used for a while... Used
// by weapons to slow down their attack rate... 50 clicks per second...
tmpargument = 100 // Two seconds
SetReloadTime
--------------------------------------------------------------------------------
SetTargetToWideBlahID
// This function sets the target to a character that matches the description,
// and who is located in the general vicinity of the character
tmpargument = [HUMA]
tmpdistance = BLAHDEAD | BLAHENEMIES
SetTargetToWideBlahID
// Found a dead, humanoid enemy...
DebugMessage
tmpargument = [LUMP]
tmpdistance = BLAHENEMIES | BLAHINVERTID
SetTargetToWideBlahID
// Found a living enemy, who is not a Lumpkin ( morph spell... )
DebugMessage
--------------------------------------------------------------------------------
PoofTarget
// This function removes the target from the game, failing if the
// target is a player
--------------------------------------------------------------------------------
ChildDoActionOverride
// This function lets a character set the action of the last character
// it spawned. It also sets the current frame to the first frame of the
// action ( no interpolation from last frame ).
tmpargument = ACTIONMD
ChildDoActionOverride
--------------------------------------------------------------------------------
SpawnPoof
// This function makes a poof at the character's location... The
// poof form and particle types are set in data.txt
--------------------------------------------------------------------------------
SetSpeedPercent
// This function acts like Run or Walk, except it allows the explicit
// setting of the speed
tmpargument = 33 // 33%... Same as Sneak
SetSpeedPercent
--------------------------------------------------------------------------------
SetChildState
// This function lets a character set the state of the last character it
// spawned
tmpargument = 3
SetChildState
--------------------------------------------------------------------------------
SpawnAttachedSizedParticle
// This function spawns a particle of the specific size attached to the
// character... For spell charging effects
tmpargument = 5 // part5.txt
tmpdistance = GRIPLEFT // in the left hand
tmpturn = 50000
SpawnAttachedSizedParticle
--------------------------------------------------------------------------------
ChangeArmor
// This function changes the character's armor...
// Sets tmpargument as the old type and tmpx as the new type
tmpargument = 1
ChangeArmor
--------------------------------------------------------------------------------
ShowTimer
// This function sets the value displayed by the module timer...
// For races and such... 50 clicks per second
tmpargument = 243
ShowTimer // 00:04:86
--------------------------------------------------------------------------------
IfFacingTarget
// This function proceeds if the character is more or less facing its
// target
--------------------------------------------------------------------------------
SetVolume
// This function modifies the playback volume of a given sound slot as it is
// being played... For fading out loops...
tmpargument = 11 // Slot 11 (BAD! Not sound11.wav)
tmpdistance = 45 // 45% of original playback volume
SetVolume
--------------------------------------------------------------------------------
SpawnAttachedFacedParticle
// This function spawns a particle attached to the character, facing the
// same direction given by tmpturn
tmpargument = 0 // part0.txt
tmpdistance = GRIPRIGHT // the character's right hand
tmpturn = selfturn // face the same direction
SpawnAttachedParticle
--------------------------------------------------------------------------------
IfStateIsOdd
// This function proceeds if the character's state is 1, 3, 5, 7, etc
--------------------------------------------------------------------------------
SetTargetToDistantEnemy
// This function finds a character within a certain distance of the
// character, failing if there are none
tmpdistance = 400000 // square of the radius
SetTargetToDistantEnemy
DebugMessage
--------------------------------------------------------------------------------
Teleport
// This function teleports the character to a new location, failing if
// the location is blocked or off the map
tmpx = rand & 255 - 128 + selfx
tmpy = rand & 255 - 128 + selfy
Teleport
--------------------------------------------------------------------------------
GiveStrengthToTarget
GiveWisdomToTarget
GiveIntelligenceToTarget
GiveDexterityToTarget
GiveLifeToTarget
GiveManaToTarget
// These functions increase the target's permanent stats... Values are * 256
tmpargument = 0 - 128 // Decrease by half a point
GiveStrengthToTarget
--------------------------------------------------------------------------------
ShowMap
// This function shows the module's map... Fails if the map is already visible
--------------------------------------------------------------------------------
ShowYouAreHere
// This function shows the blinking white blip on the map that represents the
// camera location
--------------------------------------------------------------------------------
ShowBlipXY
// This function draws a blip on the map, and must be done each update
tmpx = selfx
tmpy = selfy
tmpargument = GREEN // Color of the blip
ShowBlipXY
--------------------------------------------------------------------------------
HealTarget
// This function gives some life back to the target... Values are * 256
// Any enchantments that are removed by [HEAL], like poison, go away
tmpargument = 2560 // 10 points
HealTarget
--------------------------------------------------------------------------------
PumpTarget
// This function gives some mana back to the target... Values are * 256
tmpargument = 2560 // 10 points
PumpTarget
--------------------------------------------------------------------------------
CostAmmo
// This function costs the character 1 point of ammo
--------------------------------------------------------------------------------
MakeSimilarNamesKnown
// This function makes the names of similar objects known... Checks
// all 6 IDSZ types to make sure they match...
--------------------------------------------------------------------------------
SpawnAttachedHolderParticle
// This function spawns a particle attached to the character's holder
tmpargument = 0 // part0.txt
tmpdistance = GRIPRIGHT // the holder's right hand
SpawnAttachedParticle
--------------------------------------------------------------------------------
SetTargetReloadTime
// This function stops the target from attacking for a while...
// 50 clicks per second
tmpargument = 50
SetTargetReloadTime
--------------------------------------------------------------------------------
SetFogLevel //!!BAD!! DOESN'T WORK !!BAD!!
// This function sets the level of the module's fog... Values are * 10
tmpargument = 840
SetFogLevel
--------------------------------------------------------------------------------
GetFogLevel //!!BAD!! DOESN'T WORK !!BAD!!
// This function sets tmpargument to the level of the module's fog...
// Values are * 10
GetFogLevel
tmpargument = tmpargument - 1
SetFogLevel
--------------------------------------------------------------------------------
SetFogTAD //!!BAD!! DOESN'T WORK !!BAD!!
// This function sets the color of the module's fog... TAD stands for
// turn, argument, distance -> red, green, blue... Makes sense, huh?
tmpturn = 255 // red
tmpargument = 255 // green
tmpdistance = 255 // blue
SetFogTAD
--------------------------------------------------------------------------------
SetFogBottomLevel //!!BAD!! DOESN'T WORK !!BAD!!
// This function sets the level of the module's fog... Values are * 10
tmpargument = 840
SetFogBottomLevel
--------------------------------------------------------------------------------
GetFogBottomLevel //!!BAD!! DOESN'T WORK !!BAD!!
// This function sets tmpargument to the level of the module's fog...
// Values are * 10
GetFogBottomLevel
tmpargument = tmpargument - 1
SetFogBottomLevel
--------------------------------------------------------------------------------
CorrectActionForHand
// This function changes tmpargument according to which hand the character
// is held in ( this is for wizards casting spells )
tmpargument = ACTIONZA // Must be an A... ZA, BA, CA, DA, etc...
CorrectActionForHand // ZA or ZB if in left hand, ZC or ZD if in right
SetTargetToWhoeverIsHolding
TargetDoAction
--------------------------------------------------------------------------------
IfTargetIsMounted
// This function proceeds if the target is riding a mount
--------------------------------------------------------------------------------
SparkleIcon
// This function starts little sparklies going around the character's icon
tmpargument = RED
SparkleIcon
--------------------------------------------------------------------------------
UnsparkleIcon
// This function stops little sparklies going around the character's icon
--------------------------------------------------------------------------------
GetTileXY
// This function sets tmpargument to the tile type at the specified
// coordinates
tmpx = selfx
tmpy = selfy
GetTileXY
--------------------------------------------------------------------------------
SetTileXY
// This function changes the tile type at the specified coordinates
tmpx = selfx
tmpy = selfy
GetTileXY
tmpargument = tmpargument + 1
SetTileXY
--------------------------------------------------------------------------------
SetShadowSize
// This function makes the character's shadow bigger or smaller
tmpargument = 50
SetShadowSize
--------------------------------------------------------------------------------
OrderTarget
// This function issues an order to the given target
tmpargument = 50
OrderTarget
--------------------------------------------------------------------------------
SetTargetToWhoeverIsInPassage
// This function sets the target to whoever is blocking the given passage
tmpargument = passage
SetTargetToWhoeverIsInPassage
KillTarget
--------------------------------------------------------------------------------
IfCharacterWasABook
// Proceeds if the character started life as a book or the spell object...
// USED BY THE MORPH SPELL... Not much use elsewhere
--------------------------------------------------------------------------------
SetEnchantBoostValues
// This function sets the mana and life drains for the last enchantment
// spawned by this character... Values are * 256
tmpargument = 0 - 256 // Cost owner 1 mana per second
tmpdistance = 256 // Give owner 1 life per second
tmpx = 0 // Give target 0 mana per second
tmpy = 0 - 256 // Cost target 1 life per second
SetEnchantBoostValues
--------------------------------------------------------------------------------
SpawnCharacterXYZ
// This function spawns a character of the same type at a specific location
tmpx = selfx // X position of the new character
tmpy = selfy // Y position of the new character
tmpdistance = selfz + 200 // Altitude of the new character
tmpturn = selfturn // facing of the new character
SpawnCharacterXYZ
--------------------------------------------------------------------------------
SpawnExactCharacterXYZ
// This function spawns a character at a specific location, using a
// specific model type... DON'T USE THIS FOR EXPORTABLE ITEMS OR CHARACTERS,
// AS THE MODEL SLOTS MAY VARY FROM MODULE TO MODULE...
tmpargument = 10 // The specific model slot
tmpx = selfx // X position of the new character
tmpy = selfy // Y position of the new character
tmpdistance = selfz + 200 // Altitude of the new character
tmpturn = selfturn // facing of the new character
SpawnExactCharacterXYZ
--------------------------------------------------------------------------------