IMAGE LINKING PT. 2Animation Calling, Image Linking tabsldcv's Iscript DecompilerImage linking is a system that forcibly adds an additional image(s) onto a sprite. This can be done through a variety of methods but, depending on the image added, usually involves chaining multiple images with an iscript that has the
imgulnextid opcode. There are many applications for image linking both aesthetic and practical. Here are opcodes that create images:
- Imgol, creates image overlay. Creates image over the target image. Used for a variety of purposes.
- Imgul, creates image underlay. Creates image under the target image. Used mostly for shadows.
- Imgolorig, exclusive to BC iscript 66. Probably creates image overlay using lo offsets.
- Imgoluselo, creates image overlay using lo offsets. Requires .lo* file for image or crash. Used for turrets and attack overlays.
- Imguluselo, exclusive to unknown iscript 316. Requires .lo* file for image or crash.
- Imgulnextid, creates image underlay of the next ID in the image ID list. Exclusive to iscripts 151, 337, and 387.
There are several methods that can be used to create images. The best method used will depend on the image you want created and may require a combination of methods.
- Opcodes. The opcode on an iscript creates an image either through its init sequence or from a specific order being called.
- Status overlay, morphing. Unit morphs to itself to update drawing of status overlays. Example of vulture shadow here.
- Status overlay, casting. Another unit with map wide range targets another unit to apply the overlays. This does not require morphing but does require a caster unit. Draw if cloaked unchecked flag works but only if the unit isn't cloaked when the status overlay is applied.
- Shield overlay. If the unit has shields and is hit it will create image 424.
- Engine overlay. If the unit has an iscript that creates an engine overlay this will be create when walking.
- Attack overlay. If the iscript uses the imgoluselo opcode e.g. siege turret overlay (537), archon attack overlay (549) the associated image will be created at an offset. Again, the image requires .lo* files or it will crash.
- Power up pickup. Not generally useful but included in this list since it does create an image overlay.
ArchonEnergyInit:
bunch of playfram and waits...
imgol 135 0 0 # ArchonBeing (protoss\archonT.grp)
imgol 136 0 0 # ArchonTeamColors (protoss\archonT2.grp)
sigorder 4
nobrkcodeend
wait 2
For the first example let's do something very simple and also a bit messy. The goal would be to add the archon swirl image (136) around a firebat image (226). Above is the archon energy iscript (147) that creates images 135 and 136 on init.
Datedit > Unit > [032] Terran Firebat > Advanced > Permanent Cloak > Checked
//we will cloak the unit so images we don't want on the sprite wont be visibleDatedit > Image > [226] Firebat > Graphic Properties > Draw Function > 1 Unknown1
//allows firebat to have a normal draw if cloakedDatedit > Image > [227] Firebat Shadow > General Properties > Draw if Cloaked > Checked
//we want this shadow image to be visible if cloakedDatedit > Image > [135] Archon Being > General Properties > Use Full Iscript > Unchecked
//prevents image from calling any animation other than init and deathDatedit > Image > [135] Archon Being > General Properties > Draw if Cloaked > Unchecked
//we dont want this image to be visibleDatedit > Image > [136] Archon Swirl > Graphic Properties > Draw Function > 1 Unknown1

We give the firebat unit order 148, which will animation call 0 or init animation to create another firebat shadow image. The firebat shadow image iscript is changed to archon energy iscript (147) which creates the archon swirl image we want. The reason why we create this image after the firebat has been created is because sigorder will crash if it's in an init block and the image was created on the same frame as the unit.

The firebat does have all the things we want. However, it has a lot of unnecessary images and it's also cloaked so this particular unit we made wont be useful in many cases. In future examples we'll properly clean up images so they can be fully functional, or as close to it as we can get. Let's review all the images on this unit's sprite:
- [226] Firebat
- [227] Firebat Shadow
- [227] Firebat Shadow, iscript 147 invisible
- [135] Archon Being, invisible
- [136] Archon Swirl, invisible

