Making Weapons Go Through Targets

From Staredit Network Wiki
Jump to: navigation, search

Tutorial by: Lord_Agamemnon

Requirements

Tutorial

All right, this tutorial will teach you how to make a weapon that aims at its target, passes through, and hurts everything it hits along the way. This is an effect you may have seen in various places, such as Terran Doom (the Valkyries' attack.)

The DatEdit part

In units.dat:

  • Find the unit you want to have the attack. Give that attack to the unit. Was that so hard?

In weapons.dat:

  • Find the weapon you want to do this. Change its behavior to "Goes to max. range," missile type to "normal," and range to however far you want it to go. *Change explosion to one of the "splash" types and the splash radii to whatever you choose. Now you should be set.

The ICECC part

(I'm going to write this in IceCC 1.3 code, since that's what I know.)

  1. Decompile the iscript. I'll assume you know how to do this.
  2. Find the entry for the weapon graphic that you want. I'll use Venom as the example.
  3. Look at this code:
# ----------------------------------------------------------------------------- #
# This header is used by images.dat entries:
# 507 Unknown507 (thingy\ep2Fire.grp)
.headerstart
IsId            257
Type            2
Init            VenomInit
Death           VenomDeath
GndAttkInit     VenomGndAttkInit
AirAttkInit     [NONE]
.headerend
# ----------------------------------------------------------------------------- #

VenomInit:
playfram        0x00 # frame set 0
wait            1
sigorder        1
goto            VenomGndAttkInit

VenomGndAttkInit:
wait            125
goto            VenomGndAttkInit

VenomDeath:
domissiledmg    
imgol           508 0 0 # Unknown508 (thingy\etgHit.grp)
wait            1
end             

Now, here's something noteworthy about weapon animations. The "GndAttkInit" script actually is the one that displays when they're moving. So we look at this portion of the script. Obviously we'll need a domissiledmg command in there, and we'll need to reduce that "wait 125" to a smaller value, say, 1. This will make the weapon do a LOT of hits, so tune your damage down accordingly!

So we've added that in and changed the "wait" command. That part should look like this:

VenomGndAttkInit:
wait            5
              domissiledmg
goto            VenomGndAttkInit

Maybe for the heck of it you'll want to throw in an overlay to show on top of it; that's pretty easy and just requires one more like with the imgol command. If the overlay you're using has a domissiledmg command in its script, however, remove the one from Venom. If you don't, it'll hit even more!

Now compile your iscript and put it and the modified weapons.dat into an MPQ. Run it. If all goes well, you should have "scraping" weapons that go through their targets, damaging all they touch!