Home   Help Search Login Register  

Author Topic: Smokeshell from Grenade Launcher  (Read 691 times)

0 Members and 1 Guest are viewing this topic.

Offline Wadmann

  • OFPEC Patron
  • ****
  • I'm the next evolutionary step after a llama!
Smokeshell from Grenade Launcher
« on: 29 Dec 2005, 21:20:28 »
As the title suggests, I am trying to launch a smokeshell from a grenade launcher for an airstrike script but have run into some minor problems.

As I do not want a nice smokey arc emanating from my position, I would like the smokeshell to be created at the grenades position prior to the grenade exploding. I have achieved this in a nice open field but if I launch the "marker" towards a town or wooded area the "marker" tends to explode!  ???

I saw this code by Kyle Sarnik and attempted to use it but the version below was cleaned up and this concept was deleted from the script:

Code: [Select]
? (nearestobject [building,"smokeshell"] distance building) < 5
I also am having trouble getting the script to rerun after I fire it the first time. I have removed the addaction and eventHandlers by way of the script with the intent to have a variable added to the Condition line to allow subsequent "marker" launches. I thought that the code currently in place would allow this but it does not. >:(

Any and all suggestions/help is appreciated!

Wadmann

Trigger Codes (Variable to condition line to be added later)
Code: [Select]
Condition:
this && {_x hasWeapon "M16GrenadeLauncher"} count thislist >= 1

On Activation:
{_x addAction ["Launch Marker Grenade", "addeh.sqs"]} forEach thislist


addeh.sqs
Code: [Select]
_mkrlnchr = _this select 0
_mkrlnchr addeventhandler ["fired",{_this exec "throw.sqs"}]
_mkrlnchr removeaction 0
exit

Throw.sqs (by Merc modified by me)
Code: [Select]
;Throw.sqs
;By: Merc
;
;This script allows you to "throw" almost anything you want.
;
;1.create a dude and put this in his init field:
;(name of dude) addEventHandler ["fired",{_this exec "throw.sqs"}]
;
;2.then create a trigger, set it to the side of the dude, put the trigger over the dude, and put this in the activation field:
;shoter = "LASERGUIDEDBOMB"; typeot = "throw"
;
;3.preview
;
;now when the dude throws any type of grenade then he will throw a Laser Guided Bomb instead.
;
;you can change "LASERGUIDEDBOMB" to anything you want ex. "FLare" or "Smokeshellred"
;
;"throw" is how you fire, so if you change it to "M16" then when the dude fires an M16 then he will fire a Laser Guided Bomb
;
;i suggest that you make the dude yourself so you can "throw" what ever you want



_person = _this select 0
_gun = _this select 1
_tho = _this select 2
_ammo = _this select 4

?(_tho != typeot) : goto "end"

#loop

_obj = nearestobject [_person, _ammo]
_person removeeventhandler ["fired",0]
;_person removealleventhandlers "fired"

#loop2

@( (position _obj select 2) < .5)
_xs = getpos _obj select 0
_ys = getpos _obj select 1
_zs = getpos _obj select 2

_xv = velocity _obj select 0
_yv = velocity _obj select 1
_zv = velocity _obj select 2

deletevehicle _obj

_shell1 = shoter camcreate [_xs,_ys,_zs]
_shell1 setdir (getdir _person)
_shell1 setvelocity [_xv,_yv,_zv]

goto "end"

#end

Throw.sqs trigger
Code: [Select]
Condition:
This (West Present)

On Activation:
shoter = "Smokeshellred"; typeot = "M203Muzzle"
Check out my Camouflage Collection! New items added 31 July 2005.