Results 1 to 6 of 6

Thread: nearObjects for pipebomb near AI always returns null object? +++

  1. #1

    nearObjects for pipebomb near AI always returns null object? +++

    hi, anyone else had problems using nearObjects to get object reference of a satchel charge placed by AI unit?
    this was driving me barmy yesterday, today i thought to try with player instead and it works fine with this code in radio trigger:

    Code:
    bomb = ((getpos player) nearObjects ["PipeBomb",50]) select 0;hint format ["nearest bomb is: %1",bomb];
    when using this code in a script to make AI destroy an object, always returns null object:

    Code:
                hint "setting charge";
                _chargeman Fire ["pipebombmuzzle","pipebombmuzzle","pipebomb"];
                _bomb = ((getpos _chargeman) nearObjects ["PipeBomb",50]) select 0;
                hint format ["nearest bomb is: %1",_bomb];
    He definitely places a bomb as he barely escapes with his life after deciding to crawl away for the first part instead of run, even with a doMove in careless mode (i suppose that could be due to target being a RU T-72, although with no fuel or ammo)

    On that subject, tried removing the crew with this in vehicle init - seems not to work?
    Code:
    {deleteVehicle _x}forEach crew this;
    Doing it this way because I could not get AI AT to reliably attack an empty unit placed in editor, even with the 'switch sides trick' using dummy groups, so I just create a real enemy, set fuel/ammo to zero and tried removing the crew.

    Crux is that i am trying to 'teleport' the satchel a bit closer to the target than the minimum of 7m away where that AI will move to and place it. I have tried every move command available, perhaps it is just the case that next to an enemy tank is considered not a friendly place to be.
    everything else in my 'project' i have been able to solve by trying different approaches and the sweat of my brow, but i cannot for the life of me get AI to blow up a damn tank.
    AT man with max skill fires two SMAW rounds at fairly close range on a stationary tank and fails miserably to destroy it, so I really need a backup, please
    Soldiers must be cautious when throwing grenades up stairs. This is not the most desired method of employment.
    FM 3-06.11

  2. #2
    Master Gunnery Sergeant twirly's Avatar
    Join Date
    Sep 13 2010
    Location
    Gods Own (NZ)
    Posts
    1,302
    Have you tried using disableAI?

    "Learn by doing!" - Quoted from a post by Imutep

    OUTERRA - OUTERRA - OUTERRA - OUTERRA - BLOWMIND!

  3. #3
    Lance Corporal Ashram 1-1's Avatar
    Join Date
    Jul 21 2009
    Location
    Leuven
    Posts
    42
    Author of the Thread
    thanks for reply, yes i tried a few combinations of that but perhaps not the right one, i'm away for a few days now so will come back to this thread on my return, perhaps i will think of something on the break.
    cheers, Sam

  4. #4
    Code:
    unitName addeventhandler ["fired",{
    		_unit = _this select 0;
    		_ammo = _this select 4;
    		if (_ammo == "PipeBomb") then {
    			_bomb = nearestobject [_unit,"PipeBomb"];
    			_bomb spawn {
    				_bomb = _this;
                                    if (_bomb distance tank > 7) then {
                                          
                                                 // do something
                                    };
    			};
    		};
    	}];

    However as twirly suggested, this code may become redundant by using disableAI "FSM".
    empty all your clips at their locations

    Vote!
    http://feedback.arma3.com/view.php?id=9341 - Random placement of units and waypoints does not work near buildings
    http://feedback.arma3.com/view.php?id=17665 - Backpacks can't be placed accurately in editor
    http://feedback.arma3.com/view.php?id=15249 - Add scripting command to disable certain stances

  5. #5
    Not sure if this is going to help. Probably add it to the event handler given by 2nd Ranger

    Try the attachto command - tried the below and it works.

    I tested your code - using OA. Returns PipeBomb when specifying class - and Satchel.p3d when listing nearest objects.


    Code:
     private ["_class"];
    
    _list = nearestObjects [dave, ["Car", "Truck", "Tank"], 20];
    _num =  _list select 0;
    _name = str(_num);
    
    _class = typeOf _num;
    
    //dave Fire ["pipebombmuzzle", "pipebombmuzzle", "pipebomb"];
    
    sleep 3;
    
    _list1 = ((getpos dave) nearObjects ["PipeBomb",50]) select 0;  
    _class1 = typeOf _list1;
    hint format["%1",_class1]; 
    
    
    _list1 attachTo [_num,[0,0,0]];
    [FOCK] Mikie J -
    Giving bad advice since 2009

    Looking for New Players/scripters at Fockersteam
    http://fockers.moonfruit.com/
    Email:

    A3
    3 Chapters of Scripting Tutotials -http://www.armaholic.com/page.php?id=20465#comments MORE TO FOLLOW
    TvTCache Hunt - [FOCK]ers Cache Hunt TvT-x [ALPHA]
    Fock Recruit/Group Management - http://www.armaholic.com/page.php?id=19041

    Currently NOT ACTIVE- Awaiting completion of MSc Computer Science - will return soon....

  6. #6
    Lance Corporal Ashram 1-1's Avatar
    Join Date
    Jul 21 2009
    Location
    Leuven
    Posts
    42
    Author of the Thread
    thanks all for the help, i'll try this out soon. unfortunately my motherboard is dead and i'm back on the old PC while i do a return, i might actually get my coursework done with no Arma on this machine. :-)
    cheers, Sam

Similar Threads

  1. Object Null Help
    By blanic in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 3
    Last Post: Nov 8 2011, 04:28
  2. Help-Object Null Variable Troubles
    By GeneralCarver in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 2
    Last Post: Jan 24 2010, 18:04
  3. Nearobjects and trees + bushes
    By fabrizio_T in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 6
    Last Post: Oct 23 2009, 11:51
  4. How to test for <null-object>?
    By KeyCat in forum OFP : MISSION EDITING & SCRIPTING
    Replies: 2
    Last Post: Apr 23 2003, 04:42
  5. Null object testing
    By quantum69 in forum OFP : MISSION EDITING & SCRIPTING
    Replies: 2
    Last Post: Mar 7 2003, 06:04

Posting Permissions

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