Scrigroup - Documente si articole

Username / Parola inexistente      

Home Documente Upload Resurse Alte limbi doc  

 
CATEGORII DOCUMENTE





BulgaraCeha slovacaCroataEnglezaEstonaFinlandezaFranceza
GermanaItalianaLetonaLituanianaMaghiaraOlandezaPoloneza
SarbaSlovenaSpaniolaSuedezaTurcaUcraineana

AdministrationAnimalsArtBiologyBooksBotanicsBusinessCars
ChemistryComputersComunicationsConstructionEcologyEconomyEducationElectronics
EngineeringEntertainmentFinancialFishingGamesGeographyGrammarHealth
HistoryHuman-resourcesLegislationLiteratureManagementsManualsMarketingMathematic
MedicinesMovieMusicNutritionPersonalitiesPhysicPoliticalPsychology
RecipesSociologySoftwareSportsTechnicalTourismVarious

AICompile Script Compiler for Baldur’s Gate

computers

+ Font mai mare | - Font mai mic







DOCUMENTE SIMILARE

Trimite pe Messenger
CoroGuide User Manual
SAP Basis Training
AICompile Script Compiler for Baldur’s Gate
MANUAL GeForce2 ULTRA - 3D GRAPHIC ACCELERATOR
OmniPCX Office Architecture
Windows, Linux, and Samba
MAKE YOUR OWN UFS CABLE FOR LG AND SETOOL2 - EASY ‘HOW-TO’
Developer Form Builder
Mac USB DataBridge User’s Guide

AICompile

Script Compiler for Baldur’s Gate

Public Release Version 1.0


Table Of Contents

Table Of Contents________________________________________________________ 2

Disclaimer:_____________________________________________________________ 5

Using the Script Compiler:_________________________________________________ 5

Creating Scripts:_________________________________________________________ 5

Initial Planning:________________________________________________________ 5

Preparation:__________________________________________________________ 5

Coding:______________________________________________________________ 5

Compiling:____________________________________________________________ 6

Definitions:_____________________________________________________________ 6

Creature:_____________________________________________________________ 6

Trigger:______________________________________________________________ 6

Condition:____________________________________________________________ 6

Action:_______________________________________________________________ 6

Response:_____________________________________________________________ 7

Response Set:__________________________________________________________ 7

Creature and Object Identification___________________________________________ 8

Some Special Object Identification Functions_________________________________ 8

“NAME”_____________________________________________________________________ 9

LastAttackerOf(ObjectType Caller)________________________________________________ 9

LastCommandedBy(ObjectType Caller)_____________________________________________ 9

LastHeardBy(ObjectType Type)___________________________________________________ 9

LastHelp(ObjectType Type)_______________________________________________________ 9

LastHitter(ObjectType Type)______________________________________________________ 9

LastSeenBy(ObjectType Type)_____________________________________________________ 9

LastTalkedToBy(ObjectType Type)________________________________________________ 9

LastTargetedBy(ObjectType Caller)________________________________________________ 9

LastTrigger(ObjectType Type)____________________________________________________ 9

LeaderOf()____________________________________________________________________ 9

LeastDamagedOf()_____________________________________________________________ 10

MostDamagedOf()_____________________________________________________________ 10

Myself______________________________________________________________________ 10

Nearest(ObjectType Type)_______________________________________________________ 10

NearestEnemyOf(ObjectType Caller)______________________________________________ 10

Player1______________________________________________________________________ 10

Player2______________________________________________________________________ 10

Player3______________________________________________________________________ 10

Player4______________________________________________________________________ 10

Player5______________________________________________________________________ 10

Player6______________________________________________________________________ 10

Protagonist___________________________________________________________________ 11

ProtectedBy(ObjectType Caller)__________________________________________________ 11

ProtectorOf(ObjectType Caller)__________________________________________________ 11

StrongestOf()_________________________________________________________________ 11

StrongestOfMale______________________________________________________________ 11

WeakestOf()__________________________________________________________________ 11

Trigger Descriptions_____________________________________________________ 12

Event Triggers________________________________________________________ 12

AttackedBy(ObjectType X, Style Y)________________________________________________ 12

Die()________________________________________________________________________ 12

Died(Object: X)________________________________________________________________ 12

Heard(Object:X, Integer: Y)______________________________________________________ 12

Help(ObjectType X)____________________________________________________________ 12

HitBy(ObjectType X, Style Y)_____________________________________________________ 12

Description: I have just been hit by X the style is Y_____________________________________ 12

HotKey(HotKey X)_____________________________________________________________ 12

ReceivedOrder(ObjectType X, OrderID Y)___________________________________________ 12

Said(Object:X)________________________________________________________________ 13

Trigger(Integer TriggerId)______________________________________________________ 13

Status Triggers_______________________________________________________ 13

ActionListIsEmpty()____________________________________________________________ 13

