Jump to content
unidad2pete

AddAction multiplayer for allplayers

Recommended Posts

it works GREAT !

 

now i have an other problem ^^, i would like use the same script for an antenna but it doesn't work , i m not good at script i think i have so many errors.

 

can you help me ?

 

 

description.ext 

 

class CfgFunctions
{
class antenna
{
tag = "antenna";
class antenna
{
file = "functions";
class radioconnect {};
class toggleRadio {};
};
};
};

fn_radiovehicle.sqf

 

//LARs_fnc_radioVehicle
//
//[ vehicle ] call LARs_fnc_radioVehicle
//


params[ "_radioVehicle", [ "_isInit", true ] ];


//If we are initialising could be from..
//script - server or client
//from init box - server or client
if ( _isInit ) exitWith {


//If this vehicle has not already been initialised
if !( _radioVehicle in ( missionNamespace getVariable [ "RadioVehicles", [] ] ) ) then {


//If we cannot suspend re-spawn script
if !( canSuspend ) exitWith {
_this spawn LARs_fnc_radioVehicle;
};


//Wait until the mission has started
waitUntil{ time > 0 };


if ( isServer ) then {
//Create a unique name for the vehicle
//will use name given in editor if there is one
[ _radioVehicle, "RadioVehicle" ] call BIS_fnc_objectVar;


//Update global list of radio Vehicles
missionNamespace setVariable [ "RadioVehicles", ( missionNamespace getVariable [ "RadioVehicles", [] ] ) + [ _radioVehicle ], true ];


//Assign remote function to be called by vehicles RHS mast script
_remote_fnc = format[ "{ _this remoteExec [ 'LARs_fnc_toggleRadioVehicle', 0, 'RVToggle_%1' ] }", vehicleVarName _radioVehicle ];
_radioVehicle setVariable [ "rhs_eh_gaz66_deploy", ( _radioVehicle getVariable [ "rhs_eh_gaz66_deploy", [] ] ) + [ _remote_fnc ], true ];


//Init clients
[ _radioVehicle, false ] remoteExec [ "LARs_fnc_radioVehicle", 0, format[ "initRV_%1", vehicleVarName _radioVehicle ] ];


_radioVehicle addEventHandler [ "Killed", {
params[ "_killed" ];


//Remove JIP queue function calls
remoteExec [ "", format[ "initRV_%1", vehicleVarName _killed ] ];
remoteExec [ "", format[ "RVToggle_%1", vehicleVarName _killed ] ];


//Remove vehicle from Global list
RadioVehicles set[ RadioVehicles find _killed, objNull ];
publicVariable "RadioVehicles";


//Remove client action
[ _killed, false ] remoteExec [ "LARs_fnc_radioVehicle", 0 ];
}];


}else{
//Call master init on the server
[ _radioVehicle ] remoteExec [ "LARs_fnc_radioVehicle", 2 ];
};
};
};




//Init client
if ( hasInterface ) then {


//Remove vehicles action if we are informing the client that the vehicle is dead
if !( alive _radioVehicle ) exitWith {
_actionID = _radioVehicle getVariable [ "RVActionID", -1 ];
if !( _actionID isEqualTo -1 ) then {
_radioVehicle removeAction _actionID;
};
};


//Wait for availability of player and make sure mast has finished any current animations
waitUntil{ !isNull player && ( _radioVehicle doorPhase "mast_source" ) in [ 0, 1 ] };


//Add action to radio Vehicle and store it locally
_radioVehicle setVariable [ "RVActionID", _radioVehicle addAction[ [ "Deployer Antenne", "Ranger l'antenne" ] select ( _radioVehicle doorPhase "mast_source" ), {
params [ "_target", "_caller", "_id" ];


//Call RHS mast script where vehicle is local
[ _target, ( _target doorPhase "mast_source" ) *-1 +1 ] remoteExec [ "rhs_fnc_gaz66_radioDeploy", _target ];


//hide action if we are the driver or mast is currently animating
},[],1,false,true,"","!( driver _target isequalto _this ) && { _target doorPhase 'mast_source' in [ 0, 1 ] }"]];


//Start EH to look after player TF vars when in range of a radio vehicle
if ( isNil "RadioVehiclesEH" ) then {


RadioVehiclesEH = addMissionEventHandler [ "EachFrame", {
//If we have reached a new check timeout and we have some valid radio vehicles
if (
missionNamespace getVariable[ "RVLastCheck", time ] <= time &&
{ count ( RadioVehicles select { !isNull _x } ) > 0 }
) then {


//Remove null vehicles
RadioVehicles = RadioVehicles select { !isNull _x };


//default TF multiplier
_multiplier = 1;


//Check range to all radio vehicles
{
if ( _x doorPhase "mast_source" isEqualTo 1 ) then {
if ( player distanceSqr _x < 500^2 ) then {
//If in range change multiplier
_multiplier = 2;
};
};
}forEach RadioVehicles;


//If the multiplier is different from our current setting
if !( _multiplier isEqualTo ( player getVariable [ "tf_sendingDistanceMultiplicator", 1 ] ) ) then {
//Update player TF var - does this need to be globally set?
player setVariable ['tf_sendingDistanceMultiplicator', _multiplier, true ];
};


//Set next check time
missionNamespace setVariable [ "RVLastCheck", time + 10 ]; //10 seconds between checks
};
}];
};


};

fn_radioconnect.sqf

//antenna_fnc_Vehicle
//
//[ vehicle ] call antenna_fnc_Vehicle
//


params[ "_Vehicle", [ "_isInit", true ] ];


//If we are initialising could be from..
//script - server or client
//from init box - server or client
if ( _isInit ) exitWith {


//If this vehicle has not already been initialised
if !( _Vehicle in ( missionNamespace getVariable [ "Vehicles", [] ] ) ) then {


//If we cannot suspend re-spawn script
if !( canSuspend ) exitWith {
_this spawn antenna_fnc_Vehicle;
};


//Wait until the mission has started
waitUntil{ time > 0 };


if ( isServer ) then {
//Create a unique name for the vehicle
//will use name given in editor if there is one
[ _Vehicle, "Vehicles" ] call BIS_fnc_objectVar;


//Update global list of radio Vehicles
missionNamespace setVariable [ "Vehicles", ( missionNamespace getVariable [ "Vehicles", [] ] ) + [ _Vehicle ], true ];


//Assign remote function to be called by vehicles RHS mast script
_remote_fnc = format[ "{ _this remoteExec [ 'antenna_fnc_toggleVehicles', 0, 'RVToggle_%1' ] }", vehicleVarName _Vehicle ];


//Init clients
[ _Vehicle, false ] remoteExec [ "antenna_fnc_Vehicle", 0, format[ "initRV_%1", vehicleVarName _Vehicle ] ];


_Vehicle addEventHandler [ "Killed", {
params[ "_killed" ];


//Remove JIP queue function calls
remoteExec [ "", format[ "initRV_%1", vehicleVarName _killed ] ];
remoteExec [ "", format[ "RVToggle_%1", vehicleVarName _killed ] ];


//Remove vehicle from Global list
Vehicles set[ Vehicles find _killed, objNull ];
publicVariable "Vehicles";


//Remove client action
[ _killed, false ] remoteExec [ "antenna_fnc_Vehicle", 0 ];
}];




}else{
//Call master init on the server
[ _Vehicle ] remoteExec [ "antenna_fnc_Vehicle", 2 ];
};
};
};




