Cerberus094-PL- 10 Posted April 23, 2011 Hey guys, I need help. I want to make a civilian throw a grenade at a policeman, so I have written a small script for this: man1 addWeapon "HandGrenade"; man1 addMagazine "HandGrenade"; ~1 man1 selectWeapon "HandGrenade" ~0.2 man1 doTarget police2 ~1 man1 doFire police2 But it doesn't work :confused: Does anyone has an idea how to make the civilian do it? Share this post Link to post Share on other sites
robertoHrvat 10 Posted April 23, 2011 Hi, try this: first make one EAST unit and in east soldier Initalization box write this: deletevehicle this; when done make civilian with name bomberman1, too make civilian in group with east soldier to get different side! Script: bomberman1 [color="red"]addmagazine[/color] "HandGrenade" [color="blue"]~2.74[/color] bomberman1 [color="red"]dofire[/color] policeman1 exit Share this post Link to post Share on other sites
nikiller 18 Posted April 24, 2011 (edited) hi, Hi, try this: first make one EAST unit and in east soldier Initalization box write this: deletevehicle this; when done make civilian with name bomberman1, too make civilian in group with east soldier to get different side! Script: bomberman1 [color="red"]addmagazine[/color] "HandGrenade" [color="blue"]~2.74[/color] bomberman1 [color="red"]dofire[/color] policeman1 exit It doesn't work. I was not able to force AI fire handgrenade. I tried doTarget, doFire, fire but nothing seems to work. I also tried to make the cop enemy to civil and set the cop's addRating to -5000 but I failed. I works perfectly if you give a gun to the civil but when you try with handgrenade you have no succes. So, I found solution with CombatRunThrowGrenadeStart animation and createVehicle a nade to the target position. SP/MP compatible. init.sqs ;**************************************************** ;Unit fire handgrenade Script by Nikiller v0.9b ;Make unit fire handgrenade on another unit ;Note: Place a game logic named server on the map ;contact: nikillerofp@hotmail.fr ;**************************************************** nik_dir=loadfile "dir.sqf" exit dir.sqf private [{_t}, {_nz}, {_x}, {_y}]; _t = _this select 0; _nz = _this select 1; _x=(getpos _nz select 0) - (getpos _t select 0); _y=(getpos _nz select 1) - (getpos _t select 1); _x atan2 _y civil_fire.sqs ;**************************************************** ;Unit fire handgrenade Script by Nikiller v0.9b ;Make unit fire handgrenade on another unit ;Note: Place a game logic named server on the map ;contact: nikillerofp@hotmail.fr ;[unitFireName,targetName] exec "scriptName.sqs" ;**************************************************** _ls=local server _lp=local player _c = _this select 0 _p = _this select 1 ~0.5 if (_ls) then {_c setDir ([_c,_p] call nik_dir); _c doTarget _p} if (_lp) then {_c switchMove "CombatRunThrowGrenadeStart"} ~3 if (_ls) then {boom="GrenadeHand" createVehicle (getpos _p)} #ende exit IMPORTANT: don't forget to name dir.sqf and not sqs cya. Nikiller. Edited April 24, 2011 by Nikiller Share this post Link to post Share on other sites
Cerberus094-PL- 10 Posted April 24, 2011 Thank you guys for help, but today i found out that there's a nice addon - "Gimbal Tossers", it adds civilians throwing bottles and some other things at enemy and it works without any ingerence from the missionmaker Sorry for taking your time ;) Share this post Link to post Share on other sites
ww2weasel 10 Posted April 25, 2011 I was able to get civillian to throw grenades. It doesn't work. I was not able to force AI fire handgrenade. I tried doTarget, doFire, fire but nothing seems to work. I also tried to make the cop enemy to civil and set the cop's addRating to -5000 but I failed.I works perfectly if you give a gun to the civil but when you try with handgrenade you have no succes. So, I found solution with CombatRunThrowGrenadeStart animation and createVehicle a nade to the target position. SP/MP compatible. errrrm - civilian has weapon - "Throw" - meaning you did not use removeAllWeapons man1? man1 addWeapon "HandGrenade"; man1 addMagazine "HandGrenade";~1 man1 selectWeapon "HandGrenade" ~0.2 man1 doTarget police2 ~1 man1 doFire police2 Try the below instead: man1 addMagazine "HandGrenade";man1 addMagazine "HandGrenade"; ~1 man1 doTarget police2 ~1 man1 doFire police2 Share this post Link to post Share on other sites
nikiller 18 Posted April 25, 2011 (edited) hi, I was able to get civillian to throw grenades.errrrm - civilian has weapon - "Throw" - meaning you did not use removeAllWeapons man1? Try the below instead: man1 addMagazine "HandGrenade";man1 addMagazine "HandGrenade"; ~1 man1 doTarget police2 ~1 man1 doFire police2 Yes I know that civilian have throw and put weapon by default and using removeAllWeapons doesn't change anything. Sorry maybe I'm doing something wrong but your script doesn't work for me. DEMO DOWNLOAD LINK NB: use radio alpha to activate the script. cya. Nikiller. Edited April 25, 2011 by Nikiller added demo link Share this post Link to post Share on other sites