Newb Question: What causes Damage in A_CustomMissile

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
User avatar
eharper256
Posts: 1098
Joined: Sun Feb 25, 2018 2:30 am
Location: UK
Contact:

Newb Question: What causes Damage in A_CustomMissile

Post by eharper256 »

Hi there, I'm just looking studying various DECORATE etc. in some of my favourite mods to see how they work, and one of the big ones is I'm wondering how A_CustomMissile causes damage.

Obviously, for A_Firebullets, the wiki states the 3rd/4th integer determines projectiles/damage, so in the example

Code: Select all

TRIF A 5 Bright A_FireBullets(0, 0, 1, 45, "RiflePuff")
The rifle shot here is doing 1 shot of 45 damage. And...

Code: Select all

CHAF A 1 BRIGHT A_FireBullets(4, 4, 1, 9, "MachineGunBulletPuff", 1)
This Chaingun from Brutal Doom is dealing 9 damage, etc.

So, how does this Weapons of Saturn Chaingun work? (Hold State)

Code: Select all

	TNT1 A 0 A_JumpIfInventory("NatoBelt",1,1)
		Goto ReloadCheck
		TNT1 A 0 A_AlertMonsters
		TNT1 A 0 A_SetPitch(pitch - 0.1)
		TNT1 A 0 A_PlaySound("weapons/chaingun/spin",7)
		TNT1 A 0 A_TakeInventory("NatoBelt",1,TIF_NOTAKEINFINITE)
		VLCS A 1 A_FireBullets(3, 2, -1, 1, "BulletPuff", 0)
		VLCS B 1 A_Firecustommissile("ChaingunCasingSpawner",0,0,-12,-18)
		TNT1 A 0 A_ZoomFactor(0.996)
		TNT1 A 0 A_SetPitch(pitch + 0.1)
		VLCS C 1 A_FireBullets(3, 2, -1, 0, "BulletPuff", 0)
		TNT1 A 0 A_Firecustommissile("ChaingunCasingSpawner",0,0,-12,-18)
		TNT1 A 0 A_ZoomFactor(0.999)
		TNT1 A 0 A_SetPitch(pitch - 0.2)
		TNT1 A 0 A_GunFlash
		TNT1 A 0 A_TakeInventory("NatoBelt",1,TIF_NOTAKEINFINITE)
		VLCS D 1 A_FireCustomMissile("ChaingunTracer",FRandom(-1.0,1.0),0,0,-1,0,FRandom(-1.0,1.0))
		TNT1 A 0 A_SetPitch(pitch + 0.2)
		TNT1 A 0 A_TakeInventory("NatoBelt",1,TIF_NOTAKEINFINITE)
		VLCS A 1 A_FireBullets(3, 2, -1, 1, "BulletPuff", 0)
		TNT1 A 0 A_Firecustommissile("ChaingunCasingSpawner",0,0,-12,-18)
		TNT1 A 0 A_ZoomFactor(0.996)
		VLCS B 1 A_FireBullets(2, 2, -1, 0, "BulletPuff", 0)
		TNT1 A 0 A_Firecustommissile("ChaingunCasingSpawner",0,0,-12,-18)
		TNT1 A 0 A_TakeInventory("NatoBelt",1,TIF_NOTAKEINFINITE)
		VLCS C 1 A_FireBullets(3, 2, -1, 8, "BulletPuff", 0)
		TNT1 A 0 A_ZoomFactor(0.998)
		TNT1 AA 0 A_FireCustomMissile("GunSmokeSpawner",0,0,0,0)
		VLCS D 1 A_Firecustommissile("ChaingunCasingSpawner",0,0,-12,-18)
		TNT1 A 0 A_TakeInventory("FiringTracer",1)
		TNT1 A 0 A_ReFire
		TNT1 A 0 A_PlaySound("weapons/chaingun/stop",6)
		TNT1 A 0 A_ZoomFactor(1.0)
		VLCS ABCD 1
		TNT1 AAAA 0 A_FireCustomMissile("GunSmokeSpawner",0,0,0,-4)
		VLCS ABCD 2
		VLCN ABC 2 A_WeaponReady
		TNT1 AA 0 A_FireCustomMissile("GunSmokeSpawner",0,0,0,1)
		VLCN DABCDA 3 A_WeaponReady
		VLCS BCD 2 A_WeaponReady
		Goto ReadyII
The AFireBullets has -1 defined in its projectile numbers? What causes the damage here? Is it the tracer?
User avatar
Arctangent
Posts: 1235
Joined: Thu Nov 06, 2014 1:53 pm
Contact:

Re: Newb Question: What causes Damage in A_CustomMissile

Post by Arctangent »

Normally, if A_FireBullets is only set to fire a single bullet, it'll ignore bullet spread unless the player holds down the fire button after A_Refire is called - if you've ever heard of chaingun sniping, this is the cause of it. -1 ignores this and causes the bullets to spread the moment you start firing.

Which is to say, it's not actually firing less than zero bullets, it's firing one.

As far as the question you're asking, though, projectiles don't rely on the action function creating them to set their damage, rather they define their own damage in their actor definition.
User avatar
ramon.dexter
Posts: 1562
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Newb Question: What causes Damage in A_CustomMissile

Post by ramon.dexter »

For a batter explanation: The projectile works as projectiles in real world. Normally, weapons in real dont cause any damage. All the damage is done by the projectile they shoot. So, rocket launcher doesnt do any damage. The damage is dome by the rocket (better said, by the explosive in the rocket, but that's detail).
User avatar
eharper256
Posts: 1098
Joined: Sun Feb 25, 2018 2:30 am
Location: UK
Contact:

Re: Newb Question: What causes Damage in A_CustomMissile

Post by eharper256 »

Right, yes. I see.

Good to know (-1) is just a function to incite bullet spread.

In fact, I could have answered part of my own question if I had not been so adamant at looking at A_CustomMissile itself, since the tracers below do specify direct damage it seems, lol.

Code: Select all

ACTOR ChaingunTracer : Tracer
{
	Damage (random(1,2))
	Speed 260
}

ACTOR RotaryPlasma : BlueTracer
{
	Damage (random(6,10))
	Speed 160
}
So the tracer is doing 1-2 damage, and the plasma version 6-10.
And there's also an explode function that presumably does 40 damage over 100 area below that:

Code: Select all

TNT1 A 0 A_Explode (40,100,(0))
Thanks for the help.
Post Reply

Return to “Scripting”