Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • 0
Darch

Why is RandomJump always picking the same frame at first?

Question

I'm trying to use MBF's random jump to spawn one of two things in a map, randomly of course. The problem is, it always goes to the same frame at first. If it randomizes several times, it works properly, but it's no use since my intention was to spawn an static object, only once. Just as a test, I picked the flaming skull slot, because it has 3 states. The first one is the randomizer. Then it should go randomly to the second state (a tree) or the third state (a lamp). In this test , I made them go back to the first state,  just to try to understand what was going on. The skulls always turn into trees at first, then they start randomizing. This is the code and there's a test wad attached:

 

Frame 921   // skulls
Duration = 100
Unknown 1 = 923   
Unknown 2 = 128  // even if I change this to 255  (100% go to lamp state), it still picks trees at first

 

Frame 922   // tree
Duration = 200
Next frame = 921
Sprite number = 115
Sprite subnumber = 32768

 

Frame 923  // lamp
Duration = 200
Sprite number = 117
Sprite subnumber = 32768

[CODEPTR]
FRAME 921 = RandomJump

random jump test.rar

Edited by Darch

Share this post


Link to post

2 answers to this question

Recommended Posts

  • 1

The issue is a very old one. The issue is about when an actor state plays its associated codepointer when the actor enters this state. But when the actor is spawned, it is created in its spawn state, it doesn't enter its spawn state.

 

To "fix" your issue, all your need to do is this:

Frame 921
Duration = 100
Unknown 1 = 923
Unknown 2 = 128
Next frame = 921

This will make frame 921 loop on itself. You'll notice lamps appearing. Of course, now the problem is that they will not turn to trees at all anymore!

 

Ultimately what I'd suggest is having frame 921 last 0 tics, have frame 922 (the "tree" frame) contain a random jump instruction for frame 923, and leave frame 923 as the "lamp" frame. Give frame 922 and 923 a duration of -1 so they're infinite. If a tree decides to jump, it will jump immediately (jumps do not happen at the end of the frame's length, but immediately) so you will not get to see a tree turning into a lamp. If the tree does not decide to jump, it will stay a tree forever. A lamp will stay a lamp forever. The skull candle frame will never be seen and is there only to absorb the spawn state's incapacity to run codepointers at spawn.

Share this post


Link to post
  • 0

Thank you @Gez, that did work. MBF edit text file says: "Note that the frame's tics field must not be -1, for this to work correctly" but it worked anyway.  I only had to change frame 921 duration to 1 instead of 0, because 0 tics gave me 100% skulls. But that's good enough, thank you!

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×