PDA

View Full Version : [tf2] m_flDetonateTime doesn't work


girl
01-10-2012, 13:56
I would really appreciate any information regarding demoman's grenades. I'm trying to make them not explode on their own, but setting the projectile, when it's fired...

SetEntPropFloat(iEntity, Prop_Data, "m_flDetonateTime", 999.0);

(where iEntity is the projectile after it's been fired)

Does nothing. Neither does constantly setting the m_bIsLive to 0 or 1 (it doesn't even explode under either condition), so I don't believe that is referring to the "live-ness" of the grenade. I've also tried setting m_flDetonateTime to 0.0 as a test, but the grenade doesn't immediately explode then, either.

I've searched, I think pretty extensively, but there's little documentation of tf_projectile_pipe. https://forums.alliedmods.net/showthread.php?t=93862 seems to suggest that m_flDetonationTime has no use or purpose.

Does anyone know how I could make longer and/or shorter lasting grenades? Ones that stick around forever when fired? I do have one solution in mind (making the grenade launcher shoot sandman balls that don't stun and explode on contact) but it's a little messy. I could try replace them with stickies, however, I'd like for all the tumble/roll physics of the grenade to remain in-tact.

McFlurry
01-10-2012, 14:58
Are you using OnEntityCreated? If so, don't. Instead use SDK Hooks and hook the projectile with SDKHook_SpawnPost when it's created. That should work.

pheadxdll
01-10-2012, 16:17
SetEntPropFloat(iEntity, Prop_Send, "m_flDetonateTime", 999.0);

Did you mean Prop_Data, that doesn't exist in the networked properties. Otherwise, McFlurry's advice is good, or it may not be used altogether.

girl
01-10-2012, 16:32
Are you using OnEntityCreated?

I am...

Did you mean Prop_Data

Sorry, I did. Blah, fixed my first post.

Instead use SDK Hooks and hook the projectile with SDKHook_SpawnPost when it's created. That should work.

I'll try that, thanks for your advice! But I'm rather curious why I shouldn't use OnEntityCreated. It's worked okay so far for things I've been doing.

McFlurry
01-10-2012, 17:31
The reason I suggested SpawnPost is that is when an entity has had their model set, I assume that other entity properties like model are set by the game on entity spawn. In which case this fires 1 frame after an entity spawns.