Latest revision |
Your text |
Line 1: |
Line 1: |
| '''HealthJump'''(''frame'', ''comparison'', ''cmphealth'')
| | HealthJump(frame,comparison,health) |
|
| |
|
| This is a frame scripting parameterized codepointer.
| | * frame: name of frame to jump to if the test passes |
| | * comparison: one of the following: |
| | :CPC_LESS |
| | :CPC_LESSOREQUAL |
| | :CPC_GREATER |
| | :CPC_GREATEROREQUAL |
| | :CPC_EQUAL |
| | :CPC_NOTEQUAL |
| | :CPC_BITWISEAND |
| | * health: health value OR counter number |
|
| |
|
| ==Parameters== | | ==Examples== |
| *''frame'': frame to which object may jump (default: '''S_NULL''', will remove object).
| | frame EXAMPLE1 { cmp = "EXPL|A|*|0|HealthJump(EXAMPLE2,CPC_LESS,50)|@next" } |
| *''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 (i.e. operation '''less_counter''' is "Jump if health < counter").
| |
| *''cmphealth'': value to compare health against / counter number holding value (default: 0).
| |
|
| |
|
| ==Purpose==
| | Jump to frame EXAMPLE2 if health less than 50. |
| 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==
| |
| *[[List of codepointers]]
| |
| [[Category:Codepointers]]
| |