Creating Bouncing Weapons

From Staredit Network Wiki
Jump to: navigation, search

Author: BSTRhino

Source: RTSBANANA. The article in turn was from the old starcraft.org, before it asploded.

IceCC opcodes have been updated to conform with IceCC v1.3. Note that the original has been updated for this Wiki.

Requirements

Procedure

While playing some of the mods on this site, you might have seen people create weapons that bounce just like the Mutalisk's weapon. How do you do this?

There are two parts to it.

  1. In Arsenal III [or other DAT editor], change the "Missile Type" and "Behaviour" to "Bouncing". This step is very, very easy, and if you have no idea how to do this, you really need to do some more modding with Arsenal III before attempting to create an effect of this level.
  2. You need to fix the iscript[using an iscript editor] of the weapon's flingy/sprite/image so that it is capable of bouncing. I'll explain this in more detail below.

Whenever I turn a weapon into a bouncing weapon, I always use IceCC. You can use ICE if you choose, but this tutorial is written for an IceCC scripter, so if you choose to use ICE, you will need to adapt the concepts yourself.

If you look at the Glave Wurm iscript, and then you look at iscripts for other weapons, you'll notice the main difference is that the Glave Wurm has an animation called BurrowInit, while the others don't. I'm sure you can guess that BurrowInit is the animation that is called whenever the weapon bounces. So, when editing the iscript to turn a non-bouncing weapon into a bouncing weapon, the goal is to create some code that to be run on the BurrowInit animation.

Now, the first difficulty in most cases is that most weapon iscript headers don't have a BurrowInit animation. To illustrate this, take a look at the iscript header for the Glave Wurm:

.headerstart
IsId 264
Type 13
Init Unknown511Init
Death Unknown511Death
GndAttkInit Unknown511GndAttkInit
AirAttkInit [NONE]
SpAbility1 [NONE]
GndAttkRpt [NONE]
AirAttkRpt [NONE]
SpAbility2 [NONE]
GndAttkToIdle [NONE]
AirAttkToIdle [NONE]
SpAbility3 [NONE]
Walking [NONE]
Other [NONE]
BurrowInit Unknown511BurrowInit
.headerend

Notice how it has a BurrowInit animation right at the bottom? Let's compare that to the script of the Vulture's Fragmentation Grenade:

.headerstart
IsId 242
Type 2
Init Unknown532Init
Death Unknown532Death
GndAttkInit Unknown532GndAttkInit
AirAttkInit [NONE]
.headerend

It has no BurrowInit animation like the Glave Wurm does, and because of that, this flingy cannot bounce. We can change that, but first we need to do is add BurrowInit to the iscript header of the Fragmentation Grenade. This is done by remaking the header so that it looks just like the Glave Wurm one, except using the offsets that are relevant to the Fragmentation Grenade. So here it is edited to look like the Glave Wurm header:

.headerstart
IsId 242
Type 13
Init Unknown532Init
Death Unknown532Death
GndAttkInit Unknown532GndAttkInit
AirAttkInit [NONE]
SpAbility1 [NONE]
GndAttkRpt [NONE]
AirAttkRpt [NONE]
SpAbility2 [NONE]
GndAttkToIdle [NONE]
AirAttkToIdle [NONE]
SpAbility3 [NONE]
Walking [NONE]
Other [NONE]
BurrowInit BounceCode
.headerend

There are a few things to notice here. First, the type up the top was changed to 13, which is the same as for the Glave Wurm. The type sets which animations are in the iscript header. Type 13 happens to have Init, Death, GndAttkInit, and everything else up to BurrowInit. To make this work, first you have to copy the extra animations from the Glave Wurm's type 13 header so that all of the required animations for type 13 are present in your weapon's iscript. Just use [NONE] for all the new animations you have to add. Second, the BurrowInit block name was changed to BounceCode and this indicates we're going to make a new block label titled BounceCode.

So now to write the BounceCode block. This is what the Glave Wurm has in its Unknown511BurrowInit block, which does what our BounceCode block for the Fragmentation Grenade will need to do.

Unknown511BurrowInit:
playsndbtwn 91 92 # Bullet\ZQuHit00.wav, Bullet\ZQuHit01.wav
sprol 365 0 0 # Unknown512 (thingy\SporeHit.grp)
domissiledmg
goto Unknown511GndAttkInit

So now, knowing how the Glave Wurm's bouncing BurrowInit block is coded, you can now code your own BounceCode block in the same way. Like with anything in iscript, you can write whatever commands you want for your BounceCode block, but if you just want to write something that makes a weapon bounce normally, what you need to do to have the last two lines of your BounceCode block very similar to the Glave Wurm's. That is, you need to include a domissiledmg line to apply damage on bouncing, and you also need to jump back to the main loop of the iscript. So, if I were to write a simple Fragmentation Grenade BounceCode block, this is what it would look like:

BounceCode:
domissiledmg
goto Unknown532GndAttkInit

You might want to add "play sound" commands to make your bouncing sound nicer, but that's your choice. So now that you have added your bouncing animation and set your values in Arsenal III, you now have a bouncing weapon. It's really quite simple, all you really did was copy the Glave Wurm and adapt it to the new weapon. If in the future if you find an effect you would really like to do, try investigating how it is already done by Blizzard, or by one of your favourite modders. You might be surprised to find that you have all the tools you need to learn how to do anything you see in modding.