Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Spoon on August 01, 2011, 10:27:28 am

Title: Min-Max lifetime debug message [Fixed]
Post by: Spoon on August 01, 2011, 10:27:28 am
Lifetime min or max specified, but $Lifetime was also specified; min or max will be used.
ntdll.dll! NtWaitForSingleObject + 21 bytes
kernel32.dll! WaitForSingleObjectEx + 67 bytes
kernel32.dll! WaitForSingleObject + 18 bytes
fs2_open_3_6_13d_INF_SSE2-20110730_r7388.exe! <no symbol>
fs2_open_3_6_13d_INF_SSE2-20110730_r7388.exe! <no symbol>
fs2_open_3_6_13d_INF_SSE2-20110730_r7388.exe! <no symbol>
fs2_open_3_6_13d_INF_SSE2-20110730_r7388.exe! <no symbol>
fs2_open_3_6_13d_INF_SSE2-20110730_r7388.exe! <no symbol>
fs2_open_3_6_13d_INF_SSE2-20110730_r7388.exe! <no symbol>
fs2_open_3_6_13d_INF_SSE2-20110730_r7388.exe! <no symbol>
fs2_open_3_6_13d_INF_SSE2-20110730_r7388.exe! <no symbol>
fs2_open_3_6_13d_INF_SSE2-20110730_r7388.exe! <no symbol>
fs2_open_3_6_13d_INF_SSE2-20110730_r7388.exe! <no symbol>
kernel32.dll! BaseThreadInitThunk + 18 bytes
ntdll.dll! RtlInitializeExceptionChain + 99 bytes
ntdll.dll! RtlInitializeExceptionChain + 54 bytes


Debug has been giving me this warning for a while now. It's caused by a turret having a weapon with a $min-max lifetime: defined.
However if a turret doesn't have the normal $lifetime: defined it won't shoot at all (probably because it needs lifetime*velocity to calculate what range to fire the weapon at).
So what happens is (despite what the debug message seems to say): The weapon uses $lifetime: to determine fire range, then uses $lifetime max: to determine the actual max range at which the weapon will last. (So having a lifetime set higher than the lifetime max causes the weapon to fire at targets outside of its actual range)

Old news, I'm dumb. Should have checked if this was still the case with recent builds. Aparantly it is not and the weapon actually seems to fire without lifetime defined.
Title: Re: Min-Max lifetime debug message
Post by: chief1983 on August 01, 2011, 10:31:03 am
Don't min and max have to be defined together, and if so, shouldn't max be used to calculate the range?
Title: Re: Min-Max lifetime debug message
Post by: Valathil on August 01, 2011, 10:40:30 am
Looking at the code i guess you didnt define a weapon_range cause the actual distance check does min(randomrangebetweenminmax, wapon_range) so if thats 0 you allways get 0 and no turret firing
Title: Re: Min-Max lifetime debug message
Post by: Spoon on August 01, 2011, 10:54:26 am
Don't min and max have to be defined together, and if so, shouldn't max be used to calculate the range?
I do have them defined together, it still uses $lifetime: to calculate range.

Looking at the code i guess you didnt define a weapon_range cause the actual distance check does min(randomrangebetweenminmax, wapon_range) so if thats 0 you allways get 0 and no turret firing
Pretty sure turrets don't care about +Weapon Range:
Doesn't seem to make any difference what range I set it to or if I comment the line out or not.
Title: Re: Min-Max lifetime debug message
Post by: Valathil on August 01, 2011, 11:01:19 am
well min max should only be defined if theres no lifetime so thats out the window anyway, if the turret doesnt fire if you just do min max then there has to be another problem, is this a big ship or a fighter
Title: Re: Min-Max lifetime debug message
Post by: Spoon on August 01, 2011, 11:35:43 am
Disregaaard me, I'm dumb and despite what may or may not have happened half a year ago when I first ran into this. The weapon actually works fine without $lifetime: and just min and max.

Sorry for wasting everyone's time on this.  :o
Title: Re: Min-Max lifetime debug message
Post by: Spoon on August 07, 2011, 10:02:04 am
I feel I should bump this one more time to slightly restore my honor on this case!
What I have been experiencing (and thus led me to conclude that it wasn't working) was this:
"Rev 7432: From Valathil: Fixes a problem with a min-max lifetime smart spawn weapons where it wouldn't fire except at close range"
So there was indeed a problem, I was just too confused to identify it properly!

Anyway, Valathil was again a total baller and threw some builds at me that eventually got to the core of the matter. And its all fine and dandy now!


See? I'm not completely crazy!
Title: Re: Min-Max lifetime debug message [Fixed]
Post by: Valathil on August 07, 2011, 12:42:45 pm
Fixing Spoon's problems. LIKE A BOSS