Jump to content
Sign in to follow this  
ShinShin

Script Help! ( ReRun Script )

Recommended Posts

Okay...

Firstly...

How do I Go about Making any Script of Mine, executed from the Missions folder && or In the Editor Inside an Units/Objects Initilization Field.

I'd Like to Make these Scripts continue to Work and Run Whenever a Unit(Player) Dies & Respawns.

So the Script does not Go InActive when they Die.

e.x. an addAction that Gives a Unit an Action to Execute a Script.

Secondly...

How Would I Go about adding Commands Such as thee Above, to Units/Objects through my

"Init.sqf"
&& NOT the Editor?

e.x. a Command that you'd Normally Place into a Units/Objects Init Field. But Instead do it through the

"Init.sqf"
.

:bounce3: ¿¿Anyone?? :bounce3:

EDIT: Sorry if I Asked this in the Wrong Area :(

Share this post


Link to post
Share on other sites

Place in your init file..

execvm "Yourscriptname.sqf";

and

_xhandle = player addMPEventHandler ["MPrespawn", {Null = _this execVM "Skills\Onplayerdeathinit.sqf";}]; //calls script which controls add back the addactions

in Onplayerdeathinit.sqf

place

execvm "Yourscriptname.sqf";

if its an add action then - use something like this

sleep 2;
if ! isdedicated then                                   //not run on the dedicated server - client side 
{
waituntil {!isnil "bis_fnc_init"};
[] spawn 								// calls the below script used for a loop
{

private ["_addbunker"];//declaring	
waituntil {!isnull player};
bunker_active = false;


if (!isnull player) then 
{
if (typeof player == "US_Soldier_MG_EP1") then 
   {
	while {true} do 
	{
	    waitUntil {!bunker_active &&(alive player)};

	    _addbunker = player addAction [("<t color=""#66FFFF"">" + ("Build bunker") +"</t>"), "skills\bunker.sqf",[],1,false,true];

	    waitUntil {bunker_active || (!alive player)};
	    player removeAction _addbunker;

	};
    }; //type of player	 
}; //if !is null
}; // []spawn
}; //!isserver

basically the init calls the addaction to be added to your player, then when he dies the eventhandler calls for it to be called again once he has respawned

Share this post


Link to post
Share on other sites

Thanks again Mikie Boy :yay:

You & all the Others are GREAT Great Help! :D

I Really Appreciate your Patience with my Questions :)

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  

×