hit by attack

hit by attack



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


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]



lightlight: Senses only light attack hits

mediummedium: Senses only medium attack hits

heavyheavy: Senses only heavy attack hits

rangedranged: 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]

Comments are closed.

Website Powered by WordPress.com.

Up ↑

%d bloggers like this: