Jump to content
Sign in to follow this  
creartan

SIMPLE WOUND SCRIPT, i have a code where to put it?

Recommended Posts

i usually make this situation or code editor based TRIGGER,

i mean using the editor but i feel very excausted to put it 4 TRIGGER for each unit

so im trying to make it easier with script but im new, so.. HOW?? please...

what is the right step by step to make this situation work via script?

below is the script i want to accomplish

if (damage _this >= 0.9) then
{
   [east,-2] call BIS_fnc_respawnTickets;
   _this SetUnitPos "down";
   _this switchMove "AinjPpneMrunSnonWnonDb_still";
   _This disableAI "ANIM"; 
   _this setCaptive true; 
   _this globalchat "REBEL Ai Wounded -2";
   sleep 30;
   if (damage _this >= 0.9) then
  { 
      _this hideobject true;
      _this setposATL getposATL base;
  } else {false};
}else
{false};

Edited by creartan

Share this post


Link to post
Share on other sites

Probably something along these lines.

init.sqf

if (isDedicated) exitWith {};
waitUntil {!(isNull player)};
player addEventHandler ["hit", "(_this select 0) execVM 'damage.sqf'"];

damage.sqf

if (damage _this >= 0.9) then
{
[east,-2] call BIS_fnc_respawnTickets;
_this SetUnitPos "down";
_this switchMove "AinjPpneMrunSnonWnonDb_still";
_This disableAI "ANIM"; 
_this setCaptive true; 
_this globalchat "REBEL Ai Wounded -2";
sleep 30;
if (damage _this >= 0.9) then { 
   _this hideobject true;
   _this setposATL getposATL base;
} else {
	false
};
} else {
false
};  

Share this post


Link to post
Share on other sites

wow thanks, thats a quick response

if (isDedicated) exitWith {};

waitUntil {!(isNull player)};

player addEventHandler ["hit", "(_this select 0) execVM 'damage.sqf'"];

the player addEventHandler, is that applied only for player?

im hosting my local lan server isDedicated that applies the same?

how to applied it for ai (unplayable) unit? and can it detect the side of the unit too?

Share this post


Link to post
Share on other sites

It is added to whatever object you want. In this case the player controlled object. Take a look @ https://community.bistudio.com/wiki/Arma_3:_Event_Handlers

Yes you can simply get the side of the unit with the side command. ie; _side = side (_this select 0);

If you want to add the EH to AI units too

if (isServer) then {
{
	if (!(isPlayer _x)) then {
		_x addEventHandler ["hit", "(_this select 0) execVM 'damage.sqf'"];
	};
} foreach allUnits;
} else {
if (isDedicated) exitWith {};
waitUntil {!(isNull player)};
player addEventHandler ["hit", "(_this select 0) execVM 'damage.sqf'"]; 
};	

---------- Post added at 00:23 ---------- Previous post was at 00:16 ----------

I just saw you added new questions. Hosted lan isn't dedicated. I recommend looking @ Scripting commands and locality wiki's and bis_fnc_mp function.

https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3

https://community.bistudio.com/wiki/6thSense.eu:EG

https://community.bistudio.com/wiki/Locality_in_Multiplayer

https://community.bistudio.com/wiki/BIS_fnc_MP

Note: You CAN host a dedicated server on your own machine too via arma3Server.exe in A3 root directory or via the launcher.

Edited by Iceman77

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  

×