RandomJump: Difference between revisions

From Eternity Wiki
Jump to navigationJump to search
(New page: Arguments: *'''misc1''': frame mnemonic or frame dehacked number to jump to *'''misc2''': chance out of 256 to execute the jump This codepointer causes the current frame to jump ''instan...)
 
No edit summary
Line 4: Line 4:
*'''misc2''': chance out of 256 to execute the jump
*'''misc2''': chance out of 256 to execute the jump


This codepointer causes the current frame to jump ''instantly'' to another frame (set by '''misc1''') if chance '''misc2'''/256 is passed. Unlike the similar ZDoom "A_Jump" function, the order of parameters is reserved, and the target frame is set absolutely, not in relation to current frame. For example:
This codepointer causes the current frame to jump ''instantly'' to another frame (set by '''misc1''') if chance '''misc2'''/256 is passed. Unlike the similar ZDoom "A_Jump" function, the order of parameters is reversed, and the target frame is set absolutely, not in relation to current frame. For example:


  frame monster_decide
  frame monster_decide

Revision as of 08:57, 12 February 2010

Arguments:

  • misc1: frame mnemonic or frame dehacked number to jump to
  • misc2: chance out of 256 to execute the jump

This codepointer causes the current frame to jump instantly to another frame (set by misc1) if chance misc2/256 is passed. Unlike the similar ZDoom "A_Jump" function, the order of parameters is reversed, and the target frame is set absolutely, not in relation to current frame. For example:

frame monster_decide
{
   action    randomjump
   misc1     monster_attack
   misc2     100               #100/256 probability to jump to monster_attack
   tics      10
   nextframe monster_continue_etc  
  
   # caution: wait normally 10 tics before nextframe, OR jump instantly to monster_attack
   # in practice, tics 0 is used, so that all durations are consistent with each other
}

See also