LuaEvents.wiki
changeset 2231 f00c578955f7
parent 2223 4e49d93377fd
equal deleted inserted replaced
2230:61645d84f13e 2231:f00c578955f7
    81 Because this function is called *before* victories are checked, this is useful to set up your victory conditions here.
    81 Because this function is called *before* victories are checked, this is useful to set up your victory conditions here.
    82 
    82 
    83 === <tt>onSkipTurn()</tt> ===
    83 === <tt>onSkipTurn()</tt> ===
    84 This function calls when a hog skips its turn.
    84 This function calls when a hog skips its turn.
    85 
    85 
    86 === <tt>onCaseDrop(gear)</tt> (1.0.0) ===
    86 === <tt>onCaseDrop(gear)</tt> ===
    87 This function calls between two turns right after the moment at which the game *might* drop a crate according to the game scheme settings. It does not matter if it actually wants to drop a crate.
    87 This function calls between two turns right after the moment at which the game *might* drop a crate according to the game scheme settings. It does not matter if it actually wants to drop a crate.
    88 
    88 
    89 If a crate was dropped, `gear` is the crate gear that was dropped, if no crate was dropped, `gear` is `nil`.
    89 If a crate was dropped, `gear` is the crate gear that was dropped, if no crate was dropped, `gear` is `nil`.
    90 
    90 
    91 This function is useful to add custom crate drops as well.
    91 This function is useful to add custom crate drops as well.
    92 
    92 
    93 === <tt>onSuddenDeath()</tt> ===
    93 === <tt>onSuddenDeath()</tt> ===
    94 This function is called on the start of Sudden Death.
    94 This function is called on the start of Sudden Death.
    95 
    95 
    96 === <tt>onGameResult(winningClan)</tt> (1.0.0) ===
    96 === <tt>onGameResult(winningClan)</tt> ===
    97 This function calls when the game ends with a winner or in a draw. If a clan wins, `winningClan` is the clan ID of the winning clan. If the game ends in a draw, `winningClan` is set to -1.
    97 This function calls when the game ends with a winner or in a draw. If a clan wins, `winningClan` is the clan ID of the winning clan. If the game ends in a draw, `winningClan` is set to -1.
    98 
    98 
    99 === <tt>onAchievementsDeclaration()</tt> ===
    99 === <tt>onAchievementsDeclaration()</tt> ===
   100 This function is called after the stats for the stats screen (after the game) have been generated. You are supposed to call `DeclareAchievement` here.
   100 This function is called after the stats for the stats screen (after the game) have been generated. You are supposed to call `DeclareAchievement` here.
   101 
   101 
   102 === <tt>onHogAttack(ammoType)</tt> ===
   102 === <tt>onHogAttack(ammoType)</tt> ===
   103 This function is called when a hedgehog attacks. Beginning with 0.9.21, the parameter `ammoType` is provided. It contains the ammo type of the weapon used for the attack. 
   103 This function is called when a hedgehog attacks. Beginning with 0.9.21, the parameter `ammoType` is provided. It contains the ammo type of the weapon used for the attack. 
   104 
   104 
   105 Note: If you want to detect when a turn was skipped, use `onSkipTurn()`. There is no guarantee that `onHogAttack(amSkip)` is called in such an event.
   105 Note: If you want to detect when a turn was skipped, use `onSkipTurn()`. There is no guarantee that `onHogAttack(amSkip)` is called in such an event.
   106 
   106 
   107 === <tt>onHogSwitch(oldHog)</tt> (1.0.0) ===
   107 === <tt>onHogSwitch(oldHog)</tt> ===
   108 Called when hogs have been switched using the “switch hedgehog” utility. `oldHog` is the gear ID of the previous hedgehog and the current hedgehog gear ID is stored in `CurrentHedgehog`.
   108 Called when hogs have been switched using the “switch hedgehog” utility. `oldHog` is the gear ID of the previous hedgehog and the current hedgehog gear ID is stored in `CurrentHedgehog`.
   109 
   109 
   110 Note: If you want to detect when a turn was skipped, use `onSkipTurn()`. There is no guarantee that `onHogAttack(amSkip)` is called in such an event.
   110 Note: If you want to detect when a turn was skipped, use `onSkipTurn()`. There is no guarantee that `onHogAttack(amSkip)` is called in such an event.
   111 
   111 
   112 === <tt>onUsedAmmo(ammoType)</tt> ===
   112 === <tt>onUsedAmmo(ammoType)</tt> ===