Duke4.net Forums: Grenade Lifetime - Duke4.net Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Grenade Lifetime  "Sometimes it doesn't explode"

User is offline   Perro Seco 

#1

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.
1

User is offline   The Commander 

  • I used to be a Brown Fuzzy Fruit, but I've changed bro...

#2


1

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#3

I tested and it seems to be true. But I couldn't figure out what's the problem.
1

User is offline   Perro Seco 

#4

If I delete the gamevar GRENADE_LIFETIME it works fine, but it takes a long time to explode.
0

User is offline   DNSKILL5 

  • Honored Donor

#5

I think it's cool if it doesn't explode every single time.. It makes it more realistic :P

Next stop.. gun jams!
1

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#6

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;

1

User is offline   TerminX 

  • el fundador

  #7

Should be fixed in r4019. I didn't test it. :P
0

User is offline   Perro Seco 

#8

Sorry for reviving this old post, but what is r4019? And is there a way to fix the bug using only CON?
0

User is offline   Player Lin 

#9

View PostPerro 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. :wub:
0

User is offline   Perro Seco 

#10

Thank you. Now all the grenades explode, but there's another bug; sometimes they explode immediately when I launch them and they kill me...
0

User is offline   Jimmy 

  • Let's go Brandon!

#11



I regret nothing.
0

User is offline   Helixhorned 

  • EDuke32 Developer

#12

View PostFox, 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.
0

User is offline   Helixhorned 

  • EDuke32 Developer

#13

View PostHelixhorned, 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].

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.
0

User is offline   Hendricks266 

  • Weaponized Autism

  #14

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;
					}

0

User is offline   Perro Seco 

#15

View PostHelixhorned, 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.
Hey, thanks for your help, but when I saw the GRENADE_LIFETIME in Eduke32 Wiki I didn't saw the GRENADE_LIFETIME_VAR, so it hadn't any value and maybe it was the problem. Now GRENADE_LIFETIME has the value 30 1 and GRENADE_LIFETIME_VAR 1 1, and it works great.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks not owned by Voidpoint, LLC are the sole property of their respective owners. Play Ion Fury! ;) © Voidpoint, LLC

Enter your sign in name and password


Sign in options