Creating an attack via Iscript.bin

This only covers the IceCC method.

Please note: This tutorial also applies to other units without attacks (for example, the civilian). The shuttle is merely the example used.

## Required tools

* DatEdit v1.5
* IceCC
* MPQDraft
* WinMPQ

Knowledge of how to use these tools is assumed. If you do not know how to use the above tools, please read their associated tutorials.

# 118 Shuttle (protoss\shuttle.grp)
.headerstart
IsId             157
Type             21
Init             ShuttleInit
Death            ShuttleDeath
GndAttkInit      ShuttleAttack   #Ground Attack start-up script
AirAttkInit      ShuttleAttack   #Air Attack start-up script
Unused1          [NONE]
GndAttkRpt       ShuttleAttack   #Repeat sequence handling for the ground attack
AirAttkRpt       ShuttleAttack   #Repeat sequence handling for the air attack
CastSpell        [NONE]
GndAttkToIdle    ShuttleWalkingToIdle   #Reverting from ground attacks to the idle state
AirAttkToIdle    ShuttleWalkingToIdle   #Reverting from air attacks to the idle state
Unused2          [NONE]
Walking          ShuttleWalking
WalkingToIdle    ShuttleWalkingToIdle
SpecialState1    [NONE]
SpecialState2    [NONE]
AlmostBuilt      [NONE]
Built            [NONE]
Landing          [NONE]
LiftOff          [NONE]
IsWorking        [NONE]
WorkingToIdle    [NONE]
WarpIn           ShuttleWarpIn
.headerend
# ----------------------------------------------------------------------------- #

```

```
ShuttleInit:
  imgul       119 0 42   # ShuttleShad (protoss\shuttle.grp)

```

```
ShuttleWalkingToIdle:
  playfram    0x00   # frame set 0
  goto        ShuttleLocal00

ShuttleLocal00:
  setvertpos  1
  waitrand    8 10
  setvertpos  2
  waitrand    8 10
  setvertpos  1
  waitrand    8 10
  setvertpos  0
  waitrand    8 10
  goto        ShuttleLocal00

```

```
ShuttleDeath:
  playsnd     514   # Protoss\SHUTTLE\PShDth00.WAV
  imgol       213 0 0   # ProtossBuildingExplosionSmall (thingy\tBangS.grp)
  wait        3
  end

```

```
ShuttleWalking:
  imgol       120 0 0   # ShuttleGlow (thingy\pshGlow.grp)
  setvertpos  0
  playfram    0x00   # frame set 0
  goto        ShuttleLocal01

```

```
# attacks.
 ShuttleAttack:
   wait        1
   attack
   gotorepeatattk
  goto        ShuttleLocal01

```

```
#Looping trick for attacks; something like a repeat attack script in some cases (easier to understand if I say it this way)
ShuttleLocal01:
  wait        125
  goto        ShuttleLocal01

```

```
ShuttleWarpIn:
  imgol       121 0 0   # Unknown121 (protoss\shuttle.grp)
  goto        ShuttleLocal01

```

You should then compile this listing with IceCC.

For information on iscript commands, check the documentation about iscript opcodes provided with ShadowFlare's latest update.

## .DAT editing: units.dat

1. Go to the Protoss Shuttle (ID 69) and do the following actions in the Basic subtab:

* Select a ground weapon.
* Select an air weapon.

This is fairly obvious. What you've just done is given the unit a weapon to use. Now, when you call the attack command, the unit will use the air weapon if its target is an air unit, and the ground weapon if its target is a ground unit. It will also display the weapons on the panel.

2. Go to the AI Script Actions subtab of the Units tab:

* Set "Computer AI" to "Guard"
* Set "Human Idle" to "Guard"
* Set "Return to Idle" to "Guard"
* Set "Attack Unit" to "Attack Unit"

This is less obvious. What has been done is that you've told the unit how to behave. If it sees an enemy unit, it will attack. If you tell it to attack, it will attack, rather than just moving towards the target.

## 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. "Units.dat", should be in the "arr\" folder when prompted. It is not case sensitive, but remember the trailing backslash and 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 Units.dat and 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. 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.