Instance Scripts augment the base Script Core system. Refer to that for basic understanding of labels, conditionals, calls, variables, strings, etc. This document will describe new commands and other things relevant to AI Scripts.
Detailed Command Reference
Additional functions available to Instance Scripts
spawn [int:PropID]
Force a SpawnPoint to activate. Use the build tool to determine the SpawnPoint's prop ID.
Example:
spawn 1056964748
Takes an extra parameter to force a particular creature type to activate. If set to zero, it will choose according to the SpawnPoint's spawn package.
Example:
spawn_at 1358960407 1690
Example:
countalive 2074 result
Spawns a creature at a specific coordinate.
Example:
spawnloc 1639 41387 640 66185get_npc_id [int:CDefID] [var:dest]
It will place the Creature Instance ID (CID) into the destination variable. If the creature was not found, the result will be zero.
Example:
get_npc_id 3630 BOSSID
Example:
set_target ALLYID BOSSID
The location name must be supplied by the #location directive, which is used to define rectangular locations within a map.
Example:
#location BOSSROOM 3200 3800 3700 4200 ... scan_npc_cid BOSSROOM MOBLISTget_cdef [var:CID] [var:destCDefID]
Example:
get_cdef TEMPCID TEMPCDEF
Example:
get_health_percent CID TEMP
This was recently added an experimental command for an unreleased dungeon and may not work correctly.
Example:
order_walk CID 3300 3800
Example:
get_target CID TEMP
This may be used to trigger certain interactive behaviors between specially scripted creatures.
Example:
ai_script_jump CID "extTryCastShield"
Example:
info "A harmless foe has appeared."
Example:
chat "conRed" "Instance" "It worked!"
Some new directives are available to instance scripts.
#location [str:name] [int:X1] [int:Z1] [int:X2] [int:Z2]Locations are used by the scan_npc_cid command.
Example:
#location LOC_BOSS_ROOM 1800 2700 2400 3200
Locations are used by the scan_npc_cid command.
Example:
#location_br LOC_BRAZIER_1 1900 3000 140
If the SpawnPoint Sequential property is set to true, then the label will be called directly.
If the mob was spawned by a SpawnPackage, and SpawnPackage::ScriptCall is enabled, it won't call "onKill" but instead a label with exact package name.
%d will reflect the CDefID of the creature that was killed.
Labels will fall through other labels so you can trap kills from multiple types to accomplish a trigger.
Example:
:init set killcount 0 end :onKill_1993 :onKill_1994 inc killcount if killcount >= 6 spawn 1291845744 endif end ; Anglor Dren's chest :onKill_1995 spawn 1291845811 end:onUse_%d
%d will reflect the CDefID of object.
:onUseHalt_%d%d will reflect the CDefID of object.
:onUseFinish_%d%d will reflect the CDefID of object.
use [int:AbilityID] getwill [var:dest] getwillcharge [var:dest] getmight [var:dest] getmightcharge [var:dest] has_target [var:dest] getlevel [var:dest] debugprint [string] getcooldown [string:Cooldown Name] [var:dest] is_busy [var:dest] count_enemy_near [int:range (10 units=1 meter)] [var:dest] count_enemy_at [int:range (10 units=1 meter)] [var:dest] health_percent [var:dest] target_health_percent [var:dest] set_elapsed_time [var:dest] time_offset [var:Elapsed Time (ms)] [var:dest Time Since Elapsed (ms)] visual_effect [string] visual_effect_t [string] say [string] instance_call [string] get_idle_mob [int:CDefID] [var:dest] get_target [var:dest CID] get_self [var:dest CID] set_other_target [var:CID to Modify] [var:CID to Target] aiscript_call [var:CID] [label] is_target_enemy [var:dest] is_target_friendly [var:dest] set_speed [integer] get_target_cdef [var:dest] get_property [string:Stat Name] [var:dest] get_target_property [string:Stat Name] [var:dest] dispel_target_property [string:Stat Name] [int:Sign] randomize [int:Max Value] [var:dest] find_cdef [int:CDefID] [var:dest] play_sound [str:Package|FileName.ogg] get_buff_tier [int:AbilityGroupID] [var:dest] get_target_buff_tier [int:AbilityGroupID] [var:dest] target_in_range [int:range (10 units=1 meter)] [var:dest] get_target_range [var:dest] set_gtae get_speed [var:CID] [var:dest] cid_is_busy [var:CID] [var:dest]