Script Events are functions that are called by the script processor when
something relevant happens to your gear during an arena match. For instance, if you have declared the
on init event, the script processor will execute your code when initializing your gear prior to the match starting.
Editon init
The
on init event is called when your gear has been added to the match and is being initialized (prepared) for arena combat.
Sample:
vars $shotsFired
on init
{
$shotsFired = -1
}
Editon preScan
The
on preScan event is called on every turn prior to your gear's scanner running. This event will be called whether or not the scanner is ON or OFF.
Sample:
vars $gearIDs as array[1 : 12]
on preScan
{
foreach : $gearIDs
{
// reset initialize the array
$gearIDs[$gearIDs.index] = -1
}
}
Editon enemySpotted
The
on enemySpotted event is called for every gear spotted during a scan. The scanner must be running for this event to be called.
Useful System Variables for the
on enemySpotted event.
- @EnemyAppearsDrained: Looking at the Gear it 'appears' that its EP is low
- @EnemyAppearsWeak: Looking at the Gear it 'appears' that its HP is low
- @EnemyCount: Gets count of total enemy gears that have been scanned
- @EnemyDistance: Gets the distance to the enemy gear currently being scanned
- @EnemyHeading: Gets the heading of the enemy gear currently being scanned
- @EnemyId: Gets the ID of the enemy gear currently being scanned
- @EnemyName: Gets the name of the enemy gear currently being scanned
- @EnemyPosX: Gets the X coordinate of the enemy gear currently being scanned
- @EnemyPosY: Gets the Y coordinate of the enemy gear currently being scanned
- @EnemyScanned: Gets the number of turns the enemy gear currently being scanned has been scanned
Sample:
vars $gearIDs as array[1 : 12], $index
on preScan
{
$index = 0
foreach : $gearIDs
{
// reset initialize the array
$gearIDs[$gearIDs.index] = -1
}
}
on enemySpotted
{
$index = $index + 1
$gearIDs[$index] = @EnemyId
}
Editon mineSpotted
The
on mineSpotted event is called for every active mine spotted during a scan. If a mine has a time delay, it will not register for the scanner until it has been activated. The scanner must be running for this event to be called.
Useful System Variables for the
on mineSpotted event.
- @MineCount: Gets count of total mines that have been scanned
- @MineDistance: Gets the distance to the mine currently being scanned
- @MinePosX: Gets the X coordinate of the mine currently being scanned
- @MinePosY: Gets the Y coordinate of the mine currently being scanned
Sample:
vars $mines as array[1 : 12], $index
on preScan
{
$index = 0
foreach : $mines
{
// reset initialize the array
$mines[$mines.index] = -1
}
}
on mineSpotted
{
$index = $index + 1
$mines[$index] = @MineDistance
}
Editon myTurn
The
on myTurn event is called for every gear as their turn is taken. This is typically the event where an action will be selected, whether it is to fire on another gear, or move to a new location. Once each gear has processed it's myTurn event, the selected actions are calculated for each gear and processed in the gears initiative order.
Useful System Variables for the
on myTurn event.
- @ActionSelected: Whether or not an action has been selected
- @ChaingunAimX: Gets the current X coordinate that the chaingun is aimed at
- @ChaingunAimY: Gets the current Y coordinate that the chaingun is aimed at
- @ChaingunAmmo: Gets the current amount of ammo available to the chaingun
- @ChaingunCluster: Gets the current cluster value of the chaingun
- @ChaingunMaxAmmo: The maximum amount of ammo that is carried by the chaingun for a match
- @ChaingunMaxCluster: Gets the maximum cluster value available to the chaingun
- @ChaingunRange: Gets the range of the chaingun
- @CloakIsOn: Whether or not the cloak is on
- @EnemyCount: Gets count of total enemy gears that have been scanned
- @EP: Gets the current EP available
- @EpRecharge: Gets the EP recharge rate
- @EpToDropMine: Gets the amount EP required to drop a mine
- @EpToFireChaingun: Gets the amount of EP required to fire the chaingun
- @EpToFireMortar: Gets the amount of EP required to fire the mortar
- @EpToFly: Gets the EP required to fly per 1 map unit
- @EpToMove: Gets the EP required to move
- @EpToRepair: Gets the amount of EP required to repair
- @EpToRun: Gets the EP required to run
- @EpToScan: Gets the EP required to scan
- @EpToTurn: Gets the EP required to turn 15 degrees
- @EpToUseCloak: Gets the amount of EP required to run the cloak per turn
- @EpToUseShields: Gets the amount of EP required to run the shields per turn
- @GearsInArena: The total count of gears currently in the arena (your gear is included)
- @GearsInMatch: The total count of gears in the current match, use # @GearsInArena to determine the number alive
- @Heading: Gets the current heading
- @HP: Gets the current amount of HP
- @HpRepair: Gets the HP repair rate
- @Id: Gets the ID of your gear
- @Initiative: The initiative value used to sort the current turn
- @MaxEP: Gets the maximum amount of EP that can be stored
- @MaxFlyDistance: Gets the current maximum flying distance based on current EP
- @MaxHP: Gets the maximum amount of HP that can be stored
- @MaxMoveDistance: Gets the current maximum move distance
- @MaxRunDistance: Gets the current maximum run distance
- @MaxX: The maximum X coordinate of the map
- @MaxY: The maximum Y coordinate of the map
- @MineAmmo: Gets the amount of mines currently available to drop
- @MineAOE: Gets area of effect radius for a mine
- @MineCluster: Gets the current cluster value of the mortar
- @MineCount: Gets count of total mines that have been scanned
- @MineDelay: Gets the number of ticks currently set for the mine delay
- @MineDistance: Gets the distance to the mine currently being scanned
- @MineMaxAmmo: The maximum amount of ammo that is carried by the mine for a match
- @MineMaxCluster: Gets the maximum cluster value available to the mortar
- @MineProximity: Gets the proximity range of a mine
- @MinesDetonated: Gets the number of mines that have been detonated
- @MinesDropped: Gets the amout of mines that have been dropped
- @MinX: The minimum X coordinate of the map
- @MinY: The minimum Y coordinate of the map
- @MortarAimX: Gets the current X coordinate that the mortar is aimed at
- @MortarAimY: Gets the current Y coordinate that the mortar is aimed at
- @MortarAmmo: Gets the current amount of ammo available to the mortar
- @MortarAOE: Gets area of effect radius for the mortar
- @MortarCluster: Gets the current cluster value of the mortar
- @MortarMaxAmmo: The maximum amount of ammo that is carried by the mortar for a match
- @MortarMaxCluster: Gets the maximum cluster value available to the mortar
- @MortarRange: Gets the range of the mortar
- @Name: Gets the name of your gear
- @PosX: Gets the current X coordinate
- @PosY: Gets the current Y coordinate
- @ScannerOn: Whether or not the scanner is on
- @ScanRange: Gets the range of the scanner
- @ShieldsAreOn: Whether or not the shields are on
- @Turn: The current turn of the match
- @TurnsWithoutAction: The current of turns taken without any reasonable action (ie. constant recharging will remove a gear from the arena)
Sample:
vars $x, $y
on myTurn
{
// run 45 degrees
$x = @PosX + (cos(ToRadians(45)) * 3)
$y = @PosY + (cos(ToRadians(45)) * 3)
RunTo($x, $y)
}
Editon attacked
The
on attacked event is called for every hit your gear takes during a turn. This event is not fired until all hits from all gears has been taken.
Useful System Variables for the
on attacked event.
- @AttackedBy: Gets the name of the weapon that your Gear was attacked with
- @AttackedByChaingun: Whether or not a you were attacked by a chaingun
- @AttackedByMine: Whether or not a you were attacked by a mine
- @AttackedByMortar: Whether or not a you were attacked by a mortar
- @AttackedDamage: Gets the amount of HP lost during the attack
- @AttackedHeading: Gets the heading from which the attack came from
- @AttackedPosX: Gets the X coordinate from which the attack came from
- @AttackedPosY: Gets the Y coordinate from which the attack came from
Sample:
vars $x, $y
on attacked
{
// fire back next turn
$x = @AttackedPosX
$y = @AttackedPosY
FireMortarAt($x, $y)
}
Editon targetHit
The
on targetHit event is called for every hit your gear deals during a turn. This event is not fired until all hits from all gears has been taken or given.
Useful System Variables for the
on targetHit event.
- @TargetDamage: Gets the amount of HP damaged with an the attack
- @TargetHeading: Gets the heading to the target location
- @TargetHitWith: Gets the name of the weapon that you attacked the Gear with
- @TargetHitWithChaingun: Whether or not a you attacked with a chaingun
- @TargetHitWithMine: Whether or not a you attacked with a mine
- @TargetHitWithMortar: Whether or not a you attacked with a mortar
- @TargetId: Gets the Gear ID of the target
- @TargetName: Gets the heading to the target location
- @TargetPosX: Gets the X coordinate of the target location
- @TargetPosY: Gets the Y coordinate of the target location
Sample:
vars $x, $y
on targetHit
{
// fire again next turn
$x = @TargetPosX
$y = @TargetPosY
FireMortarAt($x, $y)
}
Editon targetMiss
The
on targetMiss event is called each time your gear does not hit it's target. This event is not fired until all hits from all gears has been taken, given, or missed.
Useful System Variables for the
on targetMiss event.
- @TargetMissWith: Gets the name of the weapon that you attacked the Gear with
- @TargetMissWithChaingun: Whether or not a you attacked with a chaingun
- @TargetMissWithMine: Whether or not a you attacked with a mine
- @TargetMissWithMortar: Whether or not a you attacked with a mortar
- @TargetMissX: Gets the X coordinate of the target location
- @TargetMissY: Gets the Y coordinate of the target location
Sample:
on targetMiss
{
if (not @ScannerOn)
{
ScannerOn()
}
}