Class(ObjectType X,CLASS)_____________________________________________________ 13

Delay(Integer: X)______________________________________________________________ 15

Use: Use to avoid excessive calling of slow triggers_____________________________________ 15

Exists(ObjectType X)___________________________________________________________ 15

False()_______________________________________________________________________ 15

Gender(ObjectType X,GENDER)__________________________________________________ 15

General(ObjectType X,GENERAL)________________________________________________ 15

HasWeaponEquiped(O:Object*)__________________________________________________ 15

HaveAnySpells()_______________________________________________________________ 15

HaveSpell(Integer X)___________________________________________________________ 15

HP(ObjectType X, Y)___________________________________________________________ 15

HPGT(ObjectType X, Y)________________________________________________________ 16

HPLT(ObjectType X, Y)_________________________________________________________ 16

HPPercent(ObjectType X, Integer: Y)_______________________________________________ 16

HPPercentGT(ObjectType X, Integer: Y)____________________________________________ 16

HPPercentLT(ObjectType X, Integer: Y)____________________________________________ 16

InParty(ObjectType X)__________________________________________________________ 16

InWeaponRange(O:Object*)_____________________________________________________ 16

LOS(ObjectType X, RANGE)_____________________________________________________ 16

NotStateCheck(ObjectType X, Integer:Y)____________________________________________ 16

NumCreature(ObjectType X, Integer: Y)____________________________________________ 16

NumCreatureGT(ObjectType X, Integer: Y)_________________________________________ 16

NumCreatureLT(ObjectType X, Integer: Y)__________________________________________ 16

NumTimesInteracted(Integer:NPC, Integer num)______________________________________ 17

NumTimesInteractedGT(Integer:NPC, Integer num)___________________________________ 17

NumTimesInteractedLT(Integer:NPC, Integer num)___________________________________ 17

OutOfAmmo()________________________________________________________________ 17

Race(ObjectType X,RACE)______________________________________________________ 17

RandomNum(Integer: Range, Integer: Value)_________________________________________ 18

RandomNumGT(Integer: Range, Integer: Value)______________________________________ 18

RandomNumLT(Integer: Range, Integer: Value)______________________________________ 18

Range(ObjectType X, RANGE)___________________________________________________ 18

See(ObjectType X)_____________________________________________________________ 18

Specifics(ObjectType X,SPECIFICS)_______________________________________________ 18

StateCheck(ObjectType X, Integer:Y)_______________________________________________ 18

Description: Check if X is in State Y________________________________________________ 18

Time(TIME)__________________________________________________________________ 18

TimeOfDay()_________________________________________________________________ 18

True()_______________________________________________________________________ 19

Description: Always returns True___________________________________________________ 19

Action Descriptions______________________________________________________ 20

Attack(ObjectType X, Style Y, ObjectType Z)________________________________________ 20

AttackOneRound(Object X)______________________________________________________ 20

AttackReevaluate(O:Target,I:Period)_______________________________________________ 20

Continue( )___________________________________________________________________ 20

EquipMostDamagingMelee()_____________________________________________________ 20

Description: Equip melee weapon which does the most damage___________________________ 20

EquipRanged()________________________________________________________________ 20

Formation(ObjectType Leader, Point Offset)________________________________________ 20

GetItem(ResRef X)_____________________________________________________________ 20

GiveOrder(ObjectType X, OrderID Y)______________________________________________ 21

GroupAttack(Object X)_________________________________________________________ 21

Help()_______________________________________________________________________ 21

Hide()_______________________________________________________________________ 21

Mouse Functions:______________________________________________________________ 21

MoveToObject(ObjectType X)____________________________________________________ 21

MoveToOffset(Point: P)_________________________________________________________ 22

Description: Move to P offset from current location____________________________________ 22

ProtectObject(ObjectType X)_____________________________________________________ 22

ProtectPoint(Point X, Integer range)________________________________________________ 22

RandomWalk()________________________________________________________________ 22

Description: Wander around randomly______________________________________________ 22

RunAwayFrom(ObjectType X, Time)______________________________________________ 22

SendTrigger(ObjectType X, Integer ID)_____________________________________________ 22

SetInterrupt(Integer X)__________________________________________________________ 22

Description: Turn interrupt on or off________________________________________________ 22

Shout(Integer Y)_______________________________________________________________ 22

Description: Send all in range Heard trigger___________________________________________ 22

SmallWait(Integer X)___________________________________________________________ 22

Spell(ObjectType X, SpellID Y)____________________________________________________ 22

SpellPoint(Point X, SpellID Y)____________________________________________________ 25

Wait(Integer X)________________________________________________________________ 25

Description: Enter ready state for X seconds__________________________________________ 25

Sample Script File______________________________________________________ 26

Syntax Overview______________________________________________________ 26

File_________________________________________________________________________ 26

Weight______________________________________________________________________ 26

Condition____________________________________________________________________ 26

