Struggling with A_CustomMissile in DECORATE

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
CaptainNurbles
Posts: 274
Joined: Sat Jan 27, 2018 9:12 pm
Graphics Processor: nVidia (Modern GZDoom)
Location: The Deepest Reaches of Space
Contact:

Struggling with A_CustomMissile in DECORATE

Post by CaptainNurbles »

Heyo!

I should preempt this by saying that I don't actually know anything about coding, I just have a lot of patience, free time, and an endless supply of Google searches.

So I've spent the last month or so working on and off with making the old Mutiny monster and weapon replacer mod work with Hideous Destructor, and I've gotten incredibly close to making it work! The player guns cause proper bleed damage to fleshy targets and I've almost balanced them out so that firefights are a challenge, but not quite unfair. Enemies all drop a whole variety of weapons, ammunition, and items from Hideous Destructor, and they even fire the custom HDster bullet projectiles to bring a proper amount of hurt and bleed damage to the player.

The main thing that's been giving me issues is figuring out how to make monsters fire multiple projectiles. The rifle, pistol, SMG etc monsters fire their respective caliber weapons and do so well enough to my standards. Enemies with shotguns, however, I haven't figured it out. I sorta had it work with multiple A_CustomMissile functions, but I couldn't quite figure out how to make the projectiles spread properly (with the experimentation I've been doing the projectiles either always missed the player or every single one always hit the player no matter what), and then for some reason I couldn't figure out it also wouldn't play the shotgun fire sound effect.

If anybody could help me out I'd be greatly appreciative of it!

EDIT EDIT EDIT

I got it solved! Or at least, solved it enough for my standards.

The sound issue was easily fixed by editing Mutiny's SNDINFO page.

As for getting enemies to fire multiple shots, I went back and added multiple A_CustomMissile functions like I had previously done.

Missile:
TNT1 A 0 A_Jump (25,"Grenade") (Determines the chance that the monster throws a separate Grenade projectile)
PLA6 E 10 A_FaceTarget
PLA6 F 0 A_PlaySound ("weapons/shotgun")
PLA6 F 0 A_CustomMissile("HDB_00",32,random(12,9),random(-3,3))
PLA6 F 0 A_CustomMissile("HDB_00",32,random(12,9),random(-3,3))
PLA6 F 0 A_CustomMissile("HDB_00",32,random(12,9),random(-3,3))
PLA6 F 0 A_CustomMissile("HDB_00",32,random(12,9),random(-3,3))
PLA6 F 6 bright A_CustomMissile("HDB_00",32,random(12,9),random(-3,3))
PLA6 E 2
POSS F 0 A_CustomMissile("ShellCasing",32,10,random(260,280))
PLA6 E 8 A_PlaySoundEx("items/shotgun1", Body)

I'm assuming that the code works like: PLA6 (sprite group to use) F (specific sprite to use for this action) # (How many frames the action takes up) and the rest is the code to determine the missile and everything. The spread needs tuning and I'm sure there's a more elegant way to make this work, but it functions just fine for me.
Post Reply

Return to “Scripting”