Animated textures (aka "sequenced textures") on models are possible now. It's simple to do but is limited by animations. This video will show you the basics. You can grab the blinking raiders patch here.
Hello Rock Raiders. Today I'm going to show you a new kind of mod available in Lego Rock Raiders: sequenced textures. This is something that was previously locked out of the Rock Raiders modding community due to modern versions of Lightwave not exporting the necessary information to make the textures work. Big thanks to @Yellowkey for pointing me to the bits that needed to be edited in order to make this possible.
What are sequenced textures? They are simply animated textures, and the game uses them to great effect already. You can see them in smoke effects and a few particles, but they're not used much beyond that. They can be potentially used on almost any sort of object, but there are a few requirements. I'll go over those before diving into the details.
The following conditions must be met in order for a model to support a sequenced texture:
- The texture files must end with numbers, usually starting with 0000 and increasing by one for each frame, though it is possible to use three numbers and not start with all zeros.
- The model must be directly included in an animation file.
- The model's texture definitions must specify the texture as sequenced.
The first condition is evident where sequences textures are already used. You can look in the World\Shared folder and find textures like Adst001 and ssss0000. These are textures used for various smoke and steam effects, and each file represents one frame of animation. The game automatically finds the beginning and end of each set of images like this, so you do not have to define anything besides the name of the first file.
The second condition is trickier since it's not obvious just by looking at an object. I say "object" instead of "model" here as some objects, like vehicles and monsters, are created using several models that are combined in an animation file. Other objects like crystals, ore, and electric fences are not contained in animation files and cannot use sequenced textures. This also extends to vehicle wheels and upgradeable parts like drills, as they are added on top of the vehicle within the game. They do not exist in the actual animation file. It's possible to check this yourself by opening the animation file, or LWS file, in Notepad and look for the model. If it's defined in the animation, it's ready to accept sequenced textures.
Lastly, the model must specify that its textures are sequenced. This part requires a bit of work, as the only known legal method of inserting this information requires a hex editor. The other method involves flying to Denmark and retrieving the source code from LEGO's vault, which might only be possible if you're a member of the Alpha Team. Luckily, we've identified the values that you need to edit, and it's not hard once you know what to change. This is a mod that anybody can do.
Here I have two models opened side by side in a hex editor. I personally use XVI32, but any hex editor should work. Do you notice some of the differences already? There are four values you have to change. The first three are quite subtle: FORM, which is four bytes long and reflects the total length of the file; SURF, which is also four bytes long and reflects the length of the surface for the texture; and TIMG, which is two bytes long and reflects the length of the file path for the texture's first file. You also have to change the file path to include the text " (sequence)" at the end, and that includes the space in front. This is what tells the game to start animating the texture. You can't stop at that change, as the model will be considered invalid if you do not adjust the lengths in FORM, SURF, and TIMG. All lengths are defined in hexadecimal, so you must either convert them to decimal, add 11, then convert back to hexadecimal, or directly add 0x0B to each number. Note that you must add multiples of this number to FORM for each sequenced texture in the model, as it reflects the entire file length. We are editing two textures in this example, so you must add 22 or 0x16 to FORM. The Windows calculator has a programmer mode which allows you to switch between the two types with a single click. This may be the easiest if you are not familiar with hexadecimal.
Be careful when changing the numbers in the file. Remember that each letter on the right is represented by two hex numbers on the left. If your calculator shows a three digit number, like 1A3, you must add a leading zero when typing it in. Thus 1A3 becomes 01A3. Also remember to overwrite the existing numbers instead of adding new ones in place, or the file will be considered invalid. And always ALWAYS backup your files before doing changes like this.
Alright, we're done. Let's see what it looks like in-game. This model has two planes, with the left plane counting from zero to 24, and the right plane counting from zero to three. The framerate is defined by the global timer, which runs at 25 frames per second. I've slowed the game time down so you can see how the numbers get out of sync with each other, but they always change to the next frame on each tick of the global timer. Please note how the right plane resets to zero early at times. This is because the texture sequence starts over when the animation loops. This leads to odd effects, such as here, where the minifigs only blink when they're doing something other than standing. The standing animation is zero frames long, and the blinking texture is 41 frames long. The blinking does not start until frame 27, so any animation that is not at least that long will not blink.
Written By Cirevam