Response_____________________________________________________________________ 26

Trigger______________________________________________________________________ 26

Action_______________________________________________________________________ 26

ObjectType___________________________________________________________________ 27

Example File_________________________________________________________________ 27


Disclaimer:

The “Baldur’s Gate Script Compiler,” this document, and any information contained herein, are provided in an “as is” state.  No support will be provided for either the use of the compiler or for any script files generated by the compiler.  Neither BioWare Corp. or Interplay Productions are responsible for any problems encountered in running the compiler or in creating scripts.

BALDUR'S GATE:  Developed and (c)1998 BioWare Corp.  All Rights Reserved.  Baldur's Gate, Forgotten Realms, the Forgotten Realms logo, Advanced Dungeons & Dragons, the AD&D logo, and the TSR logo are trademarks of TSR, Inc., a subsidiary of Wizards of the Coast, Inc., and are used by Interplay under license.  All Rights Reserved.  BioWare, the BioWare logo and The BioWare Infinity Engine are the trademarks of Bioware Corp.  All Rights Reserved.  Interplay, the Interplay logo, Black Isle Studios, the Black Isle Studios logo, and 'By Gamers. For Gamers.' are trademarks of Interplay Productions.  All Rights Reserved.  Exclusively licensed and distributed by Interplay Productions.  LUA copyright 1994-1998 TeCGraf, PUC-Rio.  LUA written by Waldermar Celes, Robert Ierusalimschy and Luiz Henrique de Figueirido.  All other trademarks and copyrights are property of their respective owners.  All rights reserved.

Using the Script Compiler:

Before using the script compiler, you must copy the entire ScriptCompiler directory from Baldur’s Gate CD1 to your hard drive.  You will be unable to run the script compiler directly from the CD.  Once the ScriptCompiler directory has been copied, follow the instructions in the following sections.

Note: The Attributes on the provided source files (in the source directory) must be set to read/write before they can be compiled.

Creating Scripts:

Initial Planning:

Decide what you want the script to do before actually starting one.  For example, “When attacked by an XX I want my character to react according to the range of my attacker.  If I am within a range of 4 search squares I will run to get some distance between us.  If I am further than 4 search squares I will attack with a ranged weapon.”

Preparation:

After you have decided what you want the script to do open notepad or whatever else you would like to use and begin entering in the commands you will need.  For mine I will need to use the commands, AttackedBy, Range, RunAwayFrom, EquipRanged and Attack.

Coding:

This is how my script would look:

IF

            AttackedBy([ANYONE],DEFAULT)

            Range(LastAttackerOf(Myself),4)

THEN

            RESPONSE #100

                        RunAwayFrom(LastAttackerOf(Myself),45)

END

IF

            !Range(LastAttackerOf(Myself),4)

THEN

            RESPONSE #100

                        EquipRanged()

                        Attack(LastAttackerOf(Myself))

END

In the first part of the script I check to see if I was attacked by [ANYONE].  The object type parameter uses any function that returns an object type or objects referenced by ENEMYALLY, RACE, CLASS, etc.  Examples of these are: [ANYONE], [ENEMY], [PC], etc.  The object type can also be Myself.  But in this case it would be useless since you would not attack yourself.

Once I have determined if someone attacked me I check to see if the Range was within 4 search squares. (The screen is about 30 search squares).  If the last attack of myself is within range I run away from the target for about 3 seconds.  The time is given in 15ths of a second.

If the range of the target is not within 4 search squares the script falls through to the next set of checks.  In this next set I just check to see if the target’s range is not (using the ! to reference not) within 4 search squares.  If so then I equip my ranged weapon and attack the last attacker of myself.

If I do not have a ranged weapon or ammo the function will equip a melee weapon and then approach the target to get within weapons range.

Compiling:

Once the script is done I save it to the Source directory of the script compiler.  The filename must be 1 – 8 characters with the extension .BAF.  I then run the compiler by typing COMPILE <FILENAME>.  The compiler will notify you of any errors in the script by placing a error file in the ERRORS directory with the script’s filename and extension .ERR.  If the file size is 0 then the script compiled successfully.  And the final script will be placed in the COMPILED directory with the filename and extension .BS.  This will then have to be copied into your SCRIPTS directory of Baldur’s Gate.

Definitions:

Creature:

Creatures include all objects capable of action. This includes player characters.

Trigger:

 A trigger is sent to a creature when a certain event occurs.  A trigger includes the knowledge of the cause of the trigger

Condition:

 A combination of triggers joined with ands.

Action:

 A specified response to a condition.  An action requires the knowledge of who (or what) to perform the action upon.

Response:

 A combination of actions which will be performed sequentially.  It is possible for a response to be interrupted.

Response Set:

A combination of Responses, each with a weighting from 1 to 100.  This weighting is used to randomly determine which response is actually executed.


Creature and Object Identification

Creature and Object Identification is done through the ObjectType Class. 