//Init client
if ( hasInterface ) then {


//Remove vehicles action if we are informing the client that the vehicle is dead
if !( alive _Vehicle ) exitWith {
_actionID = _Vehicle getVariable [ "RVActionID", -1 ];
if !( _actionID isEqualTo -1 ) then {
_Vehicle removeAction _actionID;
};
};


//Wait for availability of player and make sure mast has finished any current animations
waitUntil{ !isNull player && ( _Vehicle doorPhase "mast_source" ) in [ 0, 1 ] };


//Add action to radio Vehicle and store it locally
_Vehicle setVariable [ "RVActionID", _Vehicle addAction[ [ "Connect to VDV", "Disconnect" ], {
params [ "_target", "_caller", "_id" ];




//hide action if we are the driver or mast is currently animating
}]];


//Start EH to look after player TF vars when in range of a radio vehicle
if ( isNil "VehiclesEH" ) then {


VehiclesEH = addMissionEventHandler [ "EachFrame", {
//If we have reached a new check timeout and we have some valid radio vehicles
if (
missionNamespace getVariable[ "RVLastCheck", time ] <= time &&
{ count ( Vehicles select { !isNull _x } ) > 0 }
) then {


//Remove null vehicles
Vehicles = Vehicles select { !isNull _x };


//default TF multiplier
_multiplier = 1;


//Check range to all radio vehicles
{
if ( _x doorPhase "mast_source" isEqualTo 1 ) then {
if ( player distanceSqr _x < 1500^2 ) then {
//If in range change multiplier
_multiplier = 4;
};
};
}forEach Vehicles;


//If the multiplier is different from our current setting
if !( _multiplier isEqualTo ( player getVariable [ "tf_sendingDistanceMultiplicator", 1 ] ) ) then {
//Update player TF var - does this need to be globally set?
player setVariable ['tf_sendingDistanceMultiplicator', _multiplier, true ];
};


//Set next check time
missionNamespace setVariable [ "RVLastCheck", time + 10 ]; //10 seconds between checks
};
}];
};


};

fn_toggleradio

//LARs_fnc_toggleRadioVehicle
//
//Called remotely by LARs_fnc_Vehicle
//


params[ "_Vehicle", "_connect" ];


//Incase we are calling on a JIPed player wait here until his RV action is available
waitUntil { !isNil { _Vehicle getVariable "RVActionID" } };


switch ( _connect ) do {
//deploying
case ( 1 ) : {
_Vehicle setUserActionText [ _Vehicle getVariable "RVActionID", "Disconnect" ];
};
//retracting
case ( 0 ) : {
_Vehicle setUserActionText [ _Vehicle getVariable "RVActionID", "Connect to VDV" ];
};
};

Share this post


Link to post
Share on other sites

Instead of making another script to handle vehicles that do not have a RHS mast script i have added switch statements in both the server and client side of LARs_fnc_radioVehicle.

functions\fn_radioVehicle.sqf

//LARs_fnc_radioVehicle
//
//[ vehicle, [ effective radio distance, TF multiplier ] ] call LARs_fnc_radioVehicle
//

params[ "_radioVehicle", [ "_distance", [ 500, 4 ] ], [ "_isInit", true ], [ "_remote_fnc", "" ], "_actionTitles" ];

