Hello. I'm trying to make a grenade, using the gamevar PIPEBOMB_CONTROL with the values 2 1, and the gamevar GRENADE_LIFETIME with X 1, but sometimes the grenade doesn't explode. I'm doing something wrong or it's a bug?
Thanks in advance.
Page 1 of 1
Grenade Lifetime "Sometimes it doesn't explode"
#1 Posted 17 August 2013 - 11:01 AM
#3 Posted 17 August 2013 - 11:40 AM
I tested and it seems to be true. But I couldn't figure out what's the problem.
#4 Posted 17 August 2013 - 12:09 PM
If I delete the gamevar GRENADE_LIFETIME it works fine, but it takes a long time to explode.
#5 Posted 17 August 2013 - 12:25 PM
I think it's cool if it doesn't explode every single time.. It makes it more realistic
Next stop.. gun jams!
Next stop.. gun jams!
#6 Posted 17 August 2013 - 02:41 PM
I believe I have found out what's the problem, it's possible for a Pipebomb to spawn with a negative htg_t 7 and is likely related to this section of the source:
actor[j].t_data[7]= ltime + mulscale(krand(),lv, 14) - lv;
#8 Posted 27 December 2013 - 06:52 AM
Sorry for reviving this old post, but what is r4019? And is there a way to fix the bug using only CON?
#9 Posted 27 December 2013 - 09:17 AM
Perro Seco, on 27 December 2013 - 06:52 AM, said:
Sorry for reviving this old post, but what is r4019? And is there a way to fix the bug using only CON?
No, that looks like engine bug, fixed at eduke32 synthesis build r4019 and later.
Get a new latest one from there.
http://dukeworld.duk...ke32/synthesis/
But seems no one tested that fix so try it yourself.
#10 Posted 27 December 2013 - 12:13 PM
Thank you. Now all the grenades explode, but there's another bug; sometimes they explode immediately when I launch them and they kill me...
#12 Posted 05 January 2014 - 08:41 AM
Fox, on 17 August 2013 - 02:41 PM, said:
I believe I have found out what's the problem, it's possible for a Pipebomb to spawn with a negative htg_t 7 and is likely related to this section of the source:
actor[j].t_data[7]= ltime + mulscale(krand(),lv, 14) - lv;
Oh, sigh, that's clearly wrong. Here, 'ltime' holds the value of *_LIFETIME and 'lv' that of *_LIFETIME_VAR. The way it's now, the ultimate lifetime is in the range
LIFETIME - LIFETIME_VAR + [0 .. LIFETIME_VAR/4].
It's not clear what the author of that code intended; if he assumed that krand() returns a value in [0 .. 32767] (it's really [0 .. 65535]), it would make some sense: the range would then be
[LIFETIME - LIFETIME_VAR .. LIFETIME + LIFETIME_VAR]. (1)
Then again, "var(iance)" could be meant to mean "extent" (max - min), in which case the intent was to make the range
[LIFETIME - LIFETIME_VAR/2 .. LIFETIME + LIFETIME_VAR/2]. (2)
I think fixing the code for meaning (1), i.e. using mulscale15 is most sensible. It changes the meaning retroactively, sure, but personally, I don't care for EDuke-era mods or WW2GI/NAM, presumably the only CON code where the "variance" was used at all.
#13 Posted 06 January 2014 - 01:05 AM
Helixhorned, on 05 January 2014 - 08:41 AM, said:
The way it's now, the ultimate lifetime is in the range
LIFETIME - LIFETIME_VAR + [0 .. LIFETIME_VAR/4].
LIFETIME - LIFETIME_VAR + [0 .. LIFETIME_VAR/4].
Oops, it should read:
LIFETIME - LIFETIME_VAR + [0 .. 4*LIFETIME_VAR].
Perro Seco: what are the values of GRENADE_LIFETIME and GRENADE_LIFETIME_VAR you use? After all, as the above shows, it's perfectly expected that they occasionally explode immediately if LIFETIME_VAR >= LIFETIME.
#14 Posted 06 January 2014 - 01:40 AM
I checked the EDuke 2.0 source code and the statement in question has not changed.
{ long lGrenadeLifetime=GetGameVar("GRENADE_LIFETIME", NAM_GRENADE_LIFETIME, -1, snum); long lGrenadeLifetimeVar=GetGameVar("GRENADE_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, -1, snum); //sprintf(g_szBuf,"Lifetime=%ld Var=%ld snum=%d",lGrenadeLifetime, lGrenadeLifetimeVar, snum); //AddLog(g_szBuf); // set timer. blows up when at zero.... sprite[j].extra=lGrenadeLifetime + mulscale(krand(),lGrenadeLifetimeVar, 14) - lGrenadeLifetimeVar; }
#15 Posted 09 January 2014 - 09:14 AM
Helixhorned, on 06 January 2014 - 01:05 AM, said:
Oops, it should read:
LIFETIME - LIFETIME_VAR + [0 .. 4*LIFETIME_VAR].
Perro Seco: what are the values of GRENADE_LIFETIME and GRENADE_LIFETIME_VAR you use? After all, as the above shows, it's perfectly expected that they occasionally explode immediately if LIFETIME_VAR >= LIFETIME.
LIFETIME - LIFETIME_VAR + [0 .. 4*LIFETIME_VAR].
Perro Seco: what are the values of GRENADE_LIFETIME and GRENADE_LIFETIME_VAR you use? After all, as the above shows, it's perfectly expected that they occasionally explode immediately if LIFETIME_VAR >= LIFETIME.
Share this topic:
Page 1 of 1