Jump to content
Sign in to follow this  
clock_x

setWaypointStatements and Local Variable

Recommended Posts

Hey,

 

I am trying to get this script from Igneous01 to work for my mission:

 

Quote

 

_dragger = _this select 0;
_injured = _this select 1;
_dummy = _this select 2;

 

_dragger playAction "grabDrag";
_injured playMove "AinjPpneMstpSnonWrflDb";    
Sleep (0.01);

waitUntil { ((AnimationState _dragger) == "AmovPercMstpSlowWrflDnon_AcinPknlMwlkSlowWrflDb_2") || ((AnimationState _dragger) == "AmovPercMstpSnonWnonDnon_AcinPknlMwlkSnonWnonDb_2")};

_injured attachTo [_dragger, [0, 1.2, 0]]; // attach injured
_injured setDir 180; // set injured to turn his back on dragger

 

_DummyClone = {
private ["_dummy", "_dummygrp", "_dragger"];
_dragger = _this;
// create Dummy unit that dragger attaches to, dummy unit moves and simulates dragger moving
_dummygrp = createGroup EAST;
_dummy = _dummygrp createUnit ["RU_soldier", Position _dragger, [], 0, "FORM"];
_dummy setUnitRank "COLONEL";
_dummy setUnitPos "up";
_dummy hideobject true;
_dummy allowdammage false;
_dummy setBehaviour "CARELESS";
_dummy disableAI "FSM";
       _dummy forceSpeed 1.5;
_dragger attachTo [_dummy, [0, -0.2, 0]];
_dragger setDir 180;
// return dummy object
_dummy
};

 

_dummy = _dragger call _DummyClone;

_dragger playMove "AcinPknlMwlkSrasWrflDb"; _dragger disableAI "ANIM";


_waypointDrag = (group _dummy) addWaypoint [getMarkerPos "MarkerOne", 0];

 

 

Now I wanted to do this, which obviously didn't work:

 

Quote

_waypointDrag setWaypointStatements ["true", "_dragger playMoveNow "";  _dragger enableAI "ANIM";"];

 

I googled alot and tried this:

 

Quote