ObjectType is arranged as follows

BYTE EnemyAlly                  General

BYTE General                        |

BYTE Race                             |

BYTE  Class                           |

BYTE specifics                      V

LONG Instance                      Specific

BYTE SpecialCase

EnemyAlly is a range between the PC and the evil NPC’s Creatures can fall anywhere along this range.

General specifies the generic characteristics of the creature (Humanoid, animal, object etc.…)

Race is the race of the creature (Elf, Dwarf …)

Class is the class information (Mage, fighter …) Alternatively it can be used for more detailed information (e.g. Drow is more specific then elf)

Specifics holds the identification for special NPC’s

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.

To specify all of a subtype, set the more specific variables to 0. 

e.g. To specify all Enemy Dwarfs, set Class, specifics and instance to 0.

Some Special Object Identification Functions

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 Spud’s 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”

-Returns ObjectType with the instance field filled out if the object currently exists.

LastAttackerOf(ObjectType Caller)

-Returns ObjectType

- The Creature that last did Caller damage

LastCommandedBy(ObjectType Caller)

-Returns ObjectType

-Returns the last person who issued Caller an order

LastHeardBy(ObjectType Type)

-Returns ObjectType

-last heard by type

LastHelp(ObjectType Type)

-Returns ObjectType

-Last person type heard call for help

LastHitter(ObjectType Type)

-Returns ObjectType

-Last person who hit type

LastSeenBy(ObjectType Type)

-Returns ObjectType

-Last seen by type

LastTalkedToBy(ObjectType Type)

-Returns ObjectType

-Last talked to by type

LastTargetedBy(ObjectType Caller)

-Returns ObjectType

- The Creature that Caller last targeted for attack

LastTrigger(ObjectType Type)

-Returns ObjectType

-Last triggerer of type

LeaderOf()

-Returns ObjectType

-Current leader of Player group

LeastDamagedOf()

-Returns ObjectType

- Group member with highest percentage of remaining hit points

MostDamagedOf()

-Returns ObjectType

- Use Source to specify Enemy / Ally status of group

- Group member with the lowest percentage of remaining hit points

Myself

-Returns ObjectType

-Yourself

-Me

Nearest(ObjectType Type)

-Returns ObjectType

-Returns the instance of the nearest ObjectType of the given Type.

NearestEnemyOf(ObjectType Caller)

-Returns ObjectType

-Returns the nearest creature with Enemy / Ally flag opposite to the Caller.

Player1

-Returns ObjectType

-Character in portrait slot 1

Player2

-Returns ObjectType

-Character in portrait slot 2

Player3

-Returns ObjectType

-Character in portrait slot 3

Player4

-Returns ObjectType

-Character in portrait slot 4

Player5

-Returns ObjectType

-Character in portrait slot 5

Player6

-Returns ObjectType

-Character in portrait slot 6

Protagonist

- The Protagonist



ProtectedBy(ObjectType Caller)

- Returns ObjectType

- The Creature currently protected by Caller

ProtectorOf(ObjectType Caller)

- Returns ObjectType

- The Creature Caller is currently being protected by

StrongestOf()

-Returns ObjectType

- Group member with the highest threat rating

StrongestOfMale

- Returns ObjectType

- Male group member with the highest threat rating

WeakestOf()

-Returns ObjectType

- Group member with lowest threat rating


Trigger Descriptions

Event Triggers

Event Triggers only last until the next AI cycle.  At that point they are examined and processed.  At the end of the AI cycle all of the triggers are removed from the pending list.

AttackedBy(ObjectType X, Style Y)

Returns: Boolean (True or False)

Description: I was just attacked by creature X using style Y.

Information required:

Attack type:    DEFAULT

MELEE

RANGED

X is an ObjectType variable.

Die()

Returns: Boolean (True of False)

Description: I have just died

Died(Object: X)

Returns: Boolean (True or False)

Description: X just died in my hearing range.

Heard(Object:X, Integer: Y)

Returns: Boolean (True or False)

Description: I heard X shout Y

Help(ObjectType X)

Returns: Boolean (True or False)

Description: a call for help is heard from X

Information required: X is an ObjectType

HitBy(ObjectType X, Style Y)

Returns: Boolean (True or False)

Description: I have just been hit by X the style is Y

HotKey(HotKey X)

Returns: Boolean(True or False)

Description: key X has just been pressed when I was the selected creature

Currently hotkeys are restricted to letters A through Z.

ReceivedOrder(ObjectType X, OrderID Y)

Returns: Boolean (True or False)

Description: Just received order Y from X

Information Required: X specifies the creature that sent the order.  OrderID specifies type of the order.

Said(Object:X)

Returns: Boolean (True or False)

Description: X said something to me

Trigger(Integer TriggerId)

Returns: Boolean (True or False)

Description: I have just been sent the trigger TriggerId

Status Triggers

