Results 1 to 9 of 9

  Click here to go to the first Developer post in this thread.  

Thread: "Fired" eventhandler for hand grenades

  1. #1
    First Sergeant
    Join Date
    Jan 16 2003
    Location
    United Kingdom
    Posts
    894
    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 &#91;&#34;fired&#34;,{if &#40;&#40;_this select 1&#41; == &#34;AK74&#34;&#41; then {&#91;&#93; exec &#34;firedweap.sqs&#34;}}&#93;[/QUOTE]
    Which works fine.

    I&#39;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 &#91;&#34;fired&#34;,{if &#40;&#40;_this select 1&#41; == &#34;handgrenade&#34;&#41; then {&#91;&#93; exec &#34;firedweap.sqs&#34;}}&#93;[/QUOTE]
    Which doesn&#39;t work at all. Can grenades be detected?

    [Gareth Gates must die]
    Skul\'s OFP Forum | Visit Crap Studios.com! | Teh crap MuD Forums
    Teh crap MuD needs people! Contact me if you would like to join!
    The Invasion of the n00bs is finished!

  2. #2
    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...

  3.   Click here to go to the next Developer post in this thread.   #3
    Just sidechat _this on your fired EH, that will display all the information you need.
    "Peace can not be kept by force. It can only be achieved by understanding." Albert Einstein

    Please report Arma 3 bugs in the Bug Tracker

  4. #4
    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 &#91;&#34;fired&#34;,{if &#40;&#40;_this select 1&#41; == &#34;throw&#34;&#41; then {&#91;&#93; exec &#34;firedweap.sqs&#34;}}&#93;[/QUOTE]

    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 &#91;&#34;Fired&#34;,{hint format &#91;&#34;%1&#34;,_this select 1&#93;}&#93; [/QUOTE]

    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&#39;t point you to the exact page.




  5. #5
    First Sergeant
    Join Date
    Jan 16 2003
    Location
    United Kingdom
    Posts
    894
    Author of the Thread

    Smile

    Thanks for the responses, guys&#33;

    Why can&#39;t anything in OFP editing be obvious?

    [Gareth Gates must die]

  6.   This is the last Developer post in this thread.   #6
    Quote Originally Posted by (Sanctuary @ Aug. 16 2004,14:16)
    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 &#91;&#34;fired&#34;,{if &#40;&#40;_this select 1&#41; == &#34;throw&#34;&#41; then {&#91;&#93; exec &#34;firedweap.sqs&#34;}}&#93;
    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 &#91;&#34;Fired&#34;,{hint format &#91;&#34;%1&#34;,_this select 1&#93;}&#93; [/QUOTE]

    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&#39;t point you to the exact page.[/QUOTE]
    I give directions and you give free rides, shame.


  7. #7
    he he .
    Next time i will try to make the answer available through a riddle using a mix of latin and ancient greek.

  8. #8
    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
    The Past is like dust the more you stir arround in it the harder it will be to see where youre going.

  9. #9
    Is there also a script for adding magazines when a mag is empty? Like counting the bullets the player has fired?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •