Changing Unit Speed

From Staredit Network Wiki
Jump to: navigation, search

Required tools

  • DatEdit v1.4
  • ICE
  • ICE CC
  • WinMPQ
  • MPQ Draft

Unit speed

In order to determine the technique you can use to change a unit's speed, we'll firstly need DatEdit. Go to the UNITS tab and select the unit you want to modify. Next, switch to the GRAPHICS subtab of the UNITS tab and follow the graphics used for the unit by clicking JUMP. You will now be redirected in the Flingy editor. In simple terms, flingy (flingy.dat as filename, located in the Arr\ folder) determines the basic unit physics in terms of speed, acceleration, velocity, turn radius and inertia. Not all units use flingy-controlled movement, though. Therefore, in order to know what tool we need to modify the speed, we'll check the movement control. Units have 2 types of control: flingy.dat Control and Iscript.bin Control. When the movement control is set to flingy.dat, the unit will use the speed, acceleration, and halt distance parameters; if it is set to Iscript.bin control, it will ignore them. However, the Turn Radius property is always used, even if iscript.bin control is selected.

In flingy.dat, using datedit

Go to the FLINGY tab in DatEdit to display the Flingy Editor. The quickest way is the one described above, by using JUMP on the GRAPHICS subtab of the UNITS tab. There are 4 entries there:

  • Top Speed: Maximal speed at which the sprite will move, measured in pixels-per-frame.
  • Acceleration: How fast the sprite speeds up or slows down. Added to or subtracted from the current speed until it reaches the Top Speed or 0, also measured in pixels-per-frame.
  • Halt Distance: Distance from its destination at which the sprite will begin to decelerate from its Top Speed to a complete halt; measured in (pixels x 256).
  • Turn Radius: The distance the sprite requires to "wipe around" to turn to another direction.

By editing the values of "Acceleration" or "Top Speed" you can change the overall speed of the unit you want. After you made all your changes, while still under the Flingy tab, go to File -> Save As and save it as "flingy.dat" somewhere, like your desktop.

IScript.bin

Using ICE/ICEXP

In ICE, go to File -> Load Default, in IceXP, go to File -> Auto-Load from local SC MPQ File to load the default data. Next, browse the header for the desired unit. For example, "Terran Marine". Switch to the Animation Scripts subtab of the Header. You should see this:

Move graphic 4 units forward
Wait 1 tick
Play Frame 85 
Move graphic 4 units forward
Wait 1 tick
Play Frame 102
Move graphic 4 units forward
Wait 1 tick
Play Frame 119
Move graphic 4 units forward
Wait 1 tick
Play Frame 136
Move graphic 4 units forward
Wait 1 tick
Play Frame 153
Move graphic 4 units forward
Wait 1 tick
Play Frame 170
Move graphic 4 units forward
Wait 1 tick
Play Frame 187
Move graphic 4 units forward
Wait 1 tick
Play Frame 204
Move graphic 4 units forward
Wait 1 tick
Play Frame 68
Go to offset 29110

Select the first line. Hover with your cursor over "4" and then click to input new data. To make it move faster, simply increase the number to say, 8 and press Enter. This basically tells the game that the unit will advance over ground faster, similar to as if it is taking larger steps. Remember to not delete the "Wait" commands. For now, to avoid complications, just modify the movement amount. After you changed what you wanted to change go to File -> Save File As and save it as "Iscript.bin".

Using ICECC

After starting IceCC using IceCCUI.BAT, click Unselect All in the Units list and select the unit you want (note that you can select multiple units, so just select the ones you want to modify to avoid browsing a large file) and select an output file and click Decompile. Then click Open in Editor. Go to the "Walking" section. You should see this (depending on the IceCC version you use):

MarineWalking:

move       4
wait       1
playfram  0x55
move       4
wait       1
playfram  0x66
move       4
wait       1
playfram  0x77
move       4
wait       1
playfram  0x88  
move       4
wait       1
playfram  0x99
move       4
wait       1
playfram  0xaa  
move       4 
wait       1
playfram  0xbb  
move       4
wait       1
playfram  0xcc
move       4
wait       1
playfram  0x44
goto       MarineWalking 

To make it move faster, simply increase the number to what value you want (let's use 8 like in the above example). This basically tells the game that the unit will advance over ground faster, similar to as if it is taking larger steps. Remember to not delete the "Wait" commands. For now, to avoid complications, just modify the movement amount. After you changed what you wanted to change save the document.

You can save it in 2 ways. The automated command line method or the easy UI manual method. The CL method uses the following syntax (best used in a batch file - the files with a .bat extension):

[icecc.exe path] -o [destination path for IScript.bin] [default IScript.bin path] [custom script path]

Example:

"C:\IceCC\icecc.exe" -o "C:\Documents And Settings\All Users\Desktop\IScript.bin" "C:\IceCC\data\scripts\iscript.bin" "C:\IceCC\Input.txt"

The changes made were saved in Input.txt. The UI method works in a similar manner, except that it involves clicks instead of so much typing. Switch to the Compiler tab. Click ADD and add your modification file (in our example "Input.txt"). Click Merge with default IScript.bin and select a destination path and "Iscript.bin" as the file to save our scripts to. Note that not enabling Merge with default IScript.bin would have compiled ONLY your changes without including the original scripts (causing StarCraft to crash with a "script X not found" error.

Saving Your Changes

Open WinMPQ. Now add your changed files. Depending on the file you used, you'll need to input a different folder. To add a file simply drag&drop it on the WinMPQ list. If you used "flingy.dat", you should input the "arr\" folder when prompted. It is not case sensitive, but remember the trailing backslash. If you used IScript editing, drag&drop IScript.bin and save it in the "scripts\" folder. Now save your MPQ as whatever you want. Now you can close WinMPQ and we can move on to the last part of the tutorial.

Using DatEdit or any ICE-ing tool you manage to save your changes in a format StarCraft understands and with WinMPQ you could pack it somewhere StarCraft can find it. The only problem is, StarCraft doesn't know about your changes. In order to tell StarCraft we want to use some changed stuff, we'll need to insert them in StarCraft itself. To do this, we'll use MPQ Draft.

Open MPQ Draft and click Create self-executing MPQ. In this wizard, the first page will ask you for a mod name, the source MPQ file (the one you saved with either flingy.dat, either IScript.bin) and the destination file and path, which will be an exe file. Click Next, select "StarCraft" as the Program and "StarCraft" as the module component. Click Next one more time and then Finish. You can now delete the mpq file with your changes.

Congratulations, you now made your game changes and put them in a very simple-to-use exe file. To test them, simply double-click the exe to start StarCraft and check them out. Remember, playing on Battle.net will drop you, so try it only offline.