Status triggers are checked every time through the AI cycle.  As a result they always apply if they are true.

ActionListIsEmpty()

Returns: Boolean (True or False)

Description: I have no actions on my queue

Class(ObjectType X,CLASS)

Returns: Boolean (True or False)

Description: Is the Class of X equal to CLASS?

Information Needed: X is an ObjectType CLASS is the class

ANKHEG

BARD

BASILISK

BASILISK_GREATER

BEAR_BLACK

BEAR_BROWN

BEAR_CAVE

BEAR_POLAR

CARRIONCRAWLER

CLERIC

CLERIC_MAGE

CLERIC_RANGER

CLERIC_THIEF

DOG_WAR

DOG_WILD

DOPPLEGANGER

DOPPLEGANGER_GREATER

DRIZZT

DRUID

ELMINSTER

ETTERCAP

FAIRY_DRYAD

FAIRY_NEREID

FAIRY_NYMPH

FAIRY_SIRINE

FIGHTER

FIGHTER_CLERIC

FIGHTER_DRUID

FIGHTER_MAGE

FIGHTER_MAGE_CLERIC

FIGHTER_MAGE_THIEF

FIGHTER_THIEF

GHOUL

GHOUL_GHAST

GHOUL_REVEANT

GIBBERLING

GNOLL

GREEN_SLIME

GREY_OOZE

HOBGOBLIN

KOBOLD

KOBOLD_TASLOI

KOBOLD_XVART

MAGE

MAGE_THIEF

MUSTARD_JELLY

NO_CLASS

OCRE_JELLY

OGRE

OGRE_HALFOGRE

OGRE_MAGE

OGRE_OGRILLON

OLIVE_SLIME

PALADIN

RANGER

SAREVOK

SKELETON

SKELETON_BANEGUARD

SKELETON_WARRIOR

SPIDER_GIANT

SPIDER_HUGE

SPIDER_PHASE

SPIDER_SWORD

SPIDER_WRAITH

THIEF

VOLO

WOLF

WOLF_DIRE

WOLF_DREAD

WOLF_VAMPIRIC

WOLF_WINTER

WOLF_WORG

WYVERN

Delay(Integer: X)

Returns: Boolean (True or False)

Description: returns False except every X seconds

Use: Use to avoid excessive calling of slow triggers

Exists(ObjectType X)

Returns: Boolean (True or False)

Description: Is X a valid ObjectType?

Information Needed: X is an ObjectType variable.

False()

Description: Always return FALSE

Gender(ObjectType X,GENDER)

Returns: Boolean (True or False)

Description: Is the X’s gender equal to GENDER?

General(ObjectType X,GENERAL)

Returns: Boolean (True or False)

Description: Is the General type of X equal to GENERAL?

Information Needed: X is an ObjectType GENERAL is the general type.

HUMANOID       

ANIMAL         

DEAD           

UNDEAD         

GIANTHUMANOID  

FROZEN         

MONSTER      

HasWeaponEquiped(O:Object*)

Description: Does the Object have a weapon equiped?

HaveAnySpells()

Returns: Boolean (True or False)

Description: Do I have any Spells?

HaveSpell(Integer X)

Returns: Boolean (True or False)

Description: Do I have spell X

HP(ObjectType X, Y)

Returns: Boolean (True or False)

Description: X’s current hit points are EXACTLY Y

Information needed: the value of Y (as a percentage). X is an ObjectType.

Development Notes: the specificID flag can be used to store the percentage

HPGT(ObjectType X, Y)

Returns: Boolean (True or False)

Description: X’s current hit points are GREATER THEN Y

Information needed: the value of Y (as a percentage) . X is an ObjectType.

Development Notes: the specificID flag can be used to store the percentage

HPLT(ObjectType X, Y)

Returns: Boolean (True or False)

Description: X’s current hit points are LESS THEN Y

Information needed: the value of Y (as a percentage) . X is an ObjectType.

Development Notes: the specificID flag can be used to store the percentage

HPPercent(ObjectType X, Integer: Y)

HPPercentGT(ObjectType X, Integer: Y)

HPPercentLT(ObjectType X, Integer: Y)

Returns: Boolean (True or False)

Description: Is the HP percent of X equal to Y?

InParty(ObjectType X)

Returns: Boolean (True or False)

Description: Is X in the Party

InWeaponRange(O:Object*)

Description: Is object in Weapon range?

LOS(ObjectType X, RANGE)

Returns: Boolean (True or False)

Description: Is Object X within RANGE search map blocks? Also, is there a clear line of sight to X?

Information Needed: X is an ObjectType variable. RANGE is an integer count of intervening blocks.

NotStateCheck(ObjectType X, Integer:Y)

Returns: Boolean (True or False)

Description: Is X in state Y

NumCreature(ObjectType X, Integer: Y)

NumCreatureGT(ObjectType X, Integer: Y)

