Jump to content
Sign in to follow this  
dr death jm

MissionevEventHandler im messing with , issue with modelToWorld

Recommended Posts

addMissionEventHandler [ "EntityKilled", {
    params [ "_killed", "_killer" ];
    _target = cursorTarget;
_body = [];
    if ( typeOf _killed isKindOf "Man") then { 
       
        _killed addAction ["<img image='\a3\ui_f\data\gui\cfg\debriefing\enddeath_ca.paa' align='center' size='1.2'/>{Bury The Dead}</t>",{params ["_target", "_caller"];
     hideBody _target;
deleteVehicle _target;


        _caller playActionNow "MedicOther";},nil,0.1,true,true,"","(_target distance _this) < 2"];};
_body = _killed getRelPos [-0.01, 0];
_dead = createSimpleObject ["a3\structures_f_epb\civ\dead\grave_rocks_f.p3d",_body]; 
_dead setPos (_body vectorAdd (getPosWorld _dead vectorDiff (_dead modelToWorld [0,0,0])));}];

the issue is the grave is always 10 meters up in the air,

what id like to do / or have is the grave on the ground but also not show up unless player does the action code to hide the body..

thanks... 

Share this post


Link to post
Share on other sites

This is something with that object, using diferent objects works fine.

You can do a small fix like this:

addMissionEventHandler [ "EntityKilled", {

    params [ "_killed", "_killer" ];

	
    if ( _killed isKindOf "Man") then { 
       
        _killed addAction ["<img image='\a3\ui_f\data\gui\cfg\debriefing\enddeath_ca.paa' align='center' size='1.2'/>{Bury The Dead}</t>",{
		
				params ["_target", "_caller"];
				
				private _body = _target getRelPos [-0.01, 0];

				hideBody _target;
				deleteVehicle _target;
				_caller playActionNow "MedicOther";
				private _dead = createSimpleObject ["a3\structures_f_epb\civ\dead\grave_rocks_f.p3d",_body]; 
				_dead setPos (_body vectorAdd (getPosWorld _dead vectorDiff (_dead modelToWorld [0,0,0])));
				_dead setPos [(getPos _dead) select 0, (getpos _dead) select 1, 0.5];
	
		},nil,0.1,true,true,"","(_target distance _this) < 2"];
	};
}];

Even here you need to define z as 0.5, using 0  spawns underground.

  • Like 1

Share this post


Link to post
Share on other sites

wow, nice.. thanks davidoss..

i have this other script i use for dead, leave a spinning skull, wasn't as hard as this to figure out, but i wanted to test out the createSimpleObject, mainly because some object errors i get in rpt are p3d. 

Share this post


Link to post
Share on other sites

The best way to get this right is use bis_fnc_createSimpleObject like in this example:


_objwalls = [ /*created object*/
    [
    "Land_Canal_Wall_10m_F",  /*config classname*/
    "A3\Structures_F\Walls\Canal_Wall_10m_F.p3d",   /*path to p3d file*/
    0,   /*0: no change, 1: reverse*/
    0,   /*vertical offset, default 0*/
    [],  /*animations array, default: []*/
    []   /*selections To Hide, default: [] */
     ],
    [16198.7,15722.5,6.37954],//posASL
    118.783,//dir
    true //align to ground

    ] call bis_fnc_createSimpleObject;

To get correct data from config use this:

_data = ["Land_Canal_Wall_10m_F"] call BIS_fnc_simpleObjectData;
//["Land_Canal_Wall_10m_F","A3\Structures_F\Walls\Canal_Wall_10m_F.p3d",0,0,[],[]]
  • Like 1

Share this post


Link to post
Share on other sites

ok , so is it better to use object from editor or from script? i heard it something like spawning a object say like a car , somewhere else on map, like [0,0,0]  then to were ever you want it.

 

and thanks for above info.. 

Share this post


Link to post
Share on other sites

Why from editor?

In your case i would set this like this:

 addMissionEventHandler [ "EntityKilled", {

    params [ "_killed", "_killer" ];

    
    if ( _killed isKindOf "Man") then {
       
        _killed addAction ["<img image='\a3\ui_f\data\gui\cfg\debriefing\enddeath_ca.paa' align='center' size='1.2'/>{Bury The Dead}</t>",{
        
                params ["_target", "_caller"];
                
                private _position =  getPosASL _target;
                private _direction = _target getRelDir _caller;
                hideBody _target;
                deleteVehicle _target;
                _caller playActionNow "MedicOther";
                private _data = ["Land_Grave_rocks_F"] call BIS_fnc_simpleObjectData;
                private _grave = [_data, _position, _direction,true ] call bis_fnc_createSimpleObject;
               //object stored in _grave variable if not needed use null =
    
        },nil,0.1,true,true,"","(_target distance _this) < 2"];
    };
}];

Share this post


Link to post
Share on other sites

i should of said new topic, lol.. the code post #2 awesome, im going to try post #6.

 

what i was trying to say was base units and vehicles ... when player originally spawns into game  and or vehicles .

i was told i should have them spawn to [0,0,0]; then to base (marker). and same with repawning?

maybe today ill post up a vid of what im working on for a while , .. it all started with ice's digital load out .. and me still being ignorant to scripting

its taken awhile (mostly do to rpt errors i dont understand), blah blah blah .. coffee kicking in....

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×