Intelligent Gear WIKI

Forum | Base Ship Commander | Gear Combat Arena

Arena Script Events

Modified: 2008/03/11 15:22 by ellerbus - Categorized as: Gear Combat Arena

Table of Contents [Hide/Show]


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.

Edit

on 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
}


Edit

on 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
   }
}


Edit

on 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.

  1. @EnemyAppearsDrained: Looking at the Gear it 'appears' that its EP is low
  2. @EnemyAppearsWeak: Looking at the Gear it 'appears' that its HP is low
  3. @EnemyCount: Gets count of total enemy gears that have been scanned
  4. @EnemyDistance: Gets the distance to the enemy gear currently being scanned
  5. @EnemyHeading: Gets the heading of the enemy gear currently being scanned
  6. @EnemyId: Gets the ID of the enemy gear currently being scanned
  7. @EnemyName: Gets the name of the enemy gear currently being scanned
  8. @EnemyPosX: Gets the X coordinate of the enemy gear currently being scanned
  9. @EnemyPosY: Gets the Y coordinate of the enemy gear currently being scanned
  10. @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
}


Edit

on 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.

  1. @MineCount: Gets count of total mines that have been scanned
  2. @MineDistance: Gets the distance to the mine currently being scanned
  3. @MinePosX: Gets the X coordinate of the mine currently being scanned
  4. @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
}


Edit

on 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.

  1. @ActionSelected: Whether or not an action has been selected
  2. @ChaingunAimX: Gets the current X coordinate that the chaingun is aimed at
  3. @ChaingunAimY: Gets the current Y coordinate that the chaingun is aimed at
  4. @ChaingunAmmo: Gets the current amount of ammo available to the chaingun
  5. @ChaingunCluster: Gets the current cluster value of the chaingun
  6. @ChaingunMaxAmmo: The maximum amount of ammo that is carried by the chaingun for a match
  7. @ChaingunMaxCluster: Gets the maximum cluster value available to the chaingun
  8. @ChaingunRange: Gets the range of the chaingun
  9. @CloakIsOn: Whether or not the cloak is on
  10. @EnemyCount: Gets count of total enemy gears that have been scanned
  11. @EP: Gets the current EP available
  12. @EpRecharge: Gets the EP recharge rate
  13. @EpToDropMine: Gets the amount EP required to drop a mine
  14. @EpToFireChaingun: Gets the amount of EP required to fire the chaingun
  15. @EpToFireMortar: Gets the amount of EP required to fire the mortar
  16. @EpToFly: Gets the EP required to fly per 1 map unit
  17. @EpToMove: Gets the EP required to move
  18. @EpToRepair: Gets the amount of EP required to repair
  19. @EpToRun: Gets the EP required to run
  20. @EpToScan: Gets the EP required to scan
  21. @EpToTurn: Gets the EP required to turn 15 degrees
  22. @EpToUseCloak: Gets the amount of EP required to run the cloak per turn
  23. @EpToUseShields: Gets the amount of EP required to run the shields per turn
  24. @GearsInArena: The total count of gears currently in the arena (your gear is included)
  25. @GearsInMatch: The total count of gears in the current match, use # @GearsInArena to determine the number alive
  26. @Heading: Gets the current heading
  27. @HP: Gets the current amount of HP
  28. @HpRepair: Gets the HP repair rate
  29. @Id: Gets the ID of your gear
  30. @Initiative: The initiative value used to sort the current turn
  31. @MaxEP: Gets the maximum amount of EP that can be stored
  32. @MaxFlyDistance: Gets the current maximum flying distance based on current EP
  33. @MaxHP: Gets the maximum amount of HP that can be stored
  34. @MaxMoveDistance: Gets the current maximum move distance
  35. @MaxRunDistance: Gets the current maximum run distance
  36. @MaxX: The maximum X coordinate of the map
  37. @MaxY: The maximum Y coordinate of the map
  38. @MineAmmo: Gets the amount of mines currently available to drop
  39. @MineAOE: Gets area of effect radius for a mine
  40. @MineCluster: Gets the current cluster value of the mortar
  41. @MineCount: Gets count of total mines that have been scanned
  42. @MineDelay: Gets the number of ticks currently set for the mine delay
  43. @MineDistance: Gets the distance to the mine currently being scanned
  44. @MineMaxAmmo: The maximum amount of ammo that is carried by the mine for a match
  45. @MineMaxCluster: Gets the maximum cluster value available to the mortar
  46. @MineProximity: Gets the proximity range of a mine
  47. @MinesDetonated: Gets the number of mines that have been detonated
  48. @MinesDropped: Gets the amout of mines that have been dropped
  49. @MinX: The minimum X coordinate of the map
  50. @MinY: The minimum Y coordinate of the map
  51. @MortarAimX: Gets the current X coordinate that the mortar is aimed at
  52. @MortarAimY: Gets the current Y coordinate that the mortar is aimed at
  53. @MortarAmmo: Gets the current amount of ammo available to the mortar
  54. @MortarAOE: Gets area of effect radius for the mortar
  55. @MortarCluster: Gets the current cluster value of the mortar
  56. @MortarMaxAmmo: The maximum amount of ammo that is carried by the mortar for a match
  57. @MortarMaxCluster: Gets the maximum cluster value available to the mortar
  58. @MortarRange: Gets the range of the mortar
  59. @Name: Gets the name of your gear
  60. @PosX: Gets the current X coordinate
  61. @PosY: Gets the current Y coordinate
  62. @ScannerOn: Whether or not the scanner is on
  63. @ScanRange: Gets the range of the scanner
  64. @ShieldsAreOn: Whether or not the shields are on
  65. @Turn: The current turn of the match
  66. @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)
}


Edit

on 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.

  1. @AttackedBy: Gets the name of the weapon that your Gear was attacked with
  2. @AttackedByChaingun: Whether or not a you were attacked by a chaingun
  3. @AttackedByMine: Whether or not a you were attacked by a mine
  4. @AttackedByMortar: Whether or not a you were attacked by a mortar
  5. @AttackedDamage: Gets the amount of HP lost during the attack
  6. @AttackedHeading: Gets the heading from which the attack came from
  7. @AttackedPosX: Gets the X coordinate from which the attack came from
  8. @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)
}


Edit

on 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.

  1. @TargetDamage: Gets the amount of HP damaged with an the attack
  2. @TargetHeading: Gets the heading to the target location
  3. @TargetHitWith: Gets the name of the weapon that you attacked the Gear with
  4. @TargetHitWithChaingun: Whether or not a you attacked with a chaingun
  5. @TargetHitWithMine: Whether or not a you attacked with a mine
  6. @TargetHitWithMortar: Whether or not a you attacked with a mortar
  7. @TargetId: Gets the Gear ID of the target
  8. @TargetName: Gets the heading to the target location
  9. @TargetPosX: Gets the X coordinate of the target location
  10. @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)
}


Edit

on 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.

  1. @TargetMissWith: Gets the name of the weapon that you attacked the Gear with
  2. @TargetMissWithChaingun: Whether or not a you attacked with a chaingun
  3. @TargetMissWithMine: Whether or not a you attacked with a mine
  4. @TargetMissWithMortar: Whether or not a you attacked with a mortar
  5. @TargetMissX: Gets the X coordinate of the target location
  6. @TargetMissY: Gets the Y coordinate of the target location

Sample:

on targetMiss
{
   if (not @ScannerOn)
   {
      ScannerOn()
   }
}

ScrewTurn Wiki version 2.0.22. Some of the icons created by FamFamFam.