call compile format ["_waypointDrag setWaypointStatements ["true", "%1 playMoveNow "";  %1 enableAI "ANIM"'"]", _dragger];

 

Which didn't work either..

 

I also tried idiotic stuff like grouping the _dragger with the _dummy and then executing it on the whole group but this messed up the waypoint completely and the _dummy wouldn't move at all.

 

Does anyone have an idea how I can get this to work?

Help would be much appreciated.

I only want the _dragger to drag the _injured near an extraction chopper and then stop the animations.

Next step would be healing the injured or even better loading him in the extraction chopper while he is still unconsious, but I did not get this far.

 

Cheers

clockx

Share this post


Link to post
Share on other sites

I think it's done like this

_waypointDrag setWaypointStatements ["true", format ["%1 playMoveNow ' ' ; %1 enableAI 'ANIM'  ",_dragger ] ];

 

Share this post


Link to post
Share on other sites

Thanks for the answer.

 

Strangely it doesn't work. When I put a hint in it it gives me the correct name for %1 so it should work.

 

I tested this with a named unit:

Quote

_waypointDrag setWaypointStatements ["true", "dragger playMoveNow "AmovPercMstpSlowWrflDnon" ;"];

 

And it doesn't even work ...

It seems I simply can't execute an animation in a trigger statement.

 

Can anyone think of a workaround?

Share this post


Link to post
Share on other sites

Locality in multiplayer maybe?  Waypoints are a group function, but I seem to recall a problem I had to overcome some months ago where waypoint condition was detected on all but waypoint expression ran only on the machine where the leader was local.

Share this post


Link to post
Share on other sites

Well I'm making a SP mission and I have no clue about MP scripting/mission making ... so it shouldn't be a problem, right?

Share this post


Link to post
Share on other sites

True that.  All are local in single player.

 

Other suggestions:

If not already doing so, use launch param -showScriptErrors so that errors appear on screen when they occur.

If doing so, don't use launch param -noLogs so that detected errors get logged in the .rpt report.

Maybe it's a matter of using quotes instead of semiquotes.  When data type is a string, any strings within it should be using semiquotes, i.e.: "dragger playMoveNow 'AmovPercMstpSlowWrflDnon' ;"

Maybe enableAI "ANIM" needs to be done before playMoveNow "", I.e. move won't play while animation is disabled.

Share this post


Link to post
Share on other sites

Daamn, semiquotes did the trick.

Thanks so much.

-showScriptErrors showed it too.

After 4 years of editing and scripting I am still a full blown noob it seems.

 

Now I only need to polish it incase he dies and the loading in chopper stuff.

If I get any more problems I will come back here! :satisfied:

Thanks again.

Here is the working thing for everyone interested, and of course thanks to Igneous01 for the script.

I added what happens in case the injured dies or the dragger dies.
 

Quote

//// nul = [_dragger, _injured] execVM "drag_wounded.sqf"

_dragger = _this select 0;
_injured = _this select 1;
_dummy = _this select 2;


_dragger playAction "grabDrag";
_injured playMove "AinjPpneMstpSnonWrflDb";    
Sleep (0.01);

waitUntil { ((AnimationState _dragger) == "AmovPercMstpSlowWrflDnon_AcinPknlMwlkSlowWrflDb_2") || ((AnimationState _dragger) == "AmovPercMstpSnonWnonDnon_AcinPknlMwlkSnonWnonDb_2")};

_injured attachTo [_dragger, [0, 1.2, 0]]; // attach injured
_injured setDir 180; // set injured to turn his back on dragger

_DummyClone = {
private ["_dummy", "_dummygrp", "_dragger"];
_dragger = _this;
// create Dummy unit that dragger attaches to, dummy unit moves and simulates dragger moving
_dummygrp = createGroup EAST;
_dummy = _dummygrp createUnit ["RU_soldier", Position _dragger, [], 0, "FORM"];
_dummy setUnitPos "up";
_dummy hideobject true;
_dummy allowdammage false;
_dummy setBehaviour "CARELESS";
_dummy disableAI "FSM";
       _dummy forceSpeed 1.5;
_dragger attachTo [_dummy, [0, -0.2, 0]];
_dragger setDir 180;
// return dummy object
_dummy
};

_dummy = _dragger call _DummyClone;

_dragger playMove "AcinPknlMwlkSrasWrflDb"; _dragger disableAI "ANIM";


 

                       while { alive _dragger && alive _injured } do {
                       
_waypointDrag = (group _dummy) addWaypoint [getMarkerPos "MarkerOne", 0];
_waypointDrag setWaypointStatements ["true", format [
                                                        " %1 enableAI 'ANIM';
                                                          %1 playMoveNow 'AmovPercMstpSlowWrflDnon';
                                                          %2 playMoveNow 'AinjPpneMstpSnonWrflDb_release';
                                                          detach %2; deleteVehicle this;
                                                          if !(alive %2) then { %2 switchMove 'AinjPpneMstpSnonWrflDb_release'; };
                                                         ", _dragger, _injured, _dummy ] ];

                                                  };
                                                  
                        if !(alive _dragger) then {
                        
                            deleteVehicle _dummy; detach _injured;
                            
                            if ((AnimationState _injured) == "AinjPpneMstpSnonWrflDb") then { _injured switchMove "AinjPpneMstpSnonWrflDb_release"; };


        
                                                   };

 

Share this post


Link to post
Share on other sites

Soo I got a new problem.  I am now trying to trigger this script.

I have a script running which checks every x seconds if one of two specific persons is unconsious:

Spoiler

 

//[_unit1, _unit2] execVM "scripts\if_uncon.sqf";
_unit1 = _this select 0;
_unit2 = _this select 1;


while {(alive _unit1)} do {

sleep 4;

if (_unit1 call ace_sys_wounds_fnc_isUncon) then {

                            if (mein_debug>0) then {
                                    player globalChat format ["%1 unconscious", _unit1]
                                        };


                                                        if (_unit1 == aziz1) then { uncTrue = true;};

                                    

                          } else {

                            if (mein_debug>0) then {
                                    player globalChat format ["%1 not unconscious", _unit1]
                                        };

                                                };

                          if (uncTrue) exitWith {nul = [_unit1] execVM "drag\drag_wounded.sqf"};

               };

while {(alive _unit2)} do {

sleep 4;

if (_unit2 call ace_sys_wounds_fnc_isUncon) then {

                            if (mein_debug>0) then {
                                    player globalChat format ["%1 unconscious", _unit2]
                                        };

                                                        if (_unit2 == aziz2) then { uncTrue = true;};


                          } else {

 

                                                };

                          if (uncTrue) exitWith {nul = [_unit2] execVM "drag\drag_wounded.sqf"};

               };

 

And it executes the drag_wounded with: nul = [_unit2] execVM "drag\drag_wounded.sqf" when the unit is unconsious.

Now I need one of the nearby units to come and drag the unit.

So I did this in the drag_wounded.sqf:

Spoiler

 

_injured = _this select 0;
_draggers = _this select 1;
_dragger = _this select 2;
_dummy = _this select 3;

 

while { alive _injured } do
{
sleep 1;
_draggers = nearestObjects [vehicle _injured, ["Man"], 10];

 if (count _draggers > 1) then
   {
       {
            if ((alive _x) AND (_x != vehicle _injured)) then
            {


                    _x move getpos _injured; _dragger = _x;

                

                       if (mein_debug>0) then {  
                player globalChat format ["drag_wounded.sqf - dragger:%1", _dragger]; // is returning the correct unit
                                              };
            };
        };                   

    } forEach _draggers;
    ///// works until here
    hint format["dragger: %1", _dragger]; // is returning 'ANY'


sleep 5;

if ((alive _dragger) AND (_dragger distance _injured < 10)) then {

 

_dragger playAction "grabDrag";
_injured playMove "AinjPpneMstpSnonWrflDb";    
Sleep (0.01);

waitUntil { ((AnimationState _dragger) == "AmovPercMstpSlowWrflDnon_AcinPknlMwlkSlowWrflDb_2") || ((AnimationState _dragger) == "AmovPercMstpSnonWnonDnon_AcinPknlMwlkSnonWnonDb_2")};

_injured attachTo [_dragger, [0, 1.2, 0]]; // attach injured
_injured setDir 180; // set injured to turn his back on dragger

_DummyClone = {
private ["_dummy", "_dummygrp", "_dragger"];
_dragger = _this;
// create Dummy unit that dragger attaches to, dummy unit moves and simulates dragger moving
_dummygrp = createGroup EAST;
_dummy = _dummygrp createUnit ["RU_soldier", Position _dragger, [], 0, "FORM"];
_dummy setUnitPos "up";
_dummy hideobject true;
_dummy allowdammage false;
_dummy setBehaviour "CARELESS";
_dummy disableAI "FSM";
       _dummy forceSpeed 1.5;
_dragger attachTo [_dummy, [0, -0.2, 0]];
_dragger setDir 180;
// return dummy object
_dummy
};

_dummy = _dragger call _DummyClone;

_dragger playMove "AcinPknlMwlkSrasWrflDb"; _dragger disableAI "ANIM";


if (mein_debug>0) then {  
                player globalChat format ["drag_wounded.sqf - dragger:%1 injured:%2 dummy:%3", _dragger, _injured, _dummy];
                       };

                       while { alive _dragger && alive _injured } do {
                       
_waypointDrag = (group _dummy) addWaypoint [getMarkerPos "MarkerOne", 0];
_waypointDrag setWaypointStatements ["true", format [
                                                        " %1 enableAI 'ANIM';
                                                          %1 playMoveNow 'AmovPercMstpSlowWrflDnon';
                                                          %2 playMoveNow 'AinjPpneMstpSnonWrflDb_release';
                                                          detach %2; deleteVehicle this;
                                                          if !(alive %2) then { %2 switchMove 'AinjPpneMstpSnonWrflDb_release'; };
                                                         ", _dragger, _injured, _dummy ] ];

                                                  };
                                                  
                        if !(alive _dragger) then {
                        
                            deleteVehicle _dummy; detach _injured;
                            
                            if ((AnimationState _injured) == "AinjPpneMstpSnonWrflDb") then { _injured switchMove "AinjPpneMstpSnonWrflDb_release"; };


        
                                                   };
                                                    };

 };

 

 

The first part works, the dragger moves to the injured unit and the debug text returns the correct unit as _dragger.

But now when I want to fire the rest of the script the variable '_dragger' gets undefined again and nothing happens.

Why is that?

 

Edit:

I'm confused, out of the sudden it works ... but without the _injured animation.

Edit²:

So this is how far I've got so far:
if_uncon.sqf

Spoiler

//[_unit1, _unit2] execVM "scripts\if_uncon.sqf";


_unit1 = _this select 0;
_unit2 = _this select 1;

if (mein_debug>0) then {
    player globalChat format ["if_uncon.sqf - _unit1: %1 - _unit2: %2", _unit1, _unit2];
                       };


while {(alive _unit1)} do {

sleep 4;

if (_unit1 call ace_sys_wounds_fnc_isUncon) then {

                            if (mein_debug>0) then {
                                    player globalChat format ["%1 unconscious", _unit1]
                                        };


                                                        if (_unit1 == aziz1) then { uncTrue = true;};

                                    

                          } else {

                            if (mein_debug>0) then {
                                    player globalChat format ["%1 not unconscious", _unit1]
                                        };

                                                };

                          if (uncTrue) exitWith {nul = [_unit1] execVM "drag\drag_wounded.sqf"};

               };

while {(alive _unit2)} do {

sleep 4;

if (_unit2 call ace_sys_wounds_fnc_isUncon) then {

                            if (mein_debug>0) then {
                                    player globalChat format ["%1 unconscious", _unit2]
                                        };

                                                        if (_unit2 == aziz2) then { uncTrue = true;};


                          } else {

                            if (mein_debug>0) then {
                                    player globalChat format ["%1 not unconscious", _unit2]
                                        };

                                                };

                          if (uncTrue) exitWith {nul = [_unit2] execVM "drag\drag_wounded.sqf"};

               };

 

drag_wounded.sqf

Spoiler

 

_injured = _this select 0;
_draggers = _this select 1;
_dragger = _this select 2;
_dummy = _this select 3;

if (mein_debug>0) then {  
                player globalChat format ["drag_wounded.sqf - injured:%1", _injured];
                       };

while { alive _injured } do
{
sleep 1;
_draggers = nearestObjects [vehicle _injured, ["Man"], 10];

 if (count _draggers > 1) then
   {
       {
            if ((alive _x) AND (_x != vehicle _injured)) then
            {


                    _x move getpos _injured; _dragger = _x;

                

                       if (mein_debug>0) then {  
                player globalChat format ["drag_wounded.sqf - dragger:%1", _dragger];
                                              };
            };
        };                   

    } forEach _draggers;
    

    hint format["dragger: %1", _dragger];


sleep 4;

if ((alive _dragger) AND (_dragger distance _injured < 5)) then {

                       if (mein_debug>0) then {  
                player globalChat format ["drag_wounded.sqf - start dragging dragger:%1", _dragger];
                                              };


_dragger playAction "grabDrag";
sleep 2.5;
_injured switchMove "AinjPpneMstpSnonWrflDb";    
Sleep (0.01);

waitUntil { ((AnimationState _dragger) == "AmovPercMstpSlowWrflDnon_AcinPknlMwlkSlowWrflDb_2") || ((AnimationState _dragger) == "AmovPercMstpSnonWnonDnon_AcinPknlMwlkSnonWnonDb_2")};

_injured attachTo [_dragger, [0, 1.2, 0]]; // attach injured
_injured setDir 180; // set injured to turn his back on dragger

_DummyClone = {
private ["_dummy", "_dummygrp", "_dragger"];
_dragger = _this;
// create Dummy unit that dragger attaches to, dummy unit moves and simulates dragger moving
_dummygrp = createGroup EAST;
_dummy = _dummygrp createUnit ["RU_soldier", Position _dragger, [], 0, "FORM"];
_dummy setUnitPos "up";
_dummy hideobject true;
_dummy allowdammage false;
_dummy setBehaviour "CARELESS";
_dummy disableAI "FSM";
       _dummy forceSpeed 1.5;
_dragger attachTo [_dummy, [0, -0.2, 0]];
_dragger setDir 180;
// return dummy object
_dummy
};

_dummy = _dragger call _DummyClone;

_dragger playMove "AcinPknlMwlkSrasWrflDb"; _dragger disableAI "ANIM";


if (mein_debug>0) then {  
                player globalChat format ["drag_wounded.sqf - dragger:%1 injured:%2 dummy:%3", _dragger, _injured, _dummy];
                       };

                       while { alive _dragger && alive _injured } do {
                       
_waypointDrag = (group _dummy) addWaypoint [getMarkerPos "MarkerOne", 0];
_waypointDrag setWaypointStatements ["true", format [
                                                        " %1 enableAI 'ANIM';
                                                          %1 playMove 'AmovPercMstpSlowWrflDnon';
                                                          %2 switchMove 'AinjPpneMstpSnonWrflDb_release';
                                                          detach %2; deleteVehicle this;
                                                          if !(alive %2) then { %2 switchMove 'AinjPpneMstpSnonWrflDb_release'; };
                                                         ", _dragger, _injured, _dummy ] ];

                                                  };
                                                  
                        if !(alive _dragger) then {
                        
                            deleteVehicle _dummy; detach _injured;
                            
                            if (((AnimationState _injured) == "AinjPpneMstpSnonWrflDb") OR ((AnimationState _injured) == "ADTHPPNEMSTPSNONWRFLDBB_Dragged")) then { _injured switchMove "AinjPpneMstpSnonWrflDb_release"; };


        
                                                   };
                                                    };

 };

 

It works, but it is far from perfect.

Would be really nice if someone could have a look over it to change minor errors and make it smoother.

I'm not really good at this kind of stuff.

Thanks in advance.

 

Edit:
I implemented it in my mission and I must admit it does not perform very well, which is because there is already too much going on I guess.

Sometimes the AI just crowd around the injured and nothing really happens.

Other times someone grabs the injured but the dummy won't spawn and nothing more happens.

And sometimes the injured does get dragged to his destination but always refuses to continue his waypoints to board the extraction chopper after he wakes up.

Most of the times when it does work, the dragger gets teleported back to his initial position after he gets detached, which has not happened in my test mission.

Strange things happening!

So I guess I will not use it for this one.

Share this post


Link to post
Share on other sites

Not tested, just cleaned and tuned up somewhat.  Hope it helps you fine tune into a working state.

 

if_uncon.sqf

Spoiler

//[_unit1, _unit2] execVM "scripts\if_uncon.sqf"; 
_unit1 = _this select 0;
_unit2 = _this select 1;

if (mein_debug>0) then {player globalChat format ["if_uncon.sqf - _unit1: %1 - _unit2: %2", _unit1, _unit2];};

_niv = _unit1 spawn 
{
	_unit1 = _this;

	while {(alive _unit1)} do 
	{
		sleep 4;

		if (_unit1 call ace_sys_wounds_fnc_isUncon) then 
		{
			if (mein_debug>0) then {player globalChat format ["%1 unconscious", _unit1]};

			if (_unit1 == aziz1) then {uncTrue = true;};
		} else 
		{
			if (mein_debug>0) then {player globalChat format ["%1 not unconscious", _unit1]};
		};

		if (uncTrue) exitWith {nul = [_unit1] execVM "drag\drag_wounded.sqf"};
	};
};

_niv = _unit2 spawn 
{
	_unit2 = _this;

	while {(alive _unit2)} do 
	{
		sleep 4;

		if (_unit2 call ace_sys_wounds_fnc_isUncon) then 
		{
			if (mein_debug>0) then {player globalChat format ["%1 unconscious", _unit2]};

			if (_unit2 == aziz2) then {uncTrue = true;};
		} else 
		{
			if (mein_debug>0) then {player globalChat format ["%1 not unconscious", _unit2]};
		};

		if (uncTrue) exitWith {nul = [_unit2] execVM "drag\drag_wounded.sqf"};
	}; 
};

 

 

drag_wounded.sqf

Spoiler

_injured = _this select 0;
_draggers = [];
_dragger = objNull;
_dummy = objNull;

if (mein_debug>0) then {player globalChat format ["drag_wounded.sqf - injured:%1", _injured];};

while {alive _injured && isNull _dragger} do 
{
	sleep 1;
	_draggers = nearestObjects [vehicle _injured,["Man"],10];

	if (count _draggers > 1) then 
	{
		{
			if ((alive _x) AND (_x != vehicle _injured)) then 
			{
				_x move getpos _injured;
				_dragger = _x;

				if (mein_debug>0) then {player globalChat format ["drag_wounded.sqf - dragger:%1", _dragger];};
			};
		} forEach _draggers;

		hint format["dragger: %1", _dragger];
	};
};

if (isNull _dragger) exitWith {if (mein_debug>0) then {player globalChat "drag_wounded.sqf - injured died";};};

waitUntil {Sleep 1; !Alive _dragger || _dragger distance _injured < 5};

if !(Alive _dragger) exitWith 
{
	if (mein_debug>0) then {player globalChat "drag_wounded.sqf - dragger died";};
	nul = [_injured] execVM "drag\drag_wounded.sqf";
};

if (mein_debug>0) then {player globalChat format ["drag_wounded.sqf - start dragging dragger:%1", _dragger];};

_dragger playAction "grabDrag";
sleep 2.5;
_injured switchMove "AinjPpneMstpSnonWrflDb";
Sleep 0.01;

waitUntil {!Alive _dragger || AnimationState _dragger == "AmovPercMstpSlowWrflDnon_AcinPknlMwlkSlowWrflDb_2" || AnimationState _dragger == "AmovPercMstpSnonWnonDnon_AcinPknlMwlkSnonWnonDb_2"};

if !(Alive _dragger) exitWith 
{
	if (mein_debug>0) then {player globalChat "drag_wounded.sqf - dragger died";};
	nul = [_injured] execVM "drag\drag_wounded.sqf";
};

_injured attachTo [_dragger, [0, 1.2, 0]]; // attach injured
_injured setDir 180; // set injured to turn his back on dragger

_DummyClone = 
{
	private ["_dummy", "_dummygrp", "_dragger"];
	_dragger = _this;

	// create Dummy unit that dragger attaches to, dummy unit moves and simulates dragger moving
	_dummygrp = createGroup EAST;
	_dummy = _dummygrp createUnit ["RU_soldier", Position _dragger, [], 0, "FORM"];
	_dummy setUnitPos "up";
	_dummy hideobject true;
	_dummy allowdammage false;
	_dummy setBehaviour "CARELESS";
	_dummy disableAI "FSM";
	_dummy forceSpeed 1.5;
	_dragger attachTo [_dummy, [0, -0.2, 0]];
	_dragger setDir 180;

	// return dummy object
	_dummy
};

_dummy = _dragger call _DummyClone;

_dragger playMove "AcinPknlMwlkSrasWrflDb";
_dragger disableAI "ANIM";

if (mein_debug>0) then {player globalChat format ["drag_wounded.sqf - dragger:%1 injured:%2 dummy:%3", _dragger, _injured, _dummy];};

_waypointDrag = (group _dummy) addWaypoint [getMarkerPos "MarkerOne", 0];
_waypointDrag setWaypointStatements ["true", format [
	"%1 enableAI 'ANIM';
	%1 playMove 'AmovPercMstpSlowWrflDnon';
	%2 switchMove 'AinjPpneMstpSnonWrflDb_release';
	detach %2;
	deleteVehicle this;
	if !(alive %2) then {%2 switchMove 'AinjPpneMstpSnonWrflDb_release';};
	", _dragger, _injured, _dummy]
];

if !(alive _dragger) then 
{
	deleteVehicle _dummy;
	detach _injured;
	if (((AnimationState _injured) == "AinjPpneMstpSnonWrflDb") OR ((AnimationState _injured) == "ADTHPPNEMSTPSNONWRFLDBB_Dragged")) then {_injured switchMove "AinjPpneMstpSnonWrflDb_release";};
};

 

 

Share this post


Link to post
Share on other sites

I tested it just now, in my test mission and strangely with your polished version the same thing is happening I witnessed in my actual mission.

The dragger gets teleported to his initial position after dragging.

This is not happening with the version I still had in it .. this one:

Spoiler

 

_injured = _this select 0;
_draggers = _this select 1;
_dragger = _this select 2;
_dummy = _this select 3;

if (mein_debug>0) then {  
                player globalChat format ["drag_wounded.sqf - injured:%1", _injured];
                       };

while { alive _injured } do
{
sleep 1;
_draggers = nearestObjects [vehicle _injured, ["Man"], 10];

 if (count _draggers > 1) then
   {
       {
            if ((alive _x) AND (_x != vehicle _injured)) then
            {


                    _x move getpos _injured; _dragger = _x;

                

                       if (mein_debug>0) then {  
                player globalChat format ["drag_wounded.sqf - dragger:%1", _dragger];
                                              };
            };
        };                   

    } forEach _draggers;
    

    hint format["dragger: %1", _dragger];


sleep 4;

if ((alive _dragger) AND (_dragger distance _injured < 5)) then {

                       if (mein_debug>0) then {  
                player globalChat format ["drag_wounded.sqf - start dragging dragger:%1", _dragger];
                                              };


_dragger playAction "grabDrag";
sleep 2.5;
_injured switchMove "AinjPpneMstpSnonWrflDb";    
Sleep (0.01);

waitUntil { ((AnimationState _dragger) == "AmovPercMstpSlowWrflDnon_AcinPknlMwlkSlowWrflDb_2") || ((AnimationState _dragger) == "AmovPercMstpSnonWnonDnon_AcinPknlMwlkSnonWnonDb_2")};

_injured attachTo [_dragger, [0, 1.2, 0]]; // attach injured
_injured setDir 180; // set injured to turn his back on dragger

_DummyClone = {
private ["_dummy", "_dummygrp", "_dragger"];
_dragger = _this;
// create Dummy unit that dragger attaches to, dummy unit moves and simulates dragger moving
_dummygrp = createGroup EAST;
_dummy = _dummygrp createUnit ["RU_soldier", Position _dragger, [], 0, "FORM"];
_dummy setUnitPos "up";
_dummy hideobject true;
_dummy allowdammage false;
_dummy setBehaviour "CARELESS";
_dummy disableAI "FSM";
       _dummy forceSpeed 1.5;
_dragger attachTo [_dummy, [0, -0.2, 0]];
_dragger setDir 180;
// return dummy object
_dummy
};

_dummy = _dragger call _DummyClone;

_dragger playMove "AcinPknlMwlkSrasWrflDb"; _dragger disableAI "ANIM";


if (mein_debug>0) then {  
                player globalChat format ["drag_wounded.sqf - dragger:%1 injured:%2 dummy:%3", _dragger, _injured, _dummy];
                       };

                       while { alive _dragger && alive _injured } do {
                       
_waypointDrag = (group _dummy) addWaypoint [getMarkerPos "MarkerOne", 0];
_waypointDrag setWaypointStatements ["true", format [
                                                        " %1 enableAI 'ANIM';
                                                          %1 playMove 'AmovPercMstpSlowWrflDnon';
                                                          %2 switchMove 'AinjPpneMstpSnonWrflDb_release';
                                                          detach %2; deleteVehicle this;
                                                          if !(alive %2) then { %2 switchMove 'AinjPpneMstpSnonWrflDb_release'; };
                                                         ", _dragger, _injured, _dummy ] ];

                                                  };
                                                  
                        if !(alive _dragger) then {
                        
                            deleteVehicle _dummy; detach _injured;
                            
                            if (((AnimationState _injured) == "AinjPpneMstpSnonWrflDb") OR ((AnimationState _injured) == "ADTHPPNEMSTPSNONWRFLDBB_Dragged")) then { _injured switchMove "AinjPpneMstpSnonWrflDb_release"; };


        
                                                   };
                                                    };

 };

 

 

I compared both scripts with Beyond Compare and honestly, yours just looks better, but I can't find any reason why it would do this teleport bug.

Maybe it was just RNG but I ran both 5 times and the AI got teleported 5 times and in the old version 0 times. And btw I am pretty sure it was the old version I got the teleport bug too in my actual mission so this doesn't make sense to me at all ( just checked it, only thing different is the marker name and one missing debug hint ) and I think I'll stick to my decision to not use this one in my mission.

But maybe for the next one. Just too much AI scripts running in this one, like UPSMON and a bunch of custom ones to simulate stealth gameplay and stuff.

Thanks for the help anyway, I still think this is a pretty interesting and immersive script.
 

Share this post


Link to post
Share on other sites

Another quick question ...

 

trying to get this flare script to work:

 

Spoiler

 

//this addEventHandler ["Fired",{ nul = [ (_this select 0), (_this select 1), (_this select 2), (_this select 3), (_this select 4), (_this select 5), (_this select 6) ] execVM "test.sqf"}];  

_unit = _this select 0;
_weapon = _this select 1;
_muzzle = _this select 2;
_mode = _this select 3;
_ammo = _this select 4;
_magazine = _this select 5;
_projectile = _this select 6;


  player globalChat format ["%1 %2 %3 %4 %5 %6 %7", _unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile];

 

if ( _muzzle == GP25Muzzle ) then { player globalChat "GP25 check" } else { player globalChat "NOT check" };

 

 

The global chat works fine but the red line is getting ignored completely.

I just want to know if the unit has fired a flare to trigger reinforcements and stuff.

 

Tested it with _muzzle, _ammo and _magazine, but nothing happens.

So I guess '==' just doesn't work here?

 

Nevermind, I forgot the quotation marks ...    _muzzle == "GP25Muzzle"

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  

×