sysCreateWeaonFire premature expolosions

These are old bug reports that have been closed.
Locked
Bobby
Militia Captain
Militia Captain
Posts: 675
Joined: Wed Jul 25, 2007 7:39 pm

I have code designed to launch a missile from the cargo hold at the current target, unfortunately, when a fragmenting missile is used, they detonate immediately. I have set the condition to ignore failsafes to both "true" and "false", but they explode immediately.

also, missiles don't fragment on direct hits, but that's a different topic completely.

here's the important bit, the rest is devoted to deciding what to do.

Code: Select all

	(block Nil
		(sysCreateWeaponFire (objGetData gSource "sweapon") gSource (objGetPos gSource) (intVectorAngle gSource (objGetTarget gSource)) 40 (objGetTarget gSource) False)
		(objRemoveItem gSource (itmCreate (objGetData gSource "sweapon") 1) 1)
	)
where the data in "sweapon" is the unid for a fragmentation missile and intVectorAngle finds the direction to the target.
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

Bobby wrote:unfortunately, when a fragmenting missile is used, they detonate immediately.
Does this only happen with fragmenting missiles?
User avatar
Prophet
Militia Captain
Militia Captain
Posts: 826
Joined: Tue Nov 18, 2008 6:09 pm

My "Capship Weapons mod" has an auton firing a fragmenting missile with sysCreateWeaponsFire and I did not have a problem with premature fragmentation (snicker)

Perhaps it is due to setting the point of origin as (objGetPos gSource) and it's hitting the ship it's installed on? try setting it to (sysVectorPolarOffset gSource (shpGetDirection gSource) 5) to have it created just infront. I was calling the missile from a small ship and had no problems.
Coming soon: The Syrtian War adventure mod!
A Turret defense genre mod exploring the worst era in Earth's history.
Can you defend the Earth from the Syrtian invaders?
Stay tuned for updates!
Bobby
Militia Captain
Militia Captain
Posts: 675
Joined: Wed Jul 25, 2007 7:39 pm

well, I tried the offset and no dice, they still detonate immediately, and it throws off the aim, additionaly i know it's not hitting the ship because it doesn't damage me, and trackers track the target.

and yes, only the fragmenters detonate, the others, like longbows and quantumsphere shells operate as desired.
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

I think the problem might be with the last parameter to (sysCreateWeaponFire)

You passed in 'False'. But 'False' is not a valid identifier. You should pass in Nil (or simply omit the last parameter).

Try that and see if it helps.
Bobby
Militia Captain
Militia Captain
Posts: 675
Joined: Wed Jul 25, 2007 7:39 pm

it worked, thanks!
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

i know it's not hitting the ship because it doesn't damage me
One little additional note, that might not be true.
All the fragments do NOT damage the source ship unless canHitSource= "true" is put in the fragment.
Locked