//If we are initialising could be from..
//script - server or client
//from init box - server or client
if ( _isInit ) exitWith {
	
	//If this vehicle has not already been initialised
	if !( _radioVehicle in ( missionNamespace getVariable [ "LARs_RadioVehicles", [] ] ) ) then {
		
		//If we cannot suspend re-spawn script
		if !( canSuspend ) exitWith {
			_this spawn LARs_fnc_radioVehicle;
		};
		
		//Wait until the mission has started
		waitUntil{ time > 0 };
				
		if ( isServer ) then {
			//Create a unique name for the vehicle
			//will use name given in editor if there is one
			[ _radioVehicle, "RadioVehicle" ] call BIS_fnc_objectVar;
			
			//Update global list of radio Vehicles
			missionNamespace setVariable [ "LARs_RadioVehicles", ( missionNamespace getVariable [ "LARs_RadioVehicles", [] ] ) + [ _radioVehicle ], true ];
			
			//Default all vehicles to not connected
			_radioVehicle setVariable[ "LARs_radioConnected", 0, true ];
						
			//Handle different vehicle types
			switch ( true ) do {
				
				//If it is a RHS vehicle with mast script
				case ( isClass( configFile >> "CfgVehicles" >> typeOf _radioVehicle >> "AnimationSources" >> "mast_handler" ) ) : {
					
					//Set action titles for deployment status [ not active, active ]
					_actionTitles = [ "Deploy Mast", "Fold Mast" ];
					
					//Assign remote function to be called by vehicles RHS mast script
					_remote_fnc = format[ "{ ( _this + [ %1 ] ) remoteExec [ 'LARs_fnc_toggleRadioVehicle', 0, 'RVToggle_%2' ] }", _actionTitles, vehicleVarName _radioVehicle ];
					//Store callback function in RHS variable and broadcast to all computers
					_radioVehicle setVariable [ "rhs_eh_gaz66_deploy", ( _radioVehicle getVariable [ "rhs_eh_gaz66_deploy", [] ] ) + [ _remote_fnc ], true ];
				};
				
				default {
					
					//Set action titles for connected status
					_actionTitles = [ "Connect to VDV", "Disconnect" ];
					
					//bypass middle man script( no RHS deploy for a default object ) and call straight into LARs_fnc_toggleRadioVehicle
					_remote_fnc = format[ "( _this + [ %1 ] ) remoteExec [ 'LARs_fnc_toggleRadioVehicle', 0, 'RVToggle_%2' ]", _actionTitles, vehicleVarName _radioVehicle ];
				};
			};
			
			//Init clients
			[ _radioVehicle, _distance, false, _remote_fnc, _actionTitles ] remoteExec [ "LARs_fnc_radioVehicle", 0, format[ "initRV_%1", vehicleVarName _radioVehicle ] ];
			
			//Handle vehicle death
			_radioVehicle addEventHandler [ "Killed", {
				params[ "_killed" ];
				
				//Remove JIP queue function calls
				remoteExec [ "", format[ "initRV_%1", vehicleVarName _killed ] ];
				remoteExec [ "", format[ "RVToggle_%1", vehicleVarName _killed ] ];
				
				//Remove vehicle from Global list
				LARs_RadioVehicles set[ LARs_RadioVehicles find _killed, objNull ];
				publicVariable "LARs_RadioVehicles";
				
				//Disconnect a default radio object
				_radioVehicle setVariable [ "LARs_radioConnected", nil, true ];
				
				//Remove client action
				[ _killed, nil, false ] remoteExec [ "LARs_fnc_radioVehicle", 0 ];
			}];
			
			//ReInit respawning radio vehicles
			//do we need respawn on a vehicle?
			//most vehicle respawners actually make a copy not respawn
			_radioVehicle addEventHandler [ "Respawn", {
				params[ "_new", "_old" ];
				
				[ _new, _old getVariable[ "LARs_radioDistance", [ 500, 4 ] ] ] spawn LARs_fnc_radioVehicle;
			}];
						
		}else{
			if !( _radioVehicle in	( missionNamespace getVariable [ "LARs_RadioVehicles", [] ] ) ) then {
				//Call master init on the server
				[ _radioVehicle, _distance ] remoteExec [ "LARs_fnc_radioVehicle", 2 ];
			};
		};
	};
};


