Jump to content
Sign in to follow this  
Franklin

Two Issues: On player || vehicle respawn exec script

Recommended Posts

I have two separate issues that are both in regards to re spawning, and executing scripts.

My first one is in regards to running a script on helicopters that respawn using Tophe's vehicle respawn script, and executing the following script:

// Script can be run on several helicopters at the same time, as well as dealing with actions internally.

// Put: nil=[this,0,0,"Init"] execVM "bboat.sqf"; in each chopper line, or from other script by changing

// "this" to the chopper name. Remember to modify the following line to fit the helicopter array:

if (isNil "HULK_BoatCarriers") then {HULK_BoatCarriers = [uh1,uh2,uh3,uh4];};

_bird = _this select 0;

_user = _this select 1;

_id = _this select 2;

_mode = _this select 3;

scopeName "Root";

// Public code section:

call compile format

['

HULK_BoatCarrier_%1 = [];

"HULK_BoatCarrier_%1" addPublicVariableEventHandler

{

_arr = _this select 1;

_c = _arr select 0;

switch (_c) do

{

case 0 :

{

_p = _arr select 1;

_p sideChat "Deploying the zodiac now!";

};

default {hint "Error in Boat script: Unexpected value in EH";};

};

};

', _bird];

// End public section

switch (_mode) do

{

case "Init" :

{

// running on all clients

scopeName "Init";

_act = 0;

_set = 0;

_r = 10; //variable sleep depending on if there is a pilot and whether the action is available - independant on all choppers

while {alive _bird} do

{

scopeName "loop01";

_posh = getPos _bird select 2;

if (isNull (driver _bird)) then {_r = 15;} else {_r = 2;};

if ( (_posh > 2 && _posh < 20) && (damage _bird < 0.5) && (_bird in HULK_BoatCarriers) && (local (driver _bird)) ) then

{

if (_set == 0) then

{

_act = _bird addAction ["Deploy boat", "bboat.sqf","Drop", 100, false, false, ""];

_set = 1;

};

_r = 0.2;

} else

{

if (_set == 1) then

{

_bird removeAction _act;

_set = 0;

_act = 0;

};

};

sleep _r;

};

};

case "Drop" :

{

// running on client using action added in Init section

scopeName "Drop";

call compile format

['

%1_CRRC = createVehicle ["Zodiac",%1 modelToWorld [0,0,-5.2],[],0,""];

%2 sideChat "Deploying the zodiac now!";

HULK_BoatCarriers = HULK_BoatCarriers - [%1];

publicVariable "HULK_BoatCarriers";

//trigger public EH:

HULK_BoatCarrier_%1 = [0,%2];

publicVariable "HULK_BoatCarrier_%1";

', _bird, _user];

};

case "Add" :

{

// placeholder for way of adding boat back to heli

};

default {hint "Error in boat script: wrong parameter given";};

};

As you can see i have four helicopters that i want this to be ran on, and each are named at least at mission start. The script runs fine on the vehicles as i have input the following into their init lines with their respective names inserted into the string properly.

null=[uh1,0,0,"Init"] execVM "bboat.sqf";

Note: i changed nil to null since i am using the ACE mod

Following that line, i have the respawn script running and it looks like this:

veh = [this, 30, 120, 0, FALSE, FALSE, null=[uh1,0,0,""Init""] execVM ""bboat.sqf"";] execVM "vehicle.sqf"

However the bboat script pops up with the hint "Error in boat script: wrong parameter given" as soon as the vehicle respawns. I dont know what parameter its talking about to even know where to look. My thoughts are that the vehicle name is not set back to uh1 upon respawn, and that may be the cause of the error, but im unsure. If that was also the problem, i believe i would need to use an event handler to rename the helicopter upon respawn, but i am lost as to how i would go about incorporating that.

My next issue is in regards to using the Ghillies for a Change addon, and default respawning.

This one im really clueless on, and have tryed to create my own scripts using event handlers to re-apply the set texture after respawning, but im no good with this stuff.

i made an sqf that looks like this, and executed it in the init.sqf:

user14 addEventHandler ['respawn',{null=[this] execVM "texture.sqf";}];

texture.sqf:

this setObjectTexture [0,"\ghillies_for_a_change\13.paa"];

However this flat out doesnt work. I have looked over various scripts for the past 2 weeks trying to find anyting similar to this, and use examples but nothing ive tryed works. Any help on either issue would be very appriciated.

Edited by franklin

Share this post


Link to post
Share on other sites

Hi...it looks like you're missing some quotes in this one...

veh = [this, 30, 120, 0, FALSE, FALSE, "null=[uh1,0,0,""Init""] execVM ""bboat.sqf""";] execVM "vehicle.sqf"

With regard to the ghillie textures...Not tested...but try running this on your player...maybe in the init.sqf or in another script. Hope it works!

while {true} do {

//waituntil player is not alive

waitUntil {not(alive player)};

//waituntil player is alive again

waitUntil {alive player};

//set the texture

player setObjectTexture [0,"\ghillies_for_a_change\01.paa"];

};

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  

×