NumCreatureLT(ObjectType X, Integer: Y)

Returns: Boolean (True or False)

Description: Is the number of X’s visible Equal to Y

NumTimesInteracted(Integer:NPC, Integer num)

NumTimesInteractedGT(Integer:NPC, Integer num)

NumTimesInteractedLT(Integer:NPC, Integer num)

Returns: Boolean (True or False)

Description: Have I interacted with NPC num times?

OutOfAmmo()

Returns: Boolean (True or False)

Description: Is my current weapon out of ammo.  Melee always returns false.

Race(ObjectType X,RACE)

Returns: Boolean (True or False)

Description: Is the Race of X equal to RACE?

Information Needed: X is an ObjectType RACE is the race to be compared to.

Development Notes: Simply compare X.m_type.Race to RACE.

ANKHEG

BASILISK

BEAR

CARRIONCRAWLER

DOG

DOPPLEGANGER

DWARF

ELF

ETTERCAP

FAIRY

GHOUL

GIBBERLING

GNOLL

GNOME

HALF_ELF

HALFLING

HOBGOBLIN

HUMAN

KOBOLD

NO_RACE

OGRE

SKELETON

SLIME

SPIDER

WOLF

WYVERN

RandomNum(Integer: Range, Integer: Value)

RandomNumGT(Integer: Range, Integer: Value)

RandomNumLT(Integer: Range, Integer: Value)

Returns: Boolean (True or False)

Description: Generate a number from 0 to Range and check against Value.

Range(ObjectType X, RANGE)

Returns: Boolean (True or False)

Description: Is Object X within RANGE search map blocks?

Information Needed: X is an ObjectType variable.

Development Notes: Pure distance, no line of sight. Use SpecificID for Range.

See(ObjectType X)

Returns: Boolean (True or False)

Description: Object X is in visual range

Information Needed: Several options for specifying X

1.     The ObjectType class must be specified for X (this allows a general description)

2.     Foe / friend

Specifics(ObjectType X,SPECIFICS)

Returns: Boolean (True or False)

Description: Is the Specific information of X equal to SPECIFICS?

Information Needed: X is an ObjectType SPECIFICS is the specific information flag.

StateCheck(ObjectType X, Integer:Y)

Description: Check if X is in State Y

Time(TIME)

Returns: Boolean (True or False)

Description: The game time is TIME.  Game time is the time that has passed in the game world.

Information needed: TIME specifies the time (in seconds) since the beginning of the game

TimeOfDay()

Returns: Boolean (True or False)

Description: Is the time of day TOD?

Information needed: Time of day (TOD) is a reference to the current world time in hours.  Constants are:

MIDNIGHT

NOON

DAWN_START

DAWN_END

DUSK_START

DUSK_END

True()

Description: Always returns True


 Action Descriptions

Overall Development Note:

For any action that requires movement before the action, set the current action to move (with the correct target) and set the next action as the desired action.  In general, when a movement is taking place, it will continue as long as the next action is No Action or the target of the next action is the same as the target of the movement and the next action is one that would require movement to the target.

Attack(ObjectType X, Style Y, ObjectType Z)

Description: Attack creature X using Style Y.   If no X then attack Z by default.

Information Required: Y specifies the style of attack desired

                                    DEFAULT

                                    RANGED

                                    MELEE

                                    X is used to specify the target.  Unless X includes an Instance, then X will be used to indicate the preferred target.  Once a target is selected, an Instance will be obtained so that target don’t constantly change.  A second ObjectType Z is used to specify general targets.

Development Notes: To do this, place all of type X or Z on the search map.  Add Threat radii.  However, give the creatures of type X a much lower threat radius penalty.

AttackOneRound(Object X)

Description: Attack X for one round

AttackReevaluate(O:Target,I:Period)

Description: Attack target but reevaluate target every Period clock ticks

Continue( )

Description: Use the actions currently selected, but continue looking for more.

Information Required: none

EquipMostDamagingMelee()

Description: Equip melee weapon which does the most damage

EquipRanged()

Description: Equip a ranged weapon.

Formation(ObjectType Leader, Point Offset)

Description: follow the leader with offset of Offset.

GetItem(ResRef X)

Description: Get Item X and add it to inventory.  Walk to the item if necessary.

Information Required: X is a ResRef

GiveOrder(ObjectType X, OrderID Y)

Description: Give order Y to X. X must have a trigger to respond to the order or nothing will happen

Information Required: X specifies the creature(s) to send the order to.  OrderID specifies type of the order.

Development Notes: Send a ReceivedOrder trigger to X.  Limit range to hearing range of Targets

GroupAttack(Object X)

Description: Attack all of type X

Help()

Description: Call for help

Information Required: None

Development Notes: Send a Call for help Heard trigger to ALL creatures in hearing range (regardless of which side they are on)

Hide()

Description: Hide in shadows / Move silently

Information required: None