For the next example let's go with something intermediate, a kakaru that can attack like a mutalisk. You could do something easy like put the mutalisk iscript (23) on the kakaru image (954) but the animations aren't an exact match and it would look a bit weird. Basically the end goal is to have a unit with both the kakaru image (954) and mutalisk iscript (23) on it.
We will first need to consider what the parent/primary image/main graphic will be. This is the image that is first created on a sprite and the one that dictates the frames of shadows and engines. Because we want a kakaru that looks normal we must use the kakaru image (954) with the kakaru iscript (376) as our primary image.
Datedit > Unit > [043] Zerg Mutalisk > Graphics > Flingy > 199 Kakaru (Twilight)
We will use a mutalisk instead of a kakaru as our unit since this unit already has the weapons and other data needed to support attacking. We change the flingy so its movement and image is the same as a kakaru's.
Datedit > Image > [954] Kakaru (Twilight) > General Properties > Use Full Iscript > Unchecked
The kakaru iscript does not support attack animations. Unchecking prevents the use of any animation other than init and death.
We will need to add an image with the mutalisk iscript (23) to the kakaru sprite. Because this image is only needed for the iscript and we don't want it to be visible we'll use a small image. We'll use the casting status overlay method.
BengalaasInit:
imgul 343 0 0 # BengalassShad (neutral\njcShad.grp)
Datedit > Image > [381] Irradiate (Medium) > Graphic Properties > Iscript ID > 200 Bengalaas(Jungle Critter)
When the irradiate image is created it will create the Bengalaas (Jungle) Shadow image (343). The size of a status overlay is dependent on advanced unit flags, with small being the default.
Datedit > Image > [343] Bengalaas (Jungle) Shadow > Graphic Properties > Iscript ID > 23 Mutalisk
Datedit > Image > [343] Bengalaas (Jungle) Shadow > General Properties > Use Full Iscript > Checked
We'll put the mutalisk iscript on the bengalaas shadow and check
use full iscript so it can play attack animations.
Datedit > Order > [143] Cast Spell (Irradiate) > Energy > 44 None
Remove energy requirements for casting this spell.
Datedit > Weapon > [034] Irradiate > Weapon Range > Max > 11585
Datedit > Weapon > [034] Irradiate > Attack Angle > 255
On a 256x256 map this is the value that allows map-wide weapon range. Range is counted in pixels and a single tile is 32x32. Angle allows the weapon to be used faster since it doesn't need to turn to face the target.

The ghost will cast irradiate on the mutalisk which creates an image with the mutalisk iscript which supports attacking animations. The irradiate status timer is set to 1, it must be allowed to expire to remove irradiate image.

This works. The unit has the kakaru image and can attack and move around no problem. There's a few things we need to clean up. Let's review all the images that this unit's sprite has:
- [954] Kakaru (Twilight), primary image
- [955] Kakaru (Twilight) Shadow
- [381] Irradiate (Medium), removed because timer went to 0
- [343] Bengalaas (Jungle) Shadow
- [039] Mutalisk Shadow
We can clean up our images by either hiding or removing the ones we don't want. The bengalaas shadow image (343) is required since this is the image that has the mutalisk iscript (23) which is responsible for attacking. There are a number of different ways to approach this detailed in the
Hiding/Removing images section here. Let's remove/hide images 39 and 343.
Datedit > Image > [039] Mutalisk Shadow > Graphic Properties > Iscript ID > 250 Siege Tank(Tank) Turret Overlay
This removes the image after 2 frames.
Datedit > Image > [343] Bengalaas (Jungle) Shadow > Graphic Properties > Function > 8 EMP Shockwave
Makes our small image even less visible.

Everything looks fine. Because the bengalaas shadow uses the mutalisk iscript the death animation would still play. You can further clean this up with the process detailed in the vulture section
here or just hide and change the iscript of image 41 if you're fine with the death sound.

Let's make something complicated and cool with image linking. The missile turret image has a second unused frame set which was originally supposed to be for damaged buildings or something. Let's make a missile tank with this.

If we simply change the siege tank turret image (251) to the the missile turret image (297) you'll see that its too high because the missile turret image isn't centered. We'll need to offset its Y position. Here's the goals of our missile tank:
- Offset turret Y position on unit sprite
- Allow the siege tank to attack air and ground
- Darken siege tank base so it matches the turret better
- Clean up unnecessary images

First we'll work on the Y position. Shadows are naturally offset for this axis for unit iscripts that are hovering or in the air. However, air units offset by 42 pixels which is too much so we'll use iscripts from hovering units which is only 7. A list of iscripts and offsets can be found
here under the
image offsets tab. If an image offset exceeds the bounds of the sprite it will reset its offset at the center but if the offset is greater than a certain amount it will wrap around and be offset in -Y position... probably. A sprite's bounding box is 256x256.

