Staredit Network > Forums > Modding Discussion > Topic: Little known iscript/images.dat tricks
Little known iscript/images.dat tricks
Mar 3 2015, 9:46 am
By: Neiv  

Mar 4 2015, 11:58 pm O)FaRTy1billion[MM] Post #21

👻 👾 👽 💪

There is a byte on each unit that contains the sigorder flags ... It's used to signal certain things happening outside of the actual animation. BWAPI has them listed as:
Code
   /*0x04F*/ u8            orderSignal;  /*  0x01  Update building graphic/state
                                             0x02  Casting spell
                                             0x04  Reset collision? Always enabled for hallucination...
                                             0x10  Lift/Land state

You could also likely use unused flags to signal certain things with plugins. Like in the plugin check units if a specific flag is set, and if it is do then something.



TinyMap2 - Latest in map compression! ( 7/09/14 - New build! )
EUD Action Enabler - Lightweight EUD/EPD support! (ChaosLauncher/MPQDraft support!)
EUDDB - topic - Help out by adding your EUDs! Or Submit reference files in the References tab!
MapSketch - New image->map generator!
EUDTrig - topic - Quickly and easily convert offsets to EUDs! (extended players supported)
SC2 Map Texture Mask Importer/Exporter - Edit texture placement in an image editor!
\:farty\: This page has been viewed [img]http://farty1billion.dyndns.org/Clicky.php?img.gif[/img] times!

Mar 5 2015, 2:12 am Heinermann Post #22

SDE, BWAPI owner, hacker.

BWAPI also has some info on palette/drawing types in CImage.h.

Code
                                             RLE_NORMAL = 0
                                             RLE_CLOAK = 5
                                             RLE_CLOAKED = 6
                                             RLE_DECLOAK = 7
                                             RLE_EFFECT = 9
                                             RLE_SHADOW = 10 (official)
                                             RLE_HPFLOATDRAW = 11 (official)
                                             RLE_WARP_IN = 12
                                             RLE_OUTLINE = 13
                                             RLE_PLAYER_SIDE = 14 (official)
                                             RLE_SHIFT = 16
                                             RLE_FIRE = 17


RLE_SHADOW, RLE_HPFLOATDRAW, RLE_PLAYER_SIDE are reverse engineered from BW Beta and the others were inferred somehow. The only one that doesn't match up is RLE_FIRE.

Also I wrote a tool for looking at BW data structures real time in C# to figure out wtf was going on and debug things for BWAPI, see BWMemoryEdit.

EDIT: Compiled version attached. Let me know if it's missing dependencies. Needs to be run as administrator and must have Starcraft open.

Attachments:
BWMemEdit.zip
Hits: 2 Size: 94.67kb

Post has been edited 3 time(s), last time on Mar 5 2015, 2:26 am by Heinermann.




Mar 6 2015, 2:46 pm Neiv Post #23



Regarding sigorder; from what I understand the meaning of sigorder flags is different for each order, and they are reset to zero when order changes. In most of the orders every one of them should be unused. Also, bullets use sigorder 1 to tell game when their init animation is complete, even though they really don't have orders like units do.

Quote from O)FaRTy1billion[MM]
Quote from Neiv
As creategasoverlays uses signed byte, it is only possible to use creategasoverlays with values -128 to 127. However there is no LO? editor that allows specifying negative indexed offsets, so one would have to hex edit them in. Maybe we need an LO? editor which is able to handle this abuse case of creategasoverlays :D
I didn't really consider the signed part with the lo? file ... it will just read backwards in memory to before the lo?s position in memory, and I don't know what would be there (unless it's more lo? files).
I assume reading memory before lo? is completly random data, but the lo? files could be crafted in a way that even negative values could be controlled.
High quality concept sketch:


Quote from O)FaRTy1billion[MM]
(The list of iscript functions)
You forgot trgtrangecndjmp :P Not that it would be anything special.
It seems that trgt arc/range cndjmps only work with units even though bullets also can have targets :( I wanted to create bullet which loops its init script without setting sigorder 1 until target is close enough, it could have been "camping bullet" D:
Also it seems that setflspeed cannot increase speed past max speed set in flingy.dat. Confirm/deny?
Are you done with iscript disassembling, are there no more functions that could hide something new?


Quote from Sand Wraith
I have a feeling that it also has to do with how the interface responds to them, since certain orders, particularly with Cast Spell ones, will cause the interface to prompt the user for a target. Having the ability to define more cases wherein the user is asked to specify a target would go a long way to creating entirely new spells that minimally impact existing orders and spells.
I thought the targeting interface always appears if button action is set to "Use Technology" in firegraft? Am I wrong or did I misunderstand? There certainly are a lot of issues with adding new spells, as every spell has separate order, and the tech -> order conversion is hardcoded as far as I know. That is, when specifying tech for a button in firegraft, bw converts it to order (hardcoded), and later uses orders.dat to convert it back to tech (softcoded) to get the energy cost.
I might be completly wrong though, I haven't examined spells too closely.


Quote from Heinermann
BWAPI also has some info on palette/drawing types in CImage.h.

RLE_SHADOW, RLE_HPFLOATDRAW, RLE_PLAYER_SIDE are reverse engineered from BW Beta and the others were inferred somehow. The only one that doesn't match up is RLE_FIRE.

Also I wrote a tool for looking at BW data structures real time in C# to figure out wtf was going on and debug things for BWAPI, see BWMemoryEdit.

EDIT: Compiled version attached. Let me know if it's missing dependencies. Needs to be run as administrator and must have Starcraft open.

Nice tool, even if UI is really rough ^^ I'm pretty sure that "halt" is simply 256 times more accurate position that is sometimes used.

RLE_FIRE kinda makes sense as it does use ofire.pcx to remap the colors, maybe it could be manipulated to create effects other than fading flashes?
(Out of curiosity, do you have any idea what RLE stands for?)



None.

Mar 6 2015, 7:48 pm O)FaRTy1billion[MM] Post #24

👻 👾 👽 💪

Quote from Neiv
Quote from O)FaRTy1billion[MM]
(The list of iscript functions)
You forgot trgtrangecndjmp :P Not that it would be anything special.
I didn't forget, I figured it was alraedy known. :P

Quote from Neiv
(Out of curiosity, do you have any idea what RLE stands for?)
Run Length Encoding. It's the encoding format PCX uses. (Values of 0xC0 mean repeat the next byte (value & ~0xC0) times, else just copy the value -- GRP data encoding is like an expanded RLE).



TinyMap2 - Latest in map compression! ( 7/09/14 - New build! )
EUD Action Enabler - Lightweight EUD/EPD support! (ChaosLauncher/MPQDraft support!)
EUDDB - topic - Help out by adding your EUDs! Or Submit reference files in the References tab!
MapSketch - New image->map generator!
EUDTrig - topic - Quickly and easily convert offsets to EUDs! (extended players supported)
SC2 Map Texture Mask Importer/Exporter - Edit texture placement in an image editor!
\:farty\: This page has been viewed [img]http://farty1billion.dyndns.org/Clicky.php?img.gif[/img] times!

Mar 10 2015, 1:33 am Neiv Post #25



Quote from O)FaRTy1billion[MM]
0x0B - SWITCHUL <image#>
- UL equivalient of IMGOLORIG
*EDIT* These seem to have something that relates to LO? files, but I'll have to look in to the called function then I'll confirm that here...
These appear to spawn image at offset specified by the "special" lo? file. At least they crash if it does not exist. Guess they do something else as well that makes them different from imgoluselo/imguluselo?

Edit: They appear to make image update its position with new lo? offsets if it turns? Resources/powerups work similarly even though they are not created by iscript commands.

Post has been edited 1 time(s), last time on Mar 10 2015, 1:44 am by Neiv.



None.

Mar 31 2015, 4:09 pm Neiv Post #26



Found out the differences between drawfunc 0x0 and 0x1. 0x0 is the only drawfunc can be switched to hallucination or any of the cloaking drawfuncs. So setting cloaked unit to use drawfunc 0x1 would make them always appear uncloaked to every player, but players without detection would still not be able to target them.



None.

Apr 1 2015, 3:01 am O)FaRTy1billion[MM] Post #27

👻 👾 👽 💪

Neat. I was beginning to suspect that since I kept seeing like "if(drawfunc == 0)", but was focusing more on getting it disassembled than interpreting what it meant :P

I still need to write up the more updated opcode specifics.



TinyMap2 - Latest in map compression! ( 7/09/14 - New build! )
EUD Action Enabler - Lightweight EUD/EPD support! (ChaosLauncher/MPQDraft support!)
EUDDB - topic - Help out by adding your EUDs! Or Submit reference files in the References tab!
MapSketch - New image->map generator!
EUDTrig - topic - Quickly and easily convert offsets to EUDs! (extended players supported)
SC2 Map Texture Mask Importer/Exporter - Edit texture placement in an image editor!
\:farty\: This page has been viewed [img]http://farty1billion.dyndns.org/Clicky.php?img.gif[/img] times!

Apr 27 2015, 10:42 pm Neiv Post #28



Got one more almost useless trick to document:

When the first frame of bullet animation is executed, the "iscript context" is refers to the attacking unit instead of the bullet. As such, using attacking, turning or other unit-specific opcodes will work fine for this frame. Most of them are really pointless though, as they could be used simply from the attacking unit's script.
However image overlay creation opcodes and sprul/spruluselo will not show the image/sprite if the unit is cloaked, so it is possible to have bullet look different depending if the attacker is cloaked.

Other usable opcodes are range/direction condjmps, allowing running different init script for the bullet. Sadly the bullet will not do anything until its iscript runs sigorder 1, after which starcraft will reset the animation to GndAttkinit. So the condjmps can mostly be used to make bullet look different (with image overlays), set its position, play different sounds, or wait different times before activating.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[02:58 am]
KrayZee -- You
[12:00 am]
RexyRex -- u
[09:35 pm]
Pr0nogo -- he broke it intentionally so you couldn't take it
[08:55 pm]
Dem0n -- ya, hurry up and fix so I can take Wing's box
[08:40 pm]
Wing Zero -- Magic boxes still not fixed....
[08:10 pm]
UEDCommander -- How depressing
[08:09 pm]
UEDCommander -- Recently someone actually called me "eud" without even knowing what starcraft is
[01:13 pm]
Pr0nogo -- u
[12:42 pm]
UEDCommander -- Who said EUDCommander
[07:56 am]
Pr0nogo -- u(de)
Please log in to shout.


Members Online: Roy, jun3hong, Zoko-TkZ, Oh_Man, RIVE