I want to make the defiler and other zerg units use plague when they die. I know i have to add a cast spell and maybe some other stuff to the DefilerDeath, but i don't really know where to put it or the syntax to use. If someone can help i would appreciate it.
here is the defiler death code and ist special abilities
CODE
DefilerDeath:
playsnd 815 # Zerg\DEFILER\ZDeDth00.WAV
playframno 0
playfram 0x88 # frame set 8
wait 2
playfram 0x99 # frame set 9
wait 2
playfram 0xaa # frame set 10
wait 2
playfram 0xbb # frame set 11
wait 2
sprul11 139 0 0 # DefilerDeath (zerg\zdeDeath.grp)
wait 1
end
DefilerGndAttkInit:
playsnd 110 # Bullet\zdeAtt00.wav
imgol0d 518 0 0 # Unknown518 (thingy\eplMuzz.grp)
attackwith 1
gotorepeatattk
goto DefilerGndAttkToIdle
DefilerSpAbility2:
playfram 0x00 # frame set 0
nobrkcodestart
wait 1
playfram 0x11 # frame set 1
wait 1
playfram 0x22 # frame set 2
wait 1
playfram 0x11 # frame set 1
wait 1
castspell
nobrkcodeend
gotorepeatattk
sigorder 2
goto DefilerGndAttkToIdle
Add the command somewhere in the Death animation before the end (it only depends on when you want Plague to be cast.) I don't know when you want it, and I also don't know the Defiler's fram numbers, so you'll have to figure out that part on your own.
Don't use castspell, since that requires an ability linked to it. Use useweapon. Add this line somewhere in that script, and you'll be good to go:
useweapon 60
For ease of reading, you might want to line up the 60 with the column on the left; as long as they're on the same line, it shouldn't matter.
Don't forget that unless the Defiler has a target when it dies, it's not going to use the weapon properly.
Would it be possibl to play the grp for the plague as an overlay and add the effect in or something?
I just got around to testing the iscirpt and it crahes whenever one of the edited units dies.
I just added useweapon 60 so it looks like this for all the edited units
is there more i need to add or did i just do it wrong?
CODE
DefilerDeath:
playsnd 815 # Zerg\DEFILER\ZDeDth00.WAV
playframno 0
playfram 0x88 # frame set 8
wait 2
playfram 0x99 # frame set 9
wait 2
playfram 0xaa # frame set 10
wait 2
playfram 0xbb # frame set 11
wait 2
useweapon 60
sprul11 139 0 0 # DefilerDeath (zerg\zdeDeath.grp)
wait 1
end
I think this is because it has no target to fire the weapon at, and thus crashes. Attack animations assume that such a target exists. Try removing the 'useweapon' opcode and see if it still crashes, if so - you know what's the problem. There is some workaround for this, I am sure, I've seen it working, but don't remember details right now.
As far as I know, if there's a useweapon and no target exists, the weapon will still fire, it'll just appear in the upper left corner of the map.