//Init client
if ( hasInterface ) then {
	private[ "_actionParams" ];
	
	//Remove vehicles action if we are informing the client that the vehicle is dead
	if !( alive _radioVehicle ) exitWith {
		_actionID = _radioVehicle getVariable [ "RVActionID", -1 ];
		if !( _actionID isEqualTo -1 ) then {
			_radioVehicle removeAction _actionID;
		};
	};
		
	//Handle different vehicle types
	switch ( true ) do {
	
		//If it is a RHS vehicle with mast script
		case ( isClass( configFile >> "CfgVehicles" >> typeOf _radioVehicle >> "AnimationSources" >> "mast_handler" ) ) : {
			
			//Wait for availability of player and make sure mast has finished any current animations
			waitUntil{ !isNull player && { ( _radioVehicle doorPhase "mast_source" ) in [ 0, 1 ] } };
			
			//Action parameters
			_actionParams = [ _actionTitles select ( _radioVehicle doorPhase "mast_source" ), {
				params [ "_target", "_caller", "_id" ];
				
				//Call RHS mast script where vehicle is local
				[ _target, ( _target doorPhase "mast_source" ) *-1 +1 ] remoteExec [ "rhs_fnc_gaz66_radioDeploy", _target ];
				
								//hide action if we are the driver or mast is currently animating
			}, [], 1, false, true, "", "!( driver _target isequalto _this ) && { _target doorPhase 'mast_source' in [ 0, 1 ] }" ];

		};
		
		default {
			
			//Wait for availability of player
			waitUntil{ !isNull player };
			
			//Action parameters
			_actionParams = [ _actionTitles select ( _radioVehicle getVariable [ "LARs_radioConnected", 0 ] ), {
				params [ "_target", "_caller", "_id", "_remote_fnc" ];
				
				//Get opposite state
				_toState = ( _target getVariable [ "LARs_radioConnected", 0 ] ) *-1+1;
								
				//bypass any middle man script and call straight into _remote_fnc( LARs_fnc_toggleRadioVehicle ) 
				[ _target, _toState ] call compile _remote_fnc;
				
			}, _remote_fnc, 1, false, true, "", "" ];
				
		};
	};
	
	//Set radio effective distance of vehicle
	_radioVehicle setVariable[ "LARs_radioDistance", _distance ];
	
	//Add action to radio Vehicle and store it locally
	_radioVehicle setVariable [ "RVActionID", _radioVehicle addAction _actionParams ];
	
	//Start EH to look after player TF vars when in range of a radio vehicle
	if ( isNil "LARs_RadioVehiclesEH" ) then {

		LARs_RadioVehiclesEH = addMissionEventHandler [ "EachFrame", {
			//If we have reached a new check timeout and we have some valid radio vehicles
			if (
				missionNamespace getVariable[ "RVLastCheck", time ] <= time &&
				{ count ( LARs_RadioVehicles select { !isNull _x } ) > 0 }
			) then {
				
				//Remove null vehicles
				LARs_RadioVehicles = LARs_RadioVehicles select { !isNull _x };
				
				//default TF multiplier
				_multiplier = 1;
				
				//Check range to all radio vehicles
				{
					( _x getVariable [ "LARs_radioDistance", [ 500, 4 ] ] ) params[ "_range", "_multi" ];
					//If the radio is deployed
					//doorPhase returns -1 if not valid
					if ( { _x isEqualTo 1 }count [ _x doorPhase "mast_source", _x getVariable [ "LARs_radioConnected", 0 ] ] > 0 ) then {
						if ( player distanceSqr _x < ( _range^2 ) ) then {
							//If in range change multiplier
							_multiplier = _multi max _multiplier;
						};
					};
				}forEach LARs_RadioVehicles;
				
				//If the multiplier is different from our current setting
				if !( _multiplier isEqualTo ( player getVariable [ "tf_sendingDistanceMultiplicator", 1 ] ) ) then {
					//Update player TF var - does this need to be globally set?
					player setVariable ['tf_sendingDistanceMultiplicator', _multiplier, true ];
				};
				
				//Set next check time
				missionNamespace setVariable [ "RVLastCheck", time + 10 ]; //10 seconds between checks
			};
		}];
	};
	
};
The server side switch takes care of the actions titles and the function to call when an action is used.

As before for a RHS vehicle it provides the callback script. The default option just calls straight into LARs_fnc_toggleRadioVehicle.

The client side switch just sets up the action.

functions\fn_toggleRadioVehicle

//LARs_fnc_toggleRadioVehicle
//
//Called remotely by LARs_fnc_radioVehicle
//

params[ "_radioVehicle", "_deployed", "_actionTitles" ];

//Incase we are calling on a JIPed player wait here until his RV action is available
waitUntil { !isNil { _radioVehicle getVariable "RVActionID" } };

_radioVehicle setVariable [ "LARs_radioConnected", _deployed ];

_title = _actionTitles select _deployed;

switch ( _deployed ) do {
	//deploying
	case ( 1 ) : {
		_radioVehicle setUserActionText [ _radioVehicle getVariable "RVActionID", _title ];
	};
	//retracting
	case ( 0 ) : {
		_radioVehicle setUserActionText [ _radioVehicle getVariable "RVActionID", _title ];
	};
};
From here you can add as many different case statements to handle different vehicles as necessary.

Updated example mission.

Share this post


Link to post
Share on other sites

thank you for everything, i have a last question, is it possible to change different range ?  with  a véhicle  like car or truck x4  and an objet like antenna, radar,  x2 for example ?

 

you are clearly a génius btw !

 

 

ps : sorry for my english

Share this post


Link to post
Share on other sites

Updated previous post and example mission so you can provide effective radio distance and TF multiplier of vehicle in call to function, if not provided it will default to 500m and x4.

[ vehicle, [ effective range, TF multiplier ] ] call LARs_fnc_radioVehicle
Untested but hopefully have not made any mistakes :unsure:

Not a genius, just love scripting and making one off system like this, that's why i love helping out on the forums.

Share this post


Link to post
Share on other sites

It works, thank you very much ! 

 

if i have an other problem with an other script, is it possible to send you a message ?

