Backup of Lua/Triggers (1) Back


Back to History list

*トリガ [#t1851d69]

これらはスクリプトがAlephOneが特定の時や出来事で呼ぶように定義できる関数である。

|init(restoring_game)|レベルの最初|restoring_game:保存されたゲームから再開するときは真|
|cleanup()|レベルの最後|主にこれはゲーム後の虐殺レポートの前にネットゲームの点を変える最後のチャンスを意図している|
|idle()|ティック(1/30秒)ごとに、物理などの前||
|postidle()|ティックごとに、物理などの後で、描画の前||
|start_refuel(type, player_index, side_index)|プレーヤーが回復パネルを使い始める前||
|end_refuel(type, player_index, side_index)|プレーヤーが回復パネルを使い終わった後||
|tag_switch(tag, player)|プレーヤーがタグ・スイッチを使うとき|武器(拳骨など)でスイッチを操作したときは呼ばれない|
|light_switch(light, player)|プレーヤーがライト・スイッチを使うとき|武器(拳骨など)でスイッチを操作したときは呼ばれない|
|platform_switch(platform, player)|プレーヤーがプラットフォーム・スイッチを使うとき|武器(拳骨など)でスイッチを操作したときは呼ばれない|
|terminal_enter(terminal_id, player)|プレーヤーがターミナルを使い始めたとき||
|terminal_exit(terminal_id, player)|プレーヤーがターミナルを使い終えたとき||
|pattern_buffer(buffer_id, player)|プレーヤーがパターンバッファを使うとき||
|got_item(type, player)|プレーヤーがアイテムを拾ったとき|さらにスクリプトが.items.add()を使ってアイテムを得たときも|
|light_activated(index)|ライトがオンになったかオフになったとき||
|platform_activated(index)|プラットフォームが起動したか停止したとき||
|player_revived(player)|プレーヤーが生き返ったとき(ネットワークゲームでしか起こらない)||
|player_killed(player, aggressor_player, action, projectile)||

    whenever a player dies

        * aggressor_player: the player who killed player, possibly himself (suicide), or -1 if killed by a non-player
        * action: there are no mnemonics for this at this time, making its use difficult
        * projectile: the projectile that delivered the final blow, or -1 if there is no such projectile

player_damaged(victim_player_index, aggressor_player_index, aggressor_monster_index, damage_type, damage_amount, projectile)

    whenever a player has taken damage, but before he dies if applicable. The player's suit energy or oxygen may be negative when this trigger is called; if it still is when the trigger returns, it will be set to 0. The player's suit energy is tested again after this trigger returns, so a script may prevent a player's death

        * victim_player_index: -1 if the victim was damaged by a non-player
        * aggressor_monster_index: -1 if the victim was damaged by neither a player nor a monster
        * damage_type: one of the Damage Types, e.g. _damage_fusion
        * damage_amount: the amount recently subtracted from the player. If _damage_oxygen_drain, damage_amount was assessed against player's oxygen; else against player's suit energy
        * projectile: the projectile that delivered the damage, or -1 if there is no such projectile

monster_killed(monster, aggressor_player, projectile)

    whenever a monster dies

        * aggressor_player: player index of who killed it, or -1 if killed by non-player
        * projectile: projectile that delivered the final blow, or -1 if there is no such projectile

    This is called after a monster has taken lethal damage, but before it's removed form the monster list. You can use this to find out when a monster created with new_monster dies, but a monster discovered by select_monster may have already taken lethal damage, so you may need to check for that case when using select_monster.
item_created(item_index)

    whenever an item is created and placed on the ground (or floating) somewhere

    Currently, this does not trigger on initial item placement because the initial item placement is done before Lua becomes initialised.
projectile_detonated(type, owner, polygon, x, y, z)

    whenever a projectile detonates, after it has done any area of effect damage