Scripting: An fairly quick reference
Creature and Object Identification is done through the ObjectType Class.
The IDS file used is Object.ids
ObjectType is arranged as follows
EnemyAlly General
General |
Race |
Class |
Specifics V
Instance Specific
SpecialCase
Eg. [EnemyAlly.General.Race.Class.Specifics.Instance.SpecialCase]
EnemyAlly is a range between the PC and the evil NPCs Creatures can fall anywhere along this range.
The IDS file used is EA.ids
PC refers to any of the possible six party members.
GOODCUTOFF refers to anyone good. Party members, allies, summoned monsters, etc.
GOODBUTBLUE refers to anyone good but with a blue circle.
ENEMY refers to anyone evil, generally red circles.
EVILBUTBLUE refers to anyone evil but with a blue circle.
EVILBUTGREEN refers to anyone evil but with a green circle.
NEUTRAL refers to anyone neutral, generally blue circles.
ANYONE refers to any object.
General specifies the generic characteristics of the creature.
The IDS file used is General.ids
HUMANOID
ANIMAL
DEAD
UNDEAD
GIANTHUMANOID
MONSTER
Etc.
Race is the race of the creature.
The IDS file used is Race.ids
HUMAN
ELF
HALF_ELF
DWARF
HALFLING
GNOME
ANKHEG
BASILISK
BEAR
Etc.
Class is the class information (Mage, Fighter ) Alternatively it can be used for more detailed information (e.g. Drow is more specific then elf)
The IDS file used is Class.ids
MAGE
FIGHTER
CLERIC
FIGHTER_THIEF
BASILISK
BASILISK_GREATER
BEAR_POLAR
Etc.
Specifics holds the identification for special NPCs
Instance is unique for each creature within the game. It should not generally be specifies in the AI scripting but will be set by the AI code once a target is selected
SpecialCase is used to specify whether or not to use any special case information. Currently this will only be used for LAttacked and LTargetted. Protecting, Protector and Myself must be stored in a different way so that you can do things like Protecting.Lattacked.
Eg. To specify all Enemy Fighters: [ENEMY.0.0.FIGHTER]
Special Object Identification
The following functions return ObjectType variables corresponding to some special cases. They are called using the following syntax:
Function(Source)
For Example: LAttacked(Spud) will return the ObjectType of the last thing to attack Spud.
If One of Leader, Weakest, Strongest, MDamaged, LDamaged is called, the Source will be used ONLY to determine which group to use.
For Example: Leader(Spud) will return the leader of Spuds Group
These functions can be used as the Source for any other of these functions. HOWEVER, this nesting can only go 5 deep.
For Example: Protector(LAttacked(LTargeted(Protecting(Myself)))) is valid and will return the protector of the person last attacked by the person last targeted by the person protecting myself. Any more then this depth of nesting is NOT allowed, however.
Note: If you ever use this level of nesting, please seek professional help.
NAME
This is the scriptname in the creature file.
This is the creature that the script belongs to.
Leaving out the Object within the brackets defaults the Object to Myself
LastAttackerOf(Object)
The Creature that last did the Object damage.
Last heard by the Object.
Last seen by the Object.
LastTalkedToBy(Object)
Last talked to by the Object.
LastTalkedToBy()
LastTalkedToBy
Both of these default to LastTalkedToBy(Myself)
Last triggerer of the Object
Player1 or Protagonist
Player2 Player6
Character 2, 3, 4, 5 or 6 in the order they have joined.
Party member with the highest threat rating.
StrongestOfMale()
Male party member with the highest threat rating.
Party member with lowest threat rating.
Returns the nearest creature with Enemy / Ally flag opposite to the Object.
SecondNearestEnemyOf(Object)
You can check the first ten nearest enemies.
Nearest(Type)
Returns the instance of the nearest Object of the given Type.
Eg. Nearest([0.0.DWARF])
SecondNearest()
You can check the first ten nearest.
WorstAC()
Party member with the worst AC.
BestAC()
Party member with the best AC.
NearestEnemyOfType(Type)
Nearest enemy of myself that is of the Type.
Eg. NearestEnemyOfType([0.0.0.MAGE])
SecondNearestEnemyOfType(Type)
You can check the first ten nearest.
Trigger Descriptions
Event Triggers
Triggers return True or False
Clicked(Object)
Closed(Object)
Detected(Object)
Object just unlocked me.
AttackedBy(Object, Style Y)
I was just attacked by an Object using Style.
Style: DEFAULT
MELEE
RANGED
BecameVisible()
BreakingPoint()
Die()
I have just died. This does not always seem to work.
An Object just died in my hearing range.
Heard(Object, Integer: X)
I heard an Object shout X.
HitBy(Object, Style)
I have just been hit by an Object using Style.
I have just been created (not necessarily for the first time)
This can be used for creature and area scripts.
OutOfAmmo()