Share this post


Link to post
Share on other sites

Gents,

 

Hopefully this thread is still been monitored - i am hoping that someone will be able to provide me with some assistance please.

 

Basically i have a Dedicated server that i have been running an Anti Stasi mission on - i have decided to i want to change my server to run random side mission with a main objective as well.  I am fairly new to arma 3 coding but have managed to sort out the majority of the main AO and am also happy with creating the side missions - the main issue i have is understanding the RemoteExec function to all MP actions to be added for all to see:

 

 

 

Please find below some code for 1 of my side missions:

 

fn_findMissionSpot = {
__avoid = ["avoid1","avoid2","avoid3","avoid4","avoid5","avoid6","avoid7","avoid8","avoid9","base","opfor"];
pos = ["map",false,"_avoid",10]call SHK_pos;
};

 

//F22 wreck mission///////////////////

fn_spawnF22wreckMission = {

call fn_findMissionSpot;

hint "One of our F22's has been shot down! locate it and blow it up before the equipment gets into enemy hands";
//creating the marker 

_markerstr = createmarker ["marker1",pos];
_markerstr setmarkershape "ICON";
"marker1" setMarkerType "mil_objective"; 
"marker1" setMarkerColor "ColorRed"; 
"marker1" setMarkerDir 90; 
"marker1" setMarkerText "Side Objective - Destroy the F22 wreck";

_AOmarker = createmarker ["AO",pos];
_AOmarker setmarkershape "ELLIPSE";
"AO" setMarkerColor "ColorRed";
"AO" setMarkerSize [500, 500]; 
"AO" setMarkerBrush "DiagGrid";

null = [["AO"],[0,0],[5,3],[1,2],[1],[0],[1,0],[5,0,2000,EAST]] call EOS_Spawn;

//_f22wreckpos = ["AO",false,"",10]call SHK_pos;

//creating the vehicle

_veh = ["rhsusf_f22"] call BIS_fnc_selectRandom;

f22wreck = createVehicle [_veh,[(getMarkerpos _markerstr select 0) + 30, getMarkerpos _markerstr select 1,0],[], 0, "NONE"];
f22wreck setFuel 0.1;
f22wreck setVehicleAmmo 0.2;
f22wreck setDamage 0.8;
f22wreck allowdamage false:
//need to use remoteExec to add an action to plant charges and then after 30 sec explosion and deleteVehicle 

waitUntil {sleep 5; !alive f22wreck};

deleteMarker _markerstr;
deleteMarker _AOmarker;

_myHint ="Great job destroying the F22, our technology is safe for now";
GlobalHint = _myHint;
publicVariable "GlobalHint";
hintsilent parseText _myHint;

_mySChat ="Standby for another Mission!";
GlobalSCHat = _mySChat;
publicVariable "GlobalSCHat";
player sideChat _mySChat;

sleep 45;
hint "New side mission created";
};    //end of F22 mission
 

 

The issue i have is that multiplayer personnel could just target the F22 Wreck from 1000yds away with the TITAN and just blow it up in order to complete the mission - What i would like to do is enable damage to be false for the F22 and use remote exec to add a MP action to set charges - after 30 secs i would then add the code to cause a large explosion and delete the vehicle. 

 