We'll take a couple screenshots in datedit and open them in an image editor to count how many pixels we need to offset it by. It's not recommended to count pixels from in-game screenshots as RM does upscaling. It looks like 10 pixels seems decent so we'll use 2 iscripts from the list to offset our missile turret. There's also the offsets from the .lo* file to consider. I tried offsetting by 14 pixels but it was a bit too low.
Datedit > Sprite > [241] Siege Tank (Tank) Turret > Image > 233 Nuke Target Dot
//changes siege tank turret image to nuke dot image, we want a small image so we can hide it laterDatedit > Image > [233] Nuke Target Dot > Graphic Properties > Iscript ID > 39 Infested Command Center
//the reason why we are using ICC iscript will be explained laterDatedit > Image > [233] Nuke Target Dot > General Properties > Use Full Iscript > Unchecked
//prevents image from using any animations other than init/deathDatedit > Image > [101] Infested Command Center Overlay > Graphic Properties > Iscript ID > 156 Probe
//nuke dot image creates a probe shadow offset by 7 pixels on initDatedit > Image > [138] Probe Shadow > Graphic Properties > Iscript ID > 11 Drone
//probe shadow image creates a defiler shadow offset by 3 pixelsDatedit > Image > [014] Defiler Shadow > Graphic Properties > Iscript ID > 117 Machine Shop
//defiler shadow image creates machine shop shadow imageDatedit > Image > [295] Machine Shop Shadow > Graphic Properties > Iscript ID > 337 Doodad Header(secondary)
//imgulnextidDatedit > Image > [296] Missile Turret (Base) > Graphic Properties > Iscript ID > 337 Doodad Header(secondary)
//imgulnextid, creates missile turret imageDatedit > Image > [297] Missile Turret (Turret) > Graphic Properties > Iscript ID > 224 Gas Sac2
//Uses frame set 1 (0x11) to get the darker turretDatedit > Image > [297] Missile Turret (Turret) > General Properties > Use Full Iscript > Unchecked
//prevents this image from calling invalid animations
There will be a lot of images we dont want so I'll just uncheck
draw if cloaked and cloak the tank base for now to hide them. We can clean these up properly later. The tank looks good so far besides the rock doodads that follow it.

Next we'll work on making the tank base darker. To get the tank base image we will need to create an overlay with the SCV iscript (84) and not use its shadow since this would offset it by 7 pixels. Instead we'll use the glow which has no offset. Because status overlays will apply over the subunit sprite as well we can't use them for this. To get the look we want we will have the parent image use draw function 10 and an underlay with draw function 0.
Datedit > Image > [250] Siege Tank (Tank) Base > Graphic Properties > Draw Function > 10 Shadow
Datedit > Image > [252] Siege Tank (Tank) Base Shadow > Graphic Properties > Iscript ID > 84 SCV
Datedit > Image > [252] Siege Tank (Tank) Base Shadow > General Properties > Use Full Iscript > Checked
//Allows tank base shadow to create SCV glow image when move animation is calledDatedit > Image > [249] SCV Glow > Graphic Properties > Iscript ID > 337 Doodad Header(secondary)
//imgulnextid, creates tank base image
After the siege tank unit is created, we reset the tank shadow to its default values to prevent a feedback loop. The tank base image draw function is also changed to 1 to make it opaque as the unit is still cloaked.

Now that we have the final look of our missile tank we need to allow the tank to attack both air and ground.
InfestedCommandCenterInit:
imgul 277 0 0 # CommandCenterShad (terran\tccShad.grp)
imgol 101 0 0 # InfestedCommandCenterOverlay (zerg\Infest03.grp)
I discovered that if an image is more than 6? images from the parent it wont be able to attack. Because of this we are using the infested command center iscript on the nuke dot to make our attacking image only 1 away from the parent.
Pwrupcondjmp opcode may also do something weird to prevent attacks I'm not sure.
ValkyrieGndAttkInit:
wait 1
attackwith 1
gotorepeatattk
goto ValkyrieLocal00
ValkyrieAirAttkInit:
wait 1
nobrkcodestart
attackwith 2
wait 10
attackwith 2
wait 10
attackwith 2
wait 10
attackwith 2
wait 10
nobrkcodeend
gotorepeatattk
goto ValkyrieGndAttkToIdle
I'll use the valkyrie iscript (362) for this since it has both ground and air attacks as well as no sounds when attacking.
Datedit > Image > [277] Command Center Shadow > Graphic Properties > Iscript ID > 87 Spider Mine
//creates spider mine shadow image, we want a small image for our attacking iscriptDatedit > Image > [259] Spider Mine Shadow > Graphic Properties > Iscript ID > 362 Valkyrie
//will allow the turret subunit to attack ground and airDatedit > Image > [259] Spider Mine Shadow > General Properties > Use Full Iscript > Checked
//allows image to use attack animationsDatedit > Unit > [006] Siege Tank Turret (Tank Mode) > Weapon > Ground > 15 Gemini Missiles
Datedit > Unit > [006] Siege Tank Turret (Tank Mode) > Weapon > Air > 103 Halo Rockets