Development Notes: This action should continue until an action that would counter this occurs.  That is you should be able to simultaneously move silently and move.  Perhaps a flag in the thief character should indicate that the character is moving silently.

Mouse Functions:

ClickLButtonPoint(Point X, SCROLLSPEED)

ClickRButtonPoint(Point X, SCROLLSPEED)

DoubleClickLButtonPoint(Point X, SCROLLSPEED)

DoubleClickRButtonPoint(Point X, SCROLLSPEED)

MoveCursorPoint(Point X, SCROLLSPEED)

ClickLButtonObject(ObjectType X, SCROLLSPEED)

ClickRButtonObject (ObjectType X, SCROLLSPEED)

DoubleClickLButtonObject (ObjectType X, SCROLLSPEED)

DoubleClickRButtonObject (ObjectType X, SCROLLSPEED)

Description: Click or move cursor to designated spot

MoveToObject(ObjectType X)

Description: Plot a path to X and begin moving

Information requires: X is an ObjectType

Development Notes: Once a path is obtained, it should be followed as long as no other action is chosen.  Further, if the Move To X action reoccurs then, if the two destinations are equal, the existing path should be used.

MoveToOffset(Point: P)

Description: Move to P offset from current location

ProtectObject(ObjectType X)

Description: Protect Object X.  Stay within a certain distance of X.  Attack enemies in range.

Information required: X is an ObjectType.

Development Notes: Center the In Range check around X.  If outside range, move back.

ProtectPoint(Point X, Integer range)

Description: Protect X.  Stay within a certain distance of X.  Attack enemies in range.

Information required: X is an ObjectType.

Development Notes: Center the In Range check around X.  If outside range, move back.

RandomWalk()

Description: Wander around randomly

RunAwayFrom(ObjectType X, Time)

Description: Run away from X for Time seconds.

Information required: X is an ObjectType, Time is in seconds

Development Notes:

SendTrigger(ObjectType X, Integer ID)

Description: Send trigger number ID to X.

SetInterrupt(Integer X)

Description: Turn interrupt on or off

Shout(Integer Y)

Description: Send all in range Heard trigger

SmallWait(Integer X)

Description: Enter ready state for X 15ths of a second

Spell(ObjectType X, SpellID Y)

Description: Cast the spell Y on target X.

Information Required:

            The desired spell can be specified as follows:

CLERIC_AID

CLERIC_ANIMAL_SUMMONING_1

CLERIC_ANIMAL_SUMMONING_2

CLERIC_ANIMATE_DEAD

CLERIC_BARKSKIN

CLERIC_BLESS

CLERIC_CALL_LIGHNING

CLERIC_CHANT

CLERIC_CHARM_PERSON

CLERIC_COMMAND

CLERIC_CURE_CRITICAL_WOUNDS

CLERIC_CURE_LIGHT_WOUNDS

CLERIC_CURE_SERIOUS_WOUNDS

CLERIC_DETECT_EVIL

CLERIC_DISPEL_MAGIC

CLERIC_DRAW_UPON_HOLY_MIGHT

CLERIC_ENTANGLE

CLERIC_FIND_TRAPS

CLERIC_FLAME_BLADE

CLERIC_FLAME_STRIKE

CLERIC_FREE_ACTION

CLERIC_GLYPH_OF_WARDING

CLERIC_GOOD_BERRIES

CLERIC_HOLD_ANIMAL

CLERIC_HOLD_PERSON

CLERIC_INVISIBILITY_PURGE

CLERIC_KNOW_ALIGNMENT

CLERIC_MAGIC_STONE

CLERIC_MISCAST_MAGIC

CLERIC_NEUTRALIZE_POISON

CLERIC_PROTECT_FROM_EVIL

CLERIC_PROTECTION_FROM_FIRE

CLERIC_RAISE_DEAD

CLERIC_REMOVE_CURSE

CLERIC_REMOVE_FEAR

CLERIC_REMOVE_PARALYSIS

CLERIC_RESIST_FIRE

CLERIC_RIGID_THINKING

CLERIC_SANCUTARY

CLERIC_SHILLELAGH

CLERIC_SILENCE_15_FOOT

CLERIC_SLOW_POISON

CLERIC_SPIRITUAL_HAMMER

CLERIC_STRENGTH_OF_ONE

WIZARD_AGANNAZAR_SCORCHER

WIZARD_ANIMATE_DEAD

WIZARD_ARMOR

WIZARD_BLINDNESS

WIZARD_BLUR

WIZARD_BURNING_HANDS

WIZARD_CHARM_PERSON

WIZARD_CHILL_TOUCH

WIZARD_CHROMATIC_ORB

WIZARD_CLAIRVOYANCE

WIZARD_CLOUDKILL

WIZARD_COLOR_SPRAY

WIZARD_CONFUSION

WIZARD_DETECT_EVIL

WIZARD_DETECT_INVISIBILITY

