Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: Getting possition of smoke grenade

  1. #1

    Getting possition of smoke grenade

    Well, simple question, I'm guessing not so simple answer. I want to enable the player to determine where a helo will land for extraction by throwing a smoke grenade and then the helo will land on or near its possition.

    Is this possible and if it is, can someone let me know the code/script I'll need to write to do it?

    Thanks.

  2. #2
    Short form pseudo code:


    -Event Handler fired
    -Figure out what type of object was fired
    if(smokegrenade) then getPos _this select X

    Then you got it! questions? Ask!

  3. #3
    You could use fired -eventhandler. Another way, if the extraction place is defined, to use nearobjects.

  4. #4
    Sergeant
    Join Date
    Apr 28 2010
    Location
    Norwich
    Posts
    138
    Author of the Thread
    Right... erm, I've never used event handlers before. Care to give me a step by step guide?

  5. #5
    Gonna write you an example when I got my arma running again.That's in about 2 hours.

  6. #6
    Place the following to your init.sqf for example:
    PHP Code:
    TAG_fired =
    {
         
    _unit _this select 0//The unit that fired the weapon
         
    _wpn _this select 1//The weapon that was fired
         
    _muzzle _this select 2//The muzzle of the weapon that fired
         
    _ammo _this select 4//The ammunition type (classname) of the fired projectile

         
    if (_wpn == "Throw" && _muzzle == "SmokeShellMuzzle"then //A smoke grenade was thrown
         
    {
              
    _smoke = (getPos _unitnearestObject _ammo//Get the object
              
    if (!isNull _smokethen //Make sure the above didn't fail
              
    {
                   
    hint format ["The smoke grenade is: %1"_smoke];
                   
    //Some addition handling, do not forget to spawn/execVM if you want to use sleep/waitUntil!
              
    };
         };
    };
    unit addEventHandler ["fired", {_this call TAG_fired}]; 
    Last edited by Deadfast; Nov 6 2010 at 09:52.

  7. #7
    Sergeant
    Join Date
    Apr 28 2010
    Location
    Norwich
    Posts
    138
    Author of the Thread
    Thanks mate! I'll give it a go.

  8. #8
    Doesn't it work with move an invisible H to the smoke?

  9. #9
    Perhaps I'm out of date, but I thought a thrown grenade didn't generate a fired EH?
    Documentation is not a dirty word.
    : TeamSPAFF : PRACS : RKSL : Stella Artois : Creme Eggs : GITS :

  10. #10
    Sergeant
    Join Date
    Apr 28 2010
    Location
    Norwich
    Posts
    138
    Author of the Thread
    Yeah, I'm not sure what I did wrong but the code didn't work.

    Any other hints?

Page 1 of 3 123 LastLast

Posting Permissions

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