Skul 0 Posted August 16, 2004 I've searched, but couldn't find anything. If I've missed a topic which solves this, please point me in the right direction. Thanks. Okay, I need to know how to make a script run when the player throws a hand grenade and/or when the grenade explodes. I've managed to use the fired eventhandler work for when the player fires his rifle, but not when a grenade is thrown, or explodes. I've got this in a trigger: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">player addEventHandler ["fired",{if ((_this select 1) == "AK74") then {[] exec "firedweap.sqs"}}] Which works fine. I've tried the same in another trigger: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">player addEventHandler ["fired",{if ((_this select 1) == "handgrenade") then {[] exec "firedweap.sqs"}}] Which doesn't work at all. Can grenades be detected? [Gareth Gates must die] Share this post Link to post Share on other sites
Balschoiw 0 Posted August 16, 2004 you could looped count the amount of handgrenades and if one is missing fire your desired action. I´m quite sure though that the eventhandler should work with nades also... Share this post Link to post Share on other sites
bn880 5 Posted August 16, 2004 Just sidechat _this on your fired EH, that will display all the information you need. Share this post Link to post Share on other sites
sanctuary 19 Posted August 16, 2004 I have your solution , you must not use "handgrenade" , the correct code to detect a grenade being launched by a soldier , in your situation is <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">player addEventHandler ["fired",{if ((_this select 1) == "throw") then {[] exec "firedweap.sqs"}}] When you are in doubt of what to use in this case, use ni your soldier init to know the exact name to put <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addeventhandler ["Fired",{hint format ["%1",_this select 1]}] I found this "what is the name of the fired weapon" code in the ME FAQ pinned up there , long time ago so i can't point you to the exact page. Share this post Link to post Share on other sites
Skul 0 Posted August 16, 2004 Thanks for the responses, guys! Why can't anything in OFP editing be obvious? [Gareth Gates must die] Share this post Link to post Share on other sites
bn880 5 Posted August 17, 2004 I have your solution , you must not use "handgrenade" , the correct code to detect a grenade being launched by a soldier , in your situation is<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">player addEventHandler ["fired",{if ((_this select 1) == "throw") then {[] exec "firedweap.sqs"}}] When you are in doubt of what to use in this case, use ni your soldier init to know the exact name to put <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addeventhandler ["Fired",{hint format ["%1",_this select 1]}] I found this "what is the name of the fired weapon" code in the ME FAQ pinned up there , long time ago so i can't point you to the exact page. I give directions and you give free rides, shame. Share this post Link to post Share on other sites
sanctuary 19 Posted August 17, 2004 he he . Next time i will try to make the answer available through a riddle using a mix of latin and ancient greek. Share this post Link to post Share on other sites
WindWalker 0 Posted August 25, 2004 Thanks Sanctuary. That saves us days of searching and errors trying to figure it out. One sample is worth 20,000 pages of directions written by people who fully understand the subject. Espically when all we wanted was a Rope, a Tyre and a Tree while we were were young enough to have fun on a swing. ROFLMAO Share this post Link to post Share on other sites
Stuff 0 Posted August 25, 2004 Is there also a script for adding magazines when a mag is empty? Like counting the bullets the player has fired? Share this post Link to post Share on other sites