hit by attack
Details
Kode wheel segment | Combat/Combat Events |
Style | Specialised |
Modifiers | light, medium, heavy, ranged |
Primarily WHEN/DO | WHEN |
Pre-made brains that use it | Unknown |
Combat > Combat Events > hit by attack
Description
This tile is a specialised sensor. It senses when a character is hit by an attack, ranged or melee. This can also be used to determine who dealt a killing blow to assign a score. (See Other Uses)
Example Code
WHEN [hit by attack] DO [play sound][cry]
Modifiers
light: Senses only light attack hits
medium: Senses only medium attack hits
heavy: Senses only heavy attack hits
ranged: Senses only ranged attack hits (such as an arrow)
Other Uses
To determine who gets the kill in a multiplayer environment. In an enemy character brain
WHEN [hit by attack] DO [objvar:my attacker][=][it]
…WHEN [started to][is dead] DO [objvar: my attacker][numvar:score][incremented by][1]
If you want to implement a “You were killed by ….” mechanic (as seen in games such as Destiny)
In every character brain create a text variable that contains the Character’s name as it will be displayed
WHEN [hit by attack] DO [objvar:my attacker][=][it]
…WHEN [started to][is dead] DO [boolvar:dying][=][true]
WHEN [dying] DO
…WHEN [duration timer][4] DO [display][Text: You were killed by ][objvar:my attacker][textvar:name]
…WHEN [countdown timer][4] DO [position][=][IWP:respawn][position]
…/…WHEN DO [revive]