Hi great Spring developers and players.
Excuse my english
I have a little problem with the Weapon::Burst variable, for a unit.
This unit has 3 points where the bullets have to exit.
The idea is that the unit have to shot 1-2-3 in rapid sequence.
The unit has Burst 3, and FirePrimary is written to alternate the point.
The problem is that, after many tests, with burst it shots in wrong order (1-2-2, 1-1-1, 2-3-3, and so).
If I delete burst from weapon, the alternance is right (1-2-3).
Is it possible that Fireprimary isn't called every shot of the burst serie?
Weapon::Burst problem
Moderator: Moderators
-
- Posts: 916
- Joined: 27 Jun 2009, 01:32
Re: Weapon::Burst problem
For that functionality you mustn't use the FirePrimary function because (as you saw) it doesn't recognize the respective burst the right way. You have to use the Shot function for that. To give an example COB code:
Code: Select all
AimPrimary(heading, pitch)
{
signal SIG_AIM;
set-signal-mask SIG_AIM;
turn turret to y-axis heading speed <25.000000>;
turn sleeve to x-axis <0.000000> - pitch speed <25.000000>;
wait-for-turn turret around y-axis;
wait-for-turn sleeve around x-axis;
return (1);
}
Shot1()
{
if (activeGun1 == 0)
{
firepoint = flare1;
++activeGun1;
show flare1;
emit-sfx 1024 + 0 from flare1;
move barrel1 to z-axis [-3.000000] now;
sleep 150;
hide flare1;
move barrel1 to z-axis [0.000000] speed [1.000000];
}
else if (activeGun1 == 1)
{
firepoint = flare2;
++activeGun1;
show flare2;
emit-sfx 1024 + 0 from flare2;
move barrel2 to z-axis [-3.000000] now;
sleep 150;
hide flare2;
move barrel2 to z-axis [0.000000] speed [1.000000];
}
else if (activeGun1 == 2)
{
firepoint = flare3;
activeGun1 = 0;
show flare3;
emit-sfx 1024 + 0 from flare3;
move barrel3 to z-axis [-3.000000] now;
sleep 150;
hide flare3;
move barrel3 to z-axis [0.000000] speed [1.000000];
}
}
QueryPrimary(piecenum)
{
piecenum = firepoint;
}
AimFromPrimary(piecenum)
{
piecenum = sleeve;
}
Re: Weapon::Burst problem
Wow, I suspected something so.
Can I eliminate FireWeapon1 from the cob and subsitute it with Shot1?
Thank you
Can I eliminate FireWeapon1 from the cob and subsitute it with Shot1?
Thank you
-
- Posts: 916
- Joined: 27 Jun 2009, 01:32
Re: Weapon::Burst problem
Yes - you can completely replace FireWeapon1 with Shot1...
EDIT:
Just as an add-on although it should be obvious you have to create "firepoint" (or whatever you want to name it) as a static-var in the beginning of your script and also assign the first part to it in the Create function...
EDIT:
Just as an add-on although it should be obvious you have to create "firepoint" (or whatever you want to name it) as a static-var in the beginning of your script and also assign the first part to it in the Create function...
Re: Weapon::Burst problem
Yes, I did it.
Thank you
Thank you
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Weapon::Burst problem
Edit: Nevermind, he's moving barrels too, while this can be done, better not confuse things here.
Re: Weapon::Burst problem
Yes, I have no barrel or mobile part, only the holes where the missiles appear (the unit is a tank with 3 pitbull type missile).
A little problem: the solution is perfect, now I've noticed that the smoke trails appear only when the missile hit the target (ground in the test, or an enemy unit).
Is it possible to trace the trail, following the missile?
A little problem: the solution is perfect, now I've noticed that the smoke trails appear only when the missile hit the target (ground in the test, or an enemy unit).
Is it possible to trace the trail, following the missile?
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Weapon::Burst problem
Update your spring.exe, this has been fixed.
http://www.springinfo.info/?p=1016
If you're not moving parts then all you need is this:
http://www.springinfo.info/?p=1016
If you're not moving parts then all you need is this:
The sleeps are just to delay firing, you can take them out if you want. (2048 is weapon1, 2049 is weapon2, etc)FireWeapon1()
{
sleep 150;
emit-sfx 2048 + 0 from firepoint2;
emit-sfx 2048 + 0 from firepoint3;
sleep 150;
emit-sfx 2048 + 0 from firepoint4;
emit-sfx 2048 + 0 from firepoint5;
sleep 150;
}