I am not sure how to use RemoteExec (i have looked at the community wiki for what seems like hours but just don't get it!

 

I would be very very happy if someone could help me 

 

Michael

Share this post


Link to post
Share on other sites

You can remoteExec an addaction, and btw, take into account some players can respawn, so you have also to cope with that (addAction is not persistent), But why don't you trigger something with an explosion of any player's charge? See event Handler "fired" and "firedMan".

Share this post


Link to post
Share on other sites
1 hour ago, pierremgi said:

You can remoteExec an addaction, and btw, take into account some players can respawn, so you have also to cope with that (addAction is not persistent), But why don't you trigger something with an explosion of any player's charge? See event Handler "fired" and "firedMan".

 

That's the whole point, i want to use remoteExec an addaction so the player has to interact with the vehicle - otherwise they can just blow it up with a TITAN or something from V long range instead of fighting their way through the enemy forces.  The issue i have is that i don't understand how to use remoteExec within my code above - it needs to go where the bold section is but i can't get the syntax worked out in my head!

Share this post


Link to post
Share on other sites

I understood the case of long range firing on an alive object which remains the same for both methods: you want that players can only interfere on a close position. Here are my remarks:

- considering a wreck", You can: this allowdamage false; your plane, then apply:  this setdamage 0.95 . You will get a vehicle in very bad state but not a wreck;

- if you place a wreck, like "Land_UWreck_MV22_F", you can't apply any damage on it.
 

- later, it's simple to apply myPlane setdamage 1 to complete the objective, or delete the wreck (after an explosion for example).


- in both cases, the trigger can be: an addAction like you want, the simple presence of BLUFOR units near the wreck (trigger) if you don't care anymore for long range firing (realistic also), or even the blow of a charge on the wreck.

 

One solution with a real wreck:

place a wreck, name it (myWreck here)

place a trigger BLUFOR present 20 m radius, condition: this

in on act. field :

player addEventHandler["take",{
  if (tolower (_this select 2) in (["democharge_remote_mag","satchelcharge_remote_mag","ClaymoreDirectionalMine_Remote_Mag","SLAMDirectionalMine_Wire_Mag"] apply {tolower _x}) && (_this select 0 distance myWreck < 20)) then {
    _charge_to_place = allmines select (count allmines -1);
    _charge_to_place spawn {
      _charge = _this;
      waituntil {isnull _charge};
      deleteVehicle myWreck;
    };
  };
  player removeEventHandler ["take",_thiseventhandler]
}]

 

Now, the BLUFOR activates a trigger within 20m of the wreck (true one). and one of the player has to plant a charge to blow the wreck.

This code can be improved but you catch the idea.

 


 
 

Share this post


Link to post
Share on other sites

Hi!

 

Nice to see you are an Antistasi player :)

 

I suggest you a much easier solution.

 

Put a "HandleDamage" EH to the plane. Make a check inside the EH if the amo type a Titan type, and make the plane invulnerable if so.

 

BTW: My suggestion is not to put limits to what players can do. If they can solve the misión with a titan or a lucky arty round, why not?

Share this post


Link to post
Share on other sites

hmm.   so 

spawn BIS_fnc_MP

or

call BIS_fnc_MP;

or


 remoteExec

?????????????

 

I do not understand. 

And how to use it? 

 

Iam Using Tiberus´s Medical patient script, but instead of caaling it via radio i want called ba addaction, and it doesnt work in MP.

 

ihave

this addaction ["Lechce raněn", { [spawnPos, 5, 1] execVM "Tib_practicePatient\Tib_medical.sqf"; }];

vich doesnt work.

so should i use

this addaction ["Lechce raněn", { [spawnPos, 5, 1] execVM "Tib_practicePatient\Tib_medical.sqf" remoteExec [ "BIS_fnc_execVM",2 ]; }];

or

this addaction ["Lechce raněn", { [spawnPos, 5, 1] execVM "Tib_practicePatient\Tib_medical.sqf"; }] spawn BIS_fnc_MP;

or

this addaction ["Lechce raněn", { [spawnPos, 5, 1] execVM "Tib_practicePatient\Tib_medical.sqf"; }] call BIS_fnc_MP;

??????????????????????

Or i got it all wrong and all three options are nonsence? 

 

Share this post


Link to post
Share on other sites

It's weird to remoteExec such sqf!  (BIS_fnc_MP is outdated).

 

If your sqf is on server only, except for very short code, you'll never see the result due to network load. Each remote execution means to send a string of code where you want to execute something. Avoid heavy send on each PC. Anyway, furthermore, your script needs to have sense on client side.

Mind for the syntax :  [  [spawnPos, 5, 1], "Tib_practicePatient\Tib_medical.sqf" ] remoteExec ["execVM"]; // no guarantee

Difficult to help you more.

 

If your code is already on clients side (loaded with the scenario ) there is no reason for remoteExec it! Just call it. Btw, the relative path:  Tib_practicePatient\Tib_medical.sqf works in this context, but surely not if on server only.

 

Share this post


Link to post
Share on other sites

Thanks for reply, but i do not understand.  

What is weird?

How do i know if my sqf is server only?

What do you mean by sense client side?

What is wrong with the path? Paths like this worked for me before.

 

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

×