Chapter Four: Sprites and Graphical Data Reference: ICE: Iscript Opcodes Note that this listing maybe out of date with the current version of ICE (many of the unknowns may have already been identified). I will point out some of the opcodes which ICE can interact with specifically. In front of each opcode I will also place the actual hex identifier that it is associated with. For your purposes you can ignore it, but it can help people identify them if their ICE descriptions change. The numbers with % signs in front of them are variables that you can edit (e.g., Play frame %1, is like Play frame XXXX where XXXX is the frame number). 0x00 - Play frame %1: Pretty basic. Play frame number %1 for the main sprite (i.e., frame number in the GRP). If the images.dat entry this animation header is associated with has "turn gfx" checked, then this opcode will play frame %1 plus a number up to 17 and possibly mirroring the frame image, depending on which direction the sprite is facing. (That's why GRP frames are in sets of 17) Otherwise it will play frame %1 specifically no matter what direction the sprite is facing. ICE: If you double click on one of these opcodes it will show the actual frame of the original GRP in the Preview GRP tab. 0x01 - Play frame %1 according to tileset: Slightly unknown. It is used for sprites like the vespene geysers, plays a different frame depending on what tileset this is. Not entirely sure how it is calculated. 0x02 - UNKNOWN OP: 0x02 (Assuming 1 params: 2 bytes): %1 0x03 - Shift graphic position %1 vertical units: Shift the graphic %1 pixels downward from its current position. (Doesn't change frame, just move the current image down) It will remain shifted down %1 pixels until you shift it again; e.g., to shift it back to its original "home" position, use this opcode to shift it with %1 = 0. 0x04 - UNKNOWN OP: 0x04 (Assuming no params) 0x05 - Wait %1 ticks: Wait for %1 tenths of a second before moving on. 0x06 - Wait either %1 or %2 ticks (random):Randomly wait one of 2 times: either wait %1 tenths of a second or wait %2 tenths of a second. 0x07 - Go to offset %1: Go to offset %1 and continue animating from there. ICE: Double Click on one of these opcodes to jump to offset %1. (You can press back to get back to the original script) 0x08 - Place active overlay (images.dat) %1 at vertical offset %2: This opcode spawns an "active" overlay graphic from images.dat entry number %1 on top of the current sprite at a vertical offset of %2 units. An "active" overlay is one that follows the main graphic around (like a shadow graphic). By "spawning" an images.dat graphic, I mean exactly that: a images.dat graphic just like any other images.dat graphic is created. It has its own palette settings, gfx settings, and even its own iscript.bin animation, just like any other images.dat entry. ICE: You can double click on one of these opcodes to display the GRP associated with images.dat entry %1 in the Secondary GRP Preview window. 0x09 - Place active underlay (images.dat) %1 at vertical offset %2: Same as 0x08 but underlay instead of an overlay. (Overlay means over the current graphic, underlay means underneath the current graphic) ICE: You can double click on one of these opcodes to display the GRP associated with images.dat entry %1 in the Secondary GRP Preview window. 0x0A - UNKNOWN OP: 0x0A (Assuming no params) 0x0B - (?) Switch current underlay for underlay (images.dat) %1. Predict to do with powerups: Basically unknown. 0x0C - UNKNOWN OP: 0x0C (Assuming no params) 0x0D - Place overlay (images.dat) %1 at vertical offset %2. Requires LOG file: This will spawn a certain independent overlay images.dat entry %1 at a vertical offset of %2 units. However, this opcode also requires a LO* file associated with the images.dat entry the main graphic is associated with (the LO* file gives it additional coordinates for placing the overlay). Sort of unknown so only mess with it if you know what you're doing. 0x0E - UNKNOWN OP: 0x0E (Assuming no params) 0x0F - Place independent overlay (sprites.dat) %1 at vertical offset %2: This will spawn an independent overlay sprites.dat entry number %1 at a vertical offset of %2. An independent overlay is different from an active overlay in that it does not follow the main sprite around (it is created and then treated as its own sprite, "independent" of what the main sprite does). Usually used for showing explosions on top of a unit that just died. ICE: You can double click on one of these opcodes to display the GRP associated with sprites.dat entry %1 in the Secondary GRP Preview window. 0x10 - Place independent overlay (sprites.dat) %1, over everything below this anim level, at vertical offset %2: This is just like 0x0F, but instead of spawning the sprite at an animation level just above the current main sprite, it is spawned on top of all sprites (top animation level). ICE: You can double click on one of these opcodes to display the GRP associated with sprites.dat entry %1 in the Secondary GRP Preview window. 0x11 - Place independent underlay (sprites.dat) %1 at vertical offset %2: Just like 0x0F and 0x10, but an underlay instead of an overlay graphic. (Underneath all sprites, the lowest animation level) Usually used for displaying "rubble" or dead bodies sprites after a unit is killed. ICE: You can double click on one of these opcodes to display the GRP associated with sprites.dat entry %1 in the Secondary GRP Preview window. 0x12 - UNKNOWN OP: 0x12 (Assuming no params) 0x13 - Display overlay (sprites.dat) %1 with vertical offset %2. Requires LO* file: Sort of Unknown. Requires additional coordinates from a LO* file. 0x14 - UNKNOWN OP: 0x14 (Assuming no params) 0x15 - Display overlay (sprites.dat) %1 with unknown var %2. Requires LOG file: Sort of Unknown. Basically a spawn sprites.dat graphic as an independent overlay, but requiring coordinates from a LO* file. 0x16 - End animation, remove graphic: Just what it says, end the animation and remove the sprite. It will never come back ever again. :| 0x17 - UNKNOWN OP: 0x17 (Assuming no params) 0x18 - Play sound (sfxdata.dat) %1: Play a sound entry from sfxdata.dat, entry number %1. ICE: double click on one of these to add the associated sound to the WAV Preview list so you can actually hear it. 0x19 - Randomly play one of %1 sounds (sfxdata.dat): %2 or %3 or %4 or...: This is like 0x18 but will play one of several sounds at random. For example, say you have 2 sounds you might want to play (though only one of them will actually be played), then %1 would be 2. And then the next variables %2 and %3 would be the actual sfxdata.dat entry numbers of your sounds. If you had 3 sounds to play at random, you would have one more variable %4. Etc. ICE: double click on one of these to add the associated sounds to the WAV Preview list so you can actually hear it. 0x1A - Randomly play a sound (sfxdata.dat) between entries %1 and %2: Just like 0x18 and 0x19, but play a sound from sfxdata.dat randomly between entry %1 and %2 (inclusive). So if you had %1 as 10 and %2 as 20, then this opcode randomly plays sound 10, 11, 12, ...., 19, or 20. 0x1B - Do damage (missiles): This opcode is specifically for missile sprites in their attack animations. Basically, at this point it will do damage to its target. 0x1C - Attack with %1 (1 = Ground, else Air) and play sound %2 (0 = no sound): This opcode is used in attack animations. Basically, it makes the unit associated with this sprite "attack" (do damage or shoot out a missile). If %1 is 1 then it will attack with its ground weapon (specified in units.dat) otherwise it will attack with its air weapon. In addition, at the same moment it will play sound from sfxdata.dat entry number %2. 0x1D - Follow frame changes of main graphic (underlay opcode for shadows): This opcode is used in the initial animations of certain sprites which are normally called as active overlay or underlay graphics by other sprites (like shadows). It informs the sprite to "follow the frame changes" of the main graphic it is an overlay/underlay for. E.G., say this is on a shadow sprite and the shadow is spawned as an active underlay by its main unit sprite. When the unit sprite plays frame 1, this overlay/underlay will also play frame 1, when it plays frame X, this will also play frame X. Etc. 0x1E - Using randomizer value (?) %1, jump to offset %2: Basically, generate a random number (somehow related to the randomizer variable %1) and then if that random number is within a certain range, then goto offset %2. Otherwise just skip this opcode. This is useful to get randomized animation routines playing (such as the marine and firebat's gun pointing and turning animations when idle). 0x1F - Turn graphic %1 frames counterclockwise: Change the direction the current sprite is facing by turning it %1 frames counterclockwise (in more technical terms, that means play the frame that is %1 backward from the current frame in the GRP, and maybe mirrored). 0x20 - Turn graphic %1 frames clockwise: Same as 0x1F but turn frames clockwise (forward in the GRP frameset). 0x21 - Turn graphic 1 frame clockwise: Same as 0x20 but specifically only turn 1 frame. 0x22 - Turn graphic %1 frames in a random direction: Same as 0x1F and 0x20, but turn randomly either clockwise or counterclockwise. 0x23 - UNKNOWN OP: 0x23 (Assuming no params) 0x24 - (?) Send signal to unit for order: %1: This is a very important opcode, but I'm really not very sure what it does. Essentially, it sends some sort of signal (variable %1) to the game which tells it something. But I'm not sure what that is. If you see this in one of the original animations you are editing, it may be a good idea to keep it there in some place or another. 0x25 - Attack with %1 (1 = Ground, else Air): This opcode is used in attack animations. Basically, it makes the unit associated with this sprite "attack" (do damage or shoot out a missile). If %1 is 1 then it will attack with its ground weapon (specified in units.dat) otherwise it will attack with its air weapon. You can "attack" more than once in an animation to do multiple damage/shots (a'la the valkyrie). 0x26 - Attack with appropriate weapon: Same as 0x25, but you don't have to specify the weapon. (It will attack with the ground weapon if attacking a ground unit, otherwise attack with the air weapon) 0x27 - Cast Spell: Used in spell casting animations (specifically Special Ability Animation 2 usually). At the point when this opcode is called, the actual spell or special ability will be "cast" (shoot the weapon or start whatever action associated with the spell). 0x28 - Use weapon (weapons.dat) %1: This opcode forces the unit associated with this sprite to "attack" its target with weapon number %1 in weapons.dat. Normally this is used in the harvesting animation of peons to make them "attack" minerals with their harvesting weapon (same as their normal weapon actually). But it works just fine in other animations which assume the unit has a target. 0x29 - Move graphic %1 units forward: Used specifically in the walking animation to move the sprite %1 units forward in the direction it is facing. 0x2A - (?) Goto Repeated Attack if still attacking: It is believed that this opcode tells the sprite where it should continue looping an attack animation if its target is still alive. For example, you would place this at the end of the Initial and Repeated Attack animations. When the sprite gets to this point in the animation, it checks to see if its target is still alive and then goes to the Repeated Attack Animation if it still is (otherwise it goes to the Return to Idle from Ground/Air Attack). If this opcode is not present, the unit will not loop its attack. 0x2B - UNKNOWN OP: 0x2B (Assuming no params) 0x2C - UNKNOWN OP: 0x2C (Assuming no params) 0x2D - UNKNOWN OP: 0x2D (Assuming no params) 0x2E - Begin unbreakable code section: This opcode is paired with 0x2F (you start an unbreakable section of code with 2E and end it with 2F). When a sprite entered an "unbreakable" section of code, it will not be able to carry out any other order given to it by the player except for special canceling orders like stop (e.g., during a battle cruiser's yamoto gun shot). This is used in many attack animations to "enclose" the start an end of the attacking animation (because otherwise players could manipulate the animation and only let the part of the anim play through until the "attack" and then skip the rest and start over again). 0x2F - End unbreakable code section: See previous (0x2E). 0x30 - (?) Ignore other opcodes: Unknown. Appears to cause the rest of the opcodes in this routine be ignored (except for goto opcodes). 0x31 - Attack with projectile spawned from angle %1: Sort of Unknown. This causes the unit to attack with its appropriate weapon (if it is a projectile or missile weapon) like 0x25 but the missile will appear from an angle designated by %1. 0x32 - Temporarily remove graphic: This will cause the sprite to be "temporarily removed" until it comes back with the 0x33 opcode. "Temporarily removed" means it becomes invisible. 0x33 - Play graphic again after temporarily removed (by op 0x32): This opcode again makes a sprite visible after being removed by 0x32. 0x34 - Play specific frame %1: This opcode is like 0x00, but it will always play a specific frame number %1 (even if the images.dat entry associated with this animation header has gfx turns checked). I.E., it will not add upto 17 frames or mirror the graphic depending on what direction it is facing. 0x35 - If (?) unknown then goto offset %1: Unknown. 0x36 - UNKNOWN OP: 0x36 (Assuming no params) 0x37 - UNKNOWN OP: 0x37 (Assuming 1 param: 2 bytes): %1 0x38 - UNKNOWN OP: 0x38 (Assuming 1 param: 1 byte) Predict something to do with LOS file 0x39 - If picked up (powerup) goto offset %1: Sort of unknown. Normally is opcode is in the initial animations of powerups. When a powerup is picked up, it is kind of "spawned again" in the hands of the peon. This opcode tells the animation of the powerup to go to offset %1 if it is picked up (as opposed to on the ground). If it isn't picked up, this is ignored. 0x3A - If target within range of %1 (pixels?) goto offset %2: This is used in certain attack animations (such as the regular archon's). Basically, when the animation gets to this point, if the sprite's target is within range of %1 pixels (maybe different unit of measurement), then goto offset %2. Otherwise if the target is not within range then ignore this opcode. This is useful if you want a unit (like the archon) to have different attack animations for units that are at different distances away (at different distances, for example, the archon's energy attack has a different length tail). You can use a little logic and combine these as well for attacks at many different distances (e.g., If target within 5 then goto X, else if unit is within 10 goto Y, else if unit is within 15 goto Z, else... etc.). 0x3B - If target in arc with starting angle at %1 clockwise from -45 degrees, until %2 degrees, goto offset %3: This opcode is a bit complicated. It is normally used for attack animations for units such as the sunken colony. It helps if I draw a picture (which may be a bit off, but you'll get the idea).
This opcode goes to a certain offset %3 if the current sprite's target is within the range of angle %1 and %2. Otherwise it will ignore this opcode. The picture illustrates the best. What this is useful for is if you have a unit which maybe stationary (like the sunken colony), but you want it to have different attack animations depending on which direction its target is in. 0x3C - UNKNOWN OP: 0x3C (Assuming 1 param: 2 bytes): %1 0x3D - UNKNOWN OP: 0x3D (Assuming 1 params: 2 bytes): %1 0x3E - UNKNOWN OP: 0x3E (Assuming no params) 0x3F - If (?) unknown go to offset %1: Unknown. 0x40 - UNKNOWN OP: 0x40 (Assuming 1 params: 2 bytes): %1 0x41 - UNKNOWN OP: 0x41 (Assuming 1 params: 1 byte): %1 0xFF (not really) - Unidentified Op > 0x41. See Readme file. Assuming len=1: If you get this Unknown Error opcode it means ICE is misinterpreting something and there is an error or something is wrong with your script. [Lasted Updated: 01-30-00] |
Copyright (c) 1999-2000 Jeffrey Pang.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1
or any later version published by the
Free Software Foundation with no Invariant Sections, with no
Front-Cover Texts, and with no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
[an error occurred while processing this directive]