Offset A_FireMiniMissile

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
EndHack
Posts: 57
Joined: Wed Feb 14, 2018 8:53 pm

Offset A_FireMiniMissile

Post by EndHack »

First off I'm not very good at ZScript and I'm not entirely sure whats going on here, but I'm trying to make an attack that shoots three strife mini missiles similar to the crusader, with all of them staying a uniform triangle pattern, and I've gotten them to shoot in the tringle pattern, but its along the world rather then in the direction the player is facing, and I've been looking through other attacks and through zdoom wiki but that hasn't gotten me anywhere, so if anyone with some experience could help out a bit that would be great
Edit: I forgot to add that I want this to have all the accuracy stuff like A_FireMiniMissile and the other strife attacks which is why I'm not just shooting three rockets with A_FireProjectile
StrifeMissileExample1.png
StrifeMissileExample2.png

Code: Select all

	action void A_FireThreeMiniMissile ()
	{
		if (player == null)
		{
			return;
		}

		Weapon weapon = player.ReadyWeapon;
		if (weapon != null)
		{
			if (!weapon.DepleteAmmo (weapon.bAltFire))
				return;
		}
		
		double savedangle = angle;
		angle += Random2[MiniMissile]() * (11.25 / 256) * AccuracyFactor();
		player.mo.PlayAttacking2 ();
		SpawnPlayerMissile ("MiniMissile",angle);
		SpawnPlayerMissile ("MiniMissile",angle,0,8,-8);
		SpawnPlayerMissile ("MiniMissile",angle,0,-8,-8);
		angle = savedangle;
	}
}
User avatar
Player701
 
 
Posts: 1707
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support
Contact:

Re: Offset A_FireMiniMissile

Post by Player701 »

EndHack wrote:

Code: Select all

Random2[MiniMissile]() * (11.25 / 256) * AccuracyFactor();
Why not just use this calculation and pass the resulting value as the angle argument to A_FireProjectile? Something like this:

Code: Select all

double ang = Random2[MiniMissile]() * (11.25 / 256) * AccuracyFactor();
A_FireProjectile("MiniMissile", ang, false);
A_FireProjectile("MiniMissile", ang, false, 8, -8);
A_FireProjectile("MiniMissile", ang, false, -8, -8);
User avatar
EndHack
Posts: 57
Joined: Wed Feb 14, 2018 8:53 pm

Re: Offset A_FireMiniMissile

Post by EndHack »

That works perfectly thanks for the help
Post Reply

Return to “Scripting”