Units Range of Fire + shooting only from total stop

Units Range of Fire + shooting only from total stop

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
Fri13
Posts: 54
Joined: 03 Feb 2007, 13:15

Units Range of Fire + shooting only from total stop

Post by Fri13 »

Range=xxxx is how i can determine range how long unit can fire, but how i can limit minimium range what unit can fire? Like if i do 3rd level mortar what firing range is 500 and makes big waveblast, how i get minimium level so it dont shoot scout vehicle what gets near it and blow itself or others near group, up to other planet?

Second guestion, is there way to set shooting possible only when not moving?
kBots can shoot when moving but real tanks usually shoots only stationary places or stop moving before shooting. Like if i want add small delay to shoot after stop, like when AA vehicle moves, it needs first to stop and wait 2-5 seconds before it can shoot.
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Re: Units Range of Fire + shooting only from total stop

Post by rattle »

Fri13 wrote:Range=xxxx is how i can determine range how long unit can fire, but how i can limit minimium range what unit can fire? Like if i do 3rd level mortar what firing range is 500 and makes big waveblast, how i get minimium level so it dont shoot scout vehicle what gets near it and blow itself or others near group, up to other planet?
You can limit the minimum range by limiting the angle that weapon can aim. I think there was a minimum angle TDF tag, not sure if it's ignored by spring. Then again you could use the weaponMainDir FBI tag or limit the angle by script in the AimWeapon function, though I don't recommend that.
Fri13 wrote:Second guestion, is there way to set shooting possible only when not moving?
kBots can shoot when moving but real tanks usually shoots only stationary places or stop moving before shooting. Like if i want add small delay to shoot after stop, like when AA vehicle moves, it needs first to stop and wait 2-5 seconds before it can shoot.
Script it.

Code: Select all

var oldspeed;
oldspeed = get MAX_SPEED;
set MAX_SPEED to 0.000001;
sleep rand(2000,5000);
set MAX_SPEED to oldspeed;
Fri13
Posts: 54
Joined: 03 Feb 2007, 13:15

AA

Post by Fri13 »

Does that AimWeapon function allow limiting AA range too?
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

No, you can only prevent the unit from firing when it's aiming in a certain angle. The unit does not move in position then so it's able to fire then though. That is why I don't recommend that method.

AA (flaks) are generally LOS weapons IIRC so it would only work well with ballistics.

Code: Select all

AimWeapon1(pitch, heading)
{
	signal SIG_AIM1;
	set-signal-mask SIG_AIM1;
	if (pitch < <5>) signal SIG_AIM1;

	...
	turn blah...
	wait-on-turn blah...
	...

	return TRUE;
}
That should force a weapon not to fire when it's ptich is greater than 5├âÔÇÜ├é┬░ downwards. This basically means it can shoot at close targets but not too close. As I mentioned, it won't make the unit move into a good firing position.
Post Reply

Return to “Game Development”