Datedit > Weapon > [015] Gemini Missiles (Normal)

Datedit > Weapon > [103] Halo Rockets
Not going to go into detail to explain much about this part. Basically the ground weapon does ground splash and the air weapon is pretty much the same as the valkyrie's weapon. The X offset is directional, the higher this value the further from the unit's front it will be created at. The Y offset isn't directional, the higher this value the more above the unit the bullets will be created. Attack angle is how much the unit needs to be facing a target to attack. Launch spin is the direction offsets the bullets will be launched at.

The missile tank looks pretty cool.

If we uncloak our missile tank we can see the true form of the abomination that we have created. Let's clean up the images. Here are all the images currently on the unit:
- Tank Base:
- [250] Siege Tank (Tank) Base, parent image
- [251] Siege Tank (Tank) Base Shadow*, SCV iscript (84)
- [248] SCV Shadow*
- [249] SCV Glow*, doodad header iscript (337), another created every time unit moves
- [250] Siege Tank (Tank) Base, draw function 10
- [251] Siege Tank (Tank) Base Shadow, shadow iscript (275)
- Tank Turret:
- [233] Nuke Target Dot, parent image
- [277] Command Center Shadow, spider mine iscript (87)
- [259] Spider Mine Shadow, valkyrie iscript (362)
- [940] Valkyrie Shadow*
- [941] Valkyrie Engines*, when moving
- [101] Infested Command Center Overlay*, probe iscript (156)
- [138] Probe Shadow*, defiler iscript (9)
- [014] Defiler Shadow*, machine shop iscript (117)
- [295] Machine Shop Shadow*, doodad header iscript (337)
- [296] Missile Turret (Base)*, doodad header iscript (337)
- [297] Missile Turret (Turret), Gas Sac2 iscript (224)
- [407] Zerg Gas Sac Shadow*
All the images labeled with an asterisk are not needed so let's get rid of them. We'll give the images without required iscripts, iscript 250 to remove after 2 frames. Those that do have required iscripts will be given draw function 17 to be removed after 48 frames.

It seems most of the images did get removed but those with iscript 337 did not. This makes sense since that iscript lacks a death animation so it played the invalid animation which goes to
engset. Interestingly these images retain the pure white from draw function 17.
- Tank Base:
- [250] Siege Tank (Tank) Base, parent image
[251] Siege Tank (Tank) Base Shadow*, SCV iscript (84)
[248] SCV Shadow*
- [249] SCV Glow*, doodad header iscript (337), another created every time unit moves
- [250] Siege Tank (Tank) Base, draw function 10
- [251] Siege Tank (Tank) Base Shadow, shadow iscript (275)
- Tank Turret:
- [233] Nuke Target Dot, parent image
- [277] Command Center Shadow, spider mine iscript (87)
- [259] Spider Mine Shadow, valkyrie iscript (362)
[940] Valkyrie Shadow*
- [941] Valkyrie Engines*, when moving
[101] Infested Command Center Overlay*, probe iscript (156)[138] Probe Shadow*, defiler iscript (9)
[014] Defiler Shadow*, machine shop iscript (117)
- [295] Machine Shop Shadow*, doodad header iscript (337)
- [296] Missile Turret (Base)*, doodad header iscript (337)
- [297] Missile Turret (Turret), Gas Sac2 iscript (224)
[407] Zerg Gas Sac Shadow*

playframtile 512
playfram 0x105 # frame set 15
bunch of playfram and wait...
playfram 0x09 # frame set 0
wait 1
end
We'll use extended animations to get rid of the rest, starting with those on the turret. Check
use full iscript on the images with iscript 337 since we will need to call animation 184. When using extended animations make sure to review the specific animation called for ALL the iscripts with
use full iscript checked. Ensure that there are no opcodes that may result in a crash or other undesirable consequences.

wait 1
end
To remove the SCV glow image from the tank base unit we'll need to wait a bit before we call animation 65. The animation was changed from 184 to 65 because it crashed for some reason. We will have to wait because it will also crash.

After doing all of this we have removed all of the irrelevant images on our unit. You'll notice that the spider mine shadow and nuke dot images are still visible. We can simply give them draw function 8 so they wont be as noticeable. It may also be a good idea to set CUnit
useractionflags to 0x4 to prevent the death animation playing when it is killed.

I did skip over some minor things but for the most part this should give you a good idea of how to navigate through image linking.
Attachments:
Post has been edited 18 time(s), last time on Jul 27 2025, 2:45 am by Sie_Sayoka.
None.