WIZARD_DIMENSION_DOOR

WIZARD_DIRE_CHARM

WIZARD_DISPEL_MAGIC

WIZARD_FIREBALL

WIZARD_FLAME_ARROW

WIZARD_FRIENDS

WIZARD_GHOST_ARMOR

WIZARD_GHOUL_TOUCH

WIZARD_GREASE

WIZARD_HASTE

WIZARD_HOLD_PERSON

WIZARD_HOLD_PORTAL

WIZARD_HORROR

WIZARD_IDENTIFY

WIZARD_INFRAVISION

WIZARD_INVISIBILITY

WIZARD_INVISIBILITY_10_FOOT

WIZARD_KNOCK

WIZARD_KNOW_ALIGNMENT

WIZARD_LARLOCH_MINOR_DRAIN

WIZARD_LIGHTNING_BOLT

WIZARD_LUCK

WIZARD_MAGIC_MISSILE

WIZARD_MELF_ACID_ARROW

WIZARD_MINOR_GLOBE_OF_INVULNERABILITY

WIZARD_MIRROR_IMAGE

WIZARD_MONSTER_SUMMONING_1

WIZARD_MONSTER_SUMMONING_2

WIZARD_MONSTER_SUMMONING_3

WIZARD_NON_DETECTION

WIZARD_PROTECTION_FROM_EVIL

WIZARD_PROTECTION_FROM_NORMAL_MISSILES

WIZARD_PROTECTION_FROM_PETRIFICATION

WIZARD_RESIST_FEAR

WIZARD_SHADOW_DOOR

WIZARD_SHIELD

WIZARD_SHOCKING_GRASP

WIZARD_SKULL_TRAP

WIZARD_SLEEP

WIZARD_SLOW

WIZARD_STINKING_CLOUD

WIZARD_STRENGTH

WIZARD_VAMPIRIC_TOUCH

WIZARD_VOCALIZE

WIZARD_WEB

            Target X is specified using an ObjectType variable.

SpellPoint(Point X, SpellID Y)

Description: Cast the spell Y on target X.

Wait(Integer X)

Description: Enter ready state for X seconds


Sample Script File

Syntax Overview

File

IF

            Condition1

THEN

            RESPONSE #weight

            Response1

            RESPONSE #weight

                        Response2

END

IF

            Condition2

THEN

            RESPONSE #weight

            Response3

            RESPONSE #weight

                        Response4

END

Weight

weight is a number between 1 and 100.

Condition

Trigger1

Trigger2

 

Response

Action1

Action2

Action3

Trigger

Trigger(Parameter1, Parameter2, …)

Action

Action(Parameter1,Parameter2, …)

ObjectType

SpecialCase1( SpecialCase2( SpecialCase3( SpecialCase4(…)))))

or

“NAME”

or

[Allegiance . General . Race . Class . Specifics]

Example File

IF

            Class(LastAttackerOf(Myself), MAGE)

            HPGT(Myself,50)

THEN

            RESPONSE #80

                        Attack(LastAttackerOf(Myself),MELEE)

            RESPONSE #40

                        Help()

                        RunAway()

END

IF

            Exists(LastAttackerOf(ProtectedBy(Myself))

THEN

            RESPONSE #100

                        Attack(LastAttackerOf(ProtectedBy(Myself)), RANGED)

END

IF

            HPLT(MostDamagedOf(GroupOf(Myself)),25)

THEN

            RESPONSE #76

            Spell(MostDamagedOf(GroupOf(Myself)),MOST_HEALING)

                        Protect(MostDamagedOf(GroupOf(Myself)))

            RESPONSE #76

            Attack(LastAttackerOf(MostDamagedOf(GroupOf(Myself))),RANGED)

END

IF

            See(NearestEnemyOf(Myself))

THEN

            RESPONSE #54

                        Attack(NerestEnemyOf(Myself), DEFAULT)

END

Explanation:

1.     If I’m attacked by a mage and my hit points are more then 50%, either attack the mage using melee (66.7%) OR yell for help and run away (33.3%)

2.     If the person I’m protecting is attacked, attack their attacker using a ranged attack (100%)

3.     If the most damaged person in my group has less then 25% of his hit points, then either cast the most powerful healing spell on him and start protecting them (50%) OR attack the last person who attacked them (50%).

4.     Attack the nearest enemy using my default attack. (100%)

Define ANYONE as the ObjectType with all 0’s. Define ENEMY as the ObjectType with all 0’s except EnemyAlly set to enemy.

DISTRIBUIE DOCUMENTUL

Comentarii


Vizualizari: 657
Importanta: rank

Comenteaza documentul:

Te rugam sa te autentifici sau sa iti faci cont pentru a putea comenta

Creaza cont nou

Distribuie URL

Adauga cod HTML in site



Termeni si conditii de utilizare | Contact
© SCRIGROUP 2019. All rights reserved