Find a 1.0/B27 mod and find a stick bomb item and review the script.
Seems legit. I'll try later today.
Tried this, still having trouble. Halp. EDIT: Tried using 'Sticky.lua' in Base.rte. Didn't help, it just gets stuck to my actor and doesn't detonate.
\
Cannot find any stick grenade from anyother 1.0/B27 mods? (and credit those scripts)
Wed Oct 23, 2013 8:02 am
Arcalane
Joined: Sun Jan 28, 2007 10:32 pm Posts: 1609 Location: UK
Re: Sticky Grenades.
Best way I found for making a sticky throwable grenade is to have an initial projectile (with GibImpulseLimit = 1) that gibs into a second sticky component stage when it hits the target. The second stage is what actually explodes, and should be able to use the standard Sticky.lua without many issues.
Also works fairly well for launched grenades, IIRC.
Wed Oct 23, 2013 3:07 pm
clunatic
Joined: Fri Nov 23, 2012 5:42 am Posts: 143
Re: Sticky Grenades.
Make sure the grenade has "ActivatesWhenReleased = 1" set in the ini. If that doesn't work post the sticky.lua script here please, I don't have a copy of it, but I imagine getting it to work like you want should only be a matter of adding 2 or 3 lines.
Wed Oct 23, 2013 4:52 pm
4zK
Joined: Mon Oct 11, 2010 1:15 pm Posts: 594 Location: Finlandia
Re: Sticky Grenades.
Fiddling with the Coalition Timed Explosive is a good start for sticky grenades.
Thu Oct 24, 2013 6:34 pm
Chronometer
Joined: Sun Jan 15, 2012 10:12 pm Posts: 207 Location: Burrowed, waiting for you to come by.
Re: Sticky Grenades.
Large Post. You've been warned.
clunatic wrote:
Make sure the grenade has "ActivatesWhenReleased = 1" set in the ini. If that doesn't work post the sticky.lua script here please, I don't have a copy of it, but I imagine getting it to work like you want should only be a matter of adding 2 or 3 lines.
Doing this would've blown my actors arm off.
4zK wrote:
Fiddling with the Coalition Timed Explosive is a good start for sticky grenades.
Thanks, I'll start to try with it.
Arcalane wrote:
Best way I found for making a sticky throwable grenade is to have an initial projectile (with GibImpulseLimit = 1) that gibs into a second sticky component stage when it hits the target. The second stage is what actually explodes, and should be able to use the standard Sticky.lua without many issues.
Also works fairly well for launched grenades, IIRC.
Could you be more pacific specific? I don't get it. Like, specific as in where and what to change.
Epicnator wrote:
Chronometer wrote:
Chronometer wrote:
Epicnator wrote:
Find a 1.0/B27 mod and find a stick bomb item and review the script.
Seems legit. I'll try later today.
Tried this, still having trouble. Halp. EDIT: Tried using 'Sticky.lua' in Base.rte. Didn't help, it just gets stuck to my actor and doesn't detonate.
\
Cannot find any stick grenade from anyother 1.0/B27 mods? (and credit those scripts)
That makes me feel icky and unoriginal, even though I did have to copy and fiddle with DR's grapple gun script to make my own.
Make sure the grenade has "ActivatesWhenReleased = 1" set in the ini. If that doesn't work post the sticky.lua script here please, I don't have a copy of it, but I imagine getting it to work like you want should only be a matter of adding 2 or 3 lines.
Doing this would've blown my actors arm off.
4zK wrote:
Fiddling with the Coalition Timed Explosive is a good start for sticky grenades.
Thanks, I'll start to try with it.
Arcalane wrote:
Best way I found for making a sticky throwable grenade is to have an initial projectile (with GibImpulseLimit = 1) that gibs into a second sticky component stage when it hits the target. The second stage is what actually explodes, and should be able to use the standard Sticky.lua without many issues.
Also works fairly well for launched grenades, IIRC.
Could you be more pacific specific? I don't get it. Like, specific as in where and what to change.
Epicnator wrote:
Chronometer wrote:
Chronometer wrote:
Epicnator wrote:
Find a 1.0/B27 mod and find a stick bomb item and review the script.
Seems legit. I'll try later today.
Tried this, still having trouble. Halp. EDIT: Tried using 'Sticky.lua' in Base.rte. Didn't help, it just gets stuck to my actor and doesn't detonate.
\
Cannot find any stick grenade from anyother 1.0/B27 mods? (and credit those scripts)
That makes me feel icky and unoriginal, even though I did have to copy and fiddle with DR's grapple gun script to make my own.
I meant by "REVIEWING" the contents like reading how it works.
Fri Oct 25, 2013 10:35 am
Arcalane
Joined: Sun Jan 28, 2007 10:32 pm Posts: 1609 Location: UK
Re: Sticky Grenades.
Chronometer wrote:
Arcalane wrote:
Best way I found for making a sticky throwable grenade is to have an initial projectile (with GibImpulseLimit = 1) that gibs into a second sticky component stage when it hits the target. The second stage is what actually explodes, and should be able to use the standard Sticky.lua without many issues.
Also works fairly well for launched grenades, IIRC.
Could you be more specific? I don't get it. Like, specific as in where and what to change.
This isn't really a case of going in and changing one thing. Stuff like sticky grenades is rarely ever that simple, so if you want to do it then be prepared to go all the way.
Okay, what you need is;
1) The thrown grenade, a TDExplosive. 2) The secondary sticky component. This can be a MOSRotating or AEmitter. I usually set it to use the same sprite and offset as the original grenade.
The secondary sticky component is what actually blows up, making sound/particles/etc. - it has the sticky script attached to it. The primary doesn't need a script by itself but that doesn't mean it must not have a script, either.
The thrown grenade has GibImpulseLimit 1, and exactly one gib; the secondary sticky component. It should have a very long detonation delay to ensure it has time to reach the target, and no gib sound. After the grenade is thrown and it hits a target, it will break into the secondary sticky component. As this searches for the nearest thing and sticks to it in the create event... it sticks to whatever it just hit. Then a timer on it expires, and it explodes.
Script;
Code:
function Create(self) self.lifeTimer = Timer(); local part = nil; local dist = 0; local curdist = 25; local chosenpart = nil;
--Cycle through all MOs and see which is the closest, and attach to it. for i=1,MovableMan:GetMOIDCount()-1 do part = ToMovableObject(MovableMan:GetMOFromID(i)); dist = math.sqrt((self.Pos.X - part.Pos.X) ^ 2 + (self.Pos.Y - part.Pos.Y) ^ 2); if dist < curdist and part.ID ~= self.ID then curdist = dist; chosenpart = part; end end
--If a part was found, attach to it. Otherwise, we assume it is a wall, and stay pinned to it. if chosenpart ~= nil then self.attached = MovableMan:GetMOFromID(chosenpart.RootID); self.offset = Vector(chosenpart.Pos.X-self.Pos.X,chosenpart.Pos.Y-self.Pos.Y); self.offangle = self.offset.AbsRadAngle - chosenpart.RotAngle; self.PinStrength = 0; --Make the grenade not collide with the attached object or any of its children so that it doesn't go off on its own. for i=1,MovableMan:GetMOIDCount()-1 do part = MovableMan:GetMOFromID(i); if part.RootID == self.attached then self:SetWhichMOToNotHit(part,-1); end end end end
function Update(self) --Using trigonometry, move to the right position and update speed and rotation. Check first if it still exists. if self.attached then if MovableMan:ValidMO(self.attached) then self.Pos.X = self.attached.Pos.X + self.offset.Magnitude * math.cos(self.offangle + self.attached.RotAngle); self.Pos.Y = self.attached.Pos.Y + self.offset.Magnitude * math.sin(self.offangle + self.attached.RotAngle); self.Vel = self.attached.Vel; self.RotAngle = self.attached.RotAngle; self.AngularVel = self.attached.AngularVel; end end
if self.lifeTimer:IsPastSimMS(2500) then self:GibThis(); end
end
This is just a modified version of the Base.rte Sticky.lua to add a time delay; replace the time (2500) in IsPastSimMS at the end with however long you want the delay to be remembering that 1000ms = 1 second. The timer is independent of the first stage, so you don't need to worry about premature detonation, but you do need to keep it reasonably short since the victim basically turns into a walking bomb and might be inclined to try giving you an explosive hug.
The whole solution is a little roundabout and I'm sure it's no doubt possible to do a safe one-stage grenade, but I find it's simple, reasonably foolproof, and works quite nicely for sticky grenade launchers as well.
Fri Oct 25, 2013 12:54 pm
Chronometer
Joined: Sun Jan 15, 2012 10:12 pm Posts: 207 Location: Burrowed, waiting for you to come by.
Re: Sticky Grenades.
Arcalane wrote:
Chronometer wrote:
Arcalane wrote:
Best way I found for making a sticky throwable grenade is to have an initial projectile (with GibImpulseLimit = 1) that gibs into a second sticky component stage when it hits the target. The second stage is what actually explodes, and should be able to use the standard Sticky.lua without many issues.
Also works fairly well for launched grenades, IIRC.
Could you be more specific? I don't get it. Like, specific as in where and what to change.
This isn't really a case of going in and changing one thing. Stuff like sticky grenades is rarely ever that simple, so if you want to do it then be prepared to go all the way.
Okay, what you need is;
1) The thrown grenade, a TDExplosive. 2) The secondary sticky component. This can be a MOSRotating or AEmitter. I usually set it to use the same sprite and offset as the original grenade.
The secondary sticky component is what actually blows up, making sound/particles/etc. - it has the sticky script attached to it. The primary doesn't need a script by itself but that doesn't mean it must not have a script, either.
The thrown grenade has GibImpulseLimit 1, and exactly one gib; the secondary sticky component. It should have a very long detonation delay to ensure it has time to reach the target, and no gib sound. After the grenade is thrown and it hits a target, it will break into the secondary sticky component. As this searches for the nearest thing and sticks to it in the create event... it sticks to whatever it just hit. Then a timer on it expires, and it explodes.
Script;
Code:
function Create(self) self.lifeTimer = Timer(); local part = nil; local dist = 0; local curdist = 25; local chosenpart = nil;
--Cycle through all MOs and see which is the closest, and attach to it. for i=1,MovableMan:GetMOIDCount()-1 do part = ToMovableObject(MovableMan:GetMOFromID(i)); dist = math.sqrt((self.Pos.X - part.Pos.X) ^ 2 + (self.Pos.Y - part.Pos.Y) ^ 2); if dist < curdist and part.ID ~= self.ID then curdist = dist; chosenpart = part; end end
--If a part was found, attach to it. Otherwise, we assume it is a wall, and stay pinned to it. if chosenpart ~= nil then self.attached = MovableMan:GetMOFromID(chosenpart.RootID); self.offset = Vector(chosenpart.Pos.X-self.Pos.X,chosenpart.Pos.Y-self.Pos.Y); self.offangle = self.offset.AbsRadAngle - chosenpart.RotAngle; self.PinStrength = 0; --Make the grenade not collide with the attached object or any of its children so that it doesn't go off on its own. for i=1,MovableMan:GetMOIDCount()-1 do part = MovableMan:GetMOFromID(i); if part.RootID == self.attached then self:SetWhichMOToNotHit(part,-1); end end end end
function Update(self) --Using trigonometry, move to the right position and update speed and rotation. Check first if it still exists. if self.attached then if MovableMan:ValidMO(self.attached) then self.Pos.X = self.attached.Pos.X + self.offset.Magnitude * math.cos(self.offangle + self.attached.RotAngle); self.Pos.Y = self.attached.Pos.Y + self.offset.Magnitude * math.sin(self.offangle + self.attached.RotAngle); self.Vel = self.attached.Vel; self.RotAngle = self.attached.RotAngle; self.AngularVel = self.attached.AngularVel; end end
if self.lifeTimer:IsPastSimMS(2500) then self:GibThis(); end
end
This is just a modified version of the Base.rte Sticky.lua to add a time delay; replace the time (2500) in IsPastSimMS at the end with however long you want the delay to be remembering that 1000ms = 1 second. The timer is independent of the first stage, so you don't need to worry about premature detonation, but you do need to keep it reasonably short since the victim basically turns into a walking bomb and might be inclined to try giving you an explosive hug.
The whole solution is a little roundabout and I'm sure it's no doubt possible to do a safe one-stage grenade, but I find it's simple, reasonably foolproof, and works quite nicely for sticky grenade launchers as well.
Did stuff, this happens.
Code:
--------------------------- RTE Aborted! (x_x) --------------------------- Could not match property Error happened in ChimaeraRnD.rte/Devices/Devices.ini at line 4!
The last frame has been dumped to 'abortscreen.bmp'
You can copy this message with Ctrl+C
Before reprimanding me to check the code on line 4, look at it yourself.
It was honestly just for ease of access. EDIIIIIIIIIIIIIIIIIIIIIIIIT: Goddamn it why is it so goddamn hard to do a simple goddamn task. GARRRRRGH. Well, the dummy mine gibs on contact, but it doesn't gib into anything. What it should gib into is a sticky magmine, no? Well it doesn't work QQ
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