Home   Help Search Login Register  

Author Topic: Timed grenades  (Read 552 times)

0 Members and 1 Guest are viewing this topic.

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Timed grenades
« on: 22 Nov 2004, 03:40:07 »
Can you make grenades timed? would it be done in the config? How? ::)

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:Timed grenades
« Reply #1 on: 22 Nov 2004, 03:48:12 »
ecp has that. isnt general barron in the ecp mod, ask him.

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Timed grenades
« Reply #2 on: 22 Nov 2004, 06:01:19 »
Yeah, the ECP has timed grenades. They were originally made by ktotte, and I think were improved by snYpir (?). Anyway, if you search the forums for "timed grenades", you can see ktotte's original timed grenade addon. It isn't done entirely through the config though. Bluelikeyou made a timed grenade script that worked pretty well. You can grab it here:

http://www.ofpec.com/editors/resource_view.php?id=672
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Offline Fire-Fox

  • Members
  • *
  • Violence is just a friend walking on the right way
Re:Timed grenades
« Reply #3 on: 22 Nov 2004, 17:36:40 »
How about using eventhandlers? Add a "fired" eventhandler to every unit, let it detect when a hand grenade has been thrown and then detect the grenade using the nearestobject command. Then open a script that detects when the grenade is about 0.1m above the ground, get its position and save it in a variable, then delete the grenade using the deletevehicle command. Insert a waiting timer of however long you want your grenades to be timed and then camcreate a grenade explosion at the locked position.

This is not tested, but IMHO it would be worth a try.

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Timed grenades
« Reply #4 on: 22 Nov 2004, 21:39:57 »
i have the ecp grenades, and i opened it up, but all of the scripts appear to be called with arguments.... and there is nothing i can find that provides those arguments. I think the only argument needed to start the whole thing is the unit, which it adds the EH to. but i can't find where. perhaps that is in the config? BTW I need to know how to do this because I'm working on a flashbang and it has to be timed, so i can't really use Fire-fox's idea, even though thats basically what the ecp thing does from what i can tell

Offline KTottE

  • Former Staff
  • ****
Re:Timed grenades
« Reply #5 on: 22 Nov 2004, 22:07:17 »
fired = "if ((_this select 1) == ""KTE_Throw"") then {_this exec ""\path_to_your_addon\sciptname.sqs""}";

What this does is it checks to see if the weapon used is the KTE_Throw weapon (if I remember correctly that's what I named the throw weapon in my addon), and if so it runs the startup script for the grenade fusing.

You could easily check so it's an ammotype instead, by using _this select 4 instead. You could also check against multiple types of weapons or ammo, by doing something similar:

if ((_this select 4) in [""AmmoType1"",""AmmoType2"",""AmmoType3""]) then {}

Note that you need to include double-double quotes (two on each side) with the ammo and weapon classnames, since otherwise you'll get a syntax error.  This is when adding them in the config.

You could just as easily add them in a mission with the addEventHandler command, the arguments and parameters are the same.
"Life is not a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside, thoroughly used up, totally worn out, and loudly proclaiming 'WOW What a Ride!'"

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Timed grenades
« Reply #6 on: 22 Nov 2004, 22:13:27 »
Quote
fired = "if ((_this select 1) == ""KTE_Throw"") then {_this exec ""\path_to_your_addon\sciptname.sqs""}";
uh... where is that? I can't find where it is in the ecp grenades, and i don't know what i would do with it.. :P

Offline KTottE

  • Former Staff
  • ****
Re:Timed grenades
« Reply #7 on: 23 Nov 2004, 07:48:01 »
It's the fired eventHandler as added in the config of the unit.
"Life is not a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside, thoroughly used up, totally worn out, and loudly proclaiming 'WOW What a Ride!'"