|
Page 1 of 1
|
[ 7 posts ] |
|
Western Pack WIP - Explosive Trigger Problem
Author |
Message |
Fat Zombie
Joined: Wed Jan 25, 2006 8:15 pm Posts: 66
|
Western Pack WIP - Explosive Trigger Problem
Hey there, y'all. I've been working on a new weapons pack in the time that I should really be using for revising. It's Old-west themed, so far it's only got a few guns in it but hopefully I should be able to spruce it up a bit more before I release.
Of course, I probably wouldn't feel so compelled to spend so much time on it if I could fix this problem I'm having with my explosives:
My aim has been to create a 'cluster bomb' of sorts; it's a bundle of dynamite sticks which ideally, when thrown, lights a fuse (cosmetic only), and splits into three sticks of dynamite (this happens either after a short period of time, about 3 seconds, or when it hits a hard surface). These sticks spread out over a short distance and fizz a bit before exploding.
Of course, I'm having nothing but aches trying to get this to work. My current approach has been:
TDExplosive "Dynamite Bundle" triggers after 1/10th of a second, gibs into MOSRotating "DynoBundle" with fuse emitter, low gib impulse limit. Hits hard surface, gibs into 3 X MOSRotating "Dynamite Stick" fuse emitters, and a trigger emitter which fires a high-impulse particle into the stick, detonating it after three seconds.
Of course, this means that if the DynoBundle doesn't gib upon impact, it doesn't split at all. I could just skip stage 2 but I find that if I do that, the bundle gibs into the sticks almost immediately after selecting the weapon. And as it is, I find that the bundle is already gibbing anyway.
Are there any ideas you might have to solve this? I'd be loathe to use lua, as I find that it's a bit too complex for my tastes (and again, the have-exams-in-less-than-a-week thing making me unwilling to try and learn lua); but if it's the only way, I might give it a shot.
Please find the current code file for the dynamite attached. If need be, I can attach the folder if the problem/solution isn't readily apparent.
Thanks very much!
Attachments:
File comment: current code for the dynamite.
dynamite.ini [10.53 KiB]
Downloaded 146 times
|
Fri May 28, 2010 8:25 pm |
|
|
Duh102
happy carebear mom
Joined: Tue Mar 04, 2008 1:40 am Posts: 7096 Location: b8bbd5
|
Re: Western Pack WIP - Explosive Trigger Problem
There is a simple bit of Lua you could do to make it gib after a certain amount of time, if that's what you're looking for. You could then make the GibImpulseLimit of the Dynobundle quite large and perhaps give the user some time to escape before it goes kablooie. Here's the basic code, change the 500 to whatever you like (in milliseconds). Code: function Create(self) self.timer = Timer(); self.time = 500; end
function Update(self) if self.timer:IsPastSimMS(self.time) then self:GibThis(); end end
|
Fri May 28, 2010 8:32 pm |
|
|
Fat Zombie
Joined: Wed Jan 25, 2006 8:15 pm Posts: 66
|
Re: Western Pack WIP - Explosive Trigger Problem
Duh102 wrote: There is a simple bit of Lua you could do to make it gib after a certain amount of time, if that's what you're looking for. You could then make the GibImpulseLimit of the Dynobundle quite large and perhaps give the user some time to escape before it goes kablooie. Here's the basic code, change the 500 to whatever you like (in milliseconds). Code: function Create(self) self.timer = Timer(); self.time = 500; end
function Update(self) if self.timer:IsPastSimMS(self.time) then self:GibThis(); end end Ah! Fancy. So, if I implemented this, then I could remove the trigger-emitters for the sticks. And then I wouldn't have to have the two-stage bundle; I could just make the TDExplosive trigger into the sticks directly after a time. Question; does this timer start only when the sticks are gibbed out of the main bundle? Because I know that the main problem with the emitter thing is that it emits even when the entity holding the emitter hasn't gibbed the emitter out yet, which is probably why I'm having these problems. Thank you very much, this is a great help.
|
Fri May 28, 2010 8:39 pm |
|
|
Duh102
happy carebear mom
Joined: Tue Mar 04, 2008 1:40 am Posts: 7096 Location: b8bbd5
|
Re: Western Pack WIP - Explosive Trigger Problem
The timer starts when the object is created, so I would keep the three stages, but perhaps make the TDExplosive have a really really short fuse (like 5) so that it instantly turns into the Lua timer'd object and begins the countdown.
|
Fri May 28, 2010 8:53 pm |
|
|
Fat Zombie
Joined: Wed Jan 25, 2006 8:15 pm Posts: 66
|
Re: Western Pack WIP - Explosive Trigger Problem
Hm.
Okay, the lua you posted works a treat. No denying that. But i'm still getting some annoying bugs with the dynamite.
Before the actor has tried throwing it, it's fine. But as soon as I try throwing it, it might suddenly 'trigger', dropping to the ground before I've had a chance to throw it (leaving the 'grenade throw strength' indicator on the actor, which automatically throws any grenade that you select). And sometimes the dynamite will just fall off the actor.
Seriously, what the heck? This is quite irritating. I've tried other grenades and it seems specific to mine. Any ideas?
EDIT:
Okay, so I've edited the TDE with the lua, as well. So all three use the timer code (4 secs for 2nd/3rd stages, .4 of a second for the 1st). I've also noticed that the above problems stop if I set Activate When Released = 1.
EDIT 2:
It's still doing the instant gib thing. Spawning the dynamite on its own has the right effect, but trying to throw it is temperamental. Usually it gibs as soon as it's out of the guy's hand, not the 0.4 seconds I've specified in the lua.
Is there some sort of function in lua so that it triggers only once the object's been thrown?
|
Sat May 29, 2010 12:34 am |
|
|
Petethegoat
Joined: Mon Jun 15, 2009 4:02 pm Posts: 905
|
Re: Western Pack WIP - Explosive Trigger Problem
There is something in ini that should do what you want it to, TriggerAfterRelease or something like that? I'm sure someone more enlightened will be able to tell you what it actually is.
|
Sat May 29, 2010 9:23 am |
|
|
Fat Zombie
Joined: Wed Jan 25, 2006 8:15 pm Posts: 66
|
Re: Western Pack WIP - Explosive Trigger Problem
Note: I found a piece of lua code after searching which I used to replace the instant triggerdelay on the TDExplosive which was causing the bombs to trigger prematurely. Code: function Update(self) if self:IsActivated() == true then NewObject = CreateMOSRotating("DynoBundle"); NewObject.Pos.X = self.Pos.X NewObject.Pos.Y = self.Pos.Y NewObject.Vel = self.Vel MovableMan:AddParticle(NewObject); self.ToDelete = true; end end It was originally posted by Mind; I can't find the original post again. With that, I could increase the TriggerDelay to a really high number, and the explosives work perfectly. Problem Solved.
|
Mon May 31, 2010 12:34 am |
|
|
|
|
Page 1 of 1
|
[ 7 posts ] |
|
Who is online |
Users browsing this forum: Google [Bot] |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|