HealthJump: Difference between revisions

From Eternity Wiki
Jump to navigationJump to search
No edit summary
Line 19: Line 19:
Causes the object to transfer to the indicated frame if the value in ''cmphealth'' (or the given counter, for operations ending with "'''_counter'''") compares as requested to the object's current health. This allows "frame scripting" of actions which vary depending on how much damage an enemy or other object has received. If the jump does not occur, the object will fall through to the next frame. If the current frame's tics are set to -1, fall-through will not occur.
Causes the object to transfer to the indicated frame if the value in ''cmphealth'' (or the given counter, for operations ending with "'''_counter'''") compares as requested to the object's current health. This allows "frame scripting" of actions which vary depending on how much damage an enemy or other object has received. If the jump does not occur, the object will fall through to the next frame. If the current frame's tics are set to -1, fall-through will not occur.


Notes: Options '''and''' and '''and_counter''', "bitwise and", are most useful for performing an action only if the object's health is even or odd. To perform an action if the health value is odd, set ''cmphealth'' to 1. Use of other values will result in periodic chances for an action, and will require experimentation.
===Notes===
 
Options '''and''' and '''and_counter''', "bitwise and", are most useful for performing an action only if the object's health is even or odd. To perform an action if the health value is odd, set ''cmphealth'' to 1. Use of other values will result in periodic chances for an action, and will require experimentation.


==Example==
==Example==

Revision as of 01:59, 11 November 2019

HealthJump(frame, comparison, cmphealth)

This is a frame scripting parameterized codepointer.

Parameters

  • frame: frame to which object may jump (default: S_NULL, will remove object).
  • comparison: type of comparison to perform on object's health:
  • less or 0 (default): jump if health < cmphealth
  • lessorequal or 1: jump if health <= cmphealth
  • greater or 2: jump if health > cmphealth
  • greaterorequal or 3: jump if health >= cmphealth
  • equal or 4: jump if health equals cmphealth
  • notequal or 5: jump if health does not equal cmphealth
  • and or 6: jump if health & cmphealth (bitwise AND operation)
  • less_counter, lessorequal_counter, greater_counter, greaterorequal_counter, equal_counter, notequal_counter, and_counter (7-13): the value in cmphealth will be interpreted as a counter number (0 - 7). The resulting operation is the health compared against the value of the requested counter, using the corresponding operation (ie. operation less_counter is "Jump if health < counter").
  • cmphealth: value to compare health against / counter number holding value (default: 0).

Purpose

Causes the object to transfer to the indicated frame if the value in cmphealth (or the given counter, for operations ending with "_counter") compares as requested to the object's current health. This allows "frame scripting" of actions which vary depending on how much damage an enemy or other object has received. If the jump does not occur, the object will fall through to the next frame. If the current frame's tics are set to -1, fall-through will not occur.

Notes

Options and and and_counter, "bitwise and", are most useful for performing an action only if the object's health is even or odd. To perform an action if the health value is odd, set cmphealth to 1. Use of other values will result in periodic chances for an action, and will require experimentation.

Example

frame EXAMPLE1 { cmp = "EXPL|A|*|0|HealthJump(EXAMPLE2,less,50)|@next" }

Jump to frame EXAMPLE2 if health is less than 50.

See also