Jump to content
Sign in to follow this  
d00kiejones

Issue running .SQF on a unit after respawn

Recommended Posts

***EDIT*** I completely derped this one and did not realize that you CAN call init lines with norrin's after revive/respawn. It is nearly at the bottom of "revive_init.sqf" NORRINCustomExec, For me it was exec1 and the folowing fixed my issue.

 
NORRNCustomExec1				="[s1,squad,1] execVM ""scripts\mark_unit.sqf"";"; 

Don't forget the extra "; or it will cause an error a few lines down.

I am building a mission for my friends and I to play around in, think escape Chernarus without the escape part, yes I will release it when it is ready. I want to have a marker following the squad leader and can easily get that to happen until the unit is revived or respawns, norrins revive if you want to know. I can activate the marker script with,

 nul = [s1,"squad",50] execVM "scripts\mark_unit.sqf; 

As I am sure you are aware after the unit dies the init is cleared, Norrins revive allows us to replace the equipment easily but not the init that I am aware of. I have tried various triggers with conditions set to

 (player == s1) 

That will start the script on the first spawn but fails after respawn/revive.

 !alive s1 

with the script exec in on deactivate and that does not work. I tried a few other syntax types but all gave errors.

I have also tried to call the script from the mission init.sqf the same way I am replacing my addactions after revive/respawn.

 s1 addAction ["Cruise Missile.","scripts\launchMissile.sqf", [this, missilestart,"Bo_GBU12_LGB",1000], 1, false, true,"", "_this == s1"];
s1 addAction ["Ammo.","scripts\box.sqf", 0, 1, false, true,"", "_this == s1"];
s1 addAction ["Bike.","scripts\bike.sqf", 0, 1, false, true,"", "_this == s1"];
s1 addAction ["Ural.","scripts\MTVR.sqf", 0, 1, false, true,"", "_this == s1"];
s1 addAction ["APC.","scripts\APC.sqf", 0, 1, false, true,"", "_this == s1"];
s1 addAction ["Tank.","scripts\Tank.sqf", 0, 1, false, true,"", "_this == s1"];
s1 addAction ["Chopper.","scripts\Choppa.sqf", 0, 1, false, true,"", "_this == s1"];
s1 addAction ["Jet.","scripts\jet.sqf", 0, 1, false, true,"", "_this == s1"];
s1 addAction ["Rearm Truck.","scripts\rearm.sqf", 0, 1, false, true,"", "_this == s1"];
s1 addAction ["Refuel Truck.","scripts\Refuel.sqf", 0, 1, false, true,"", "_this == s1"]; 
s1 addAction ["Repair Truck.","scripts\repair.sqf", 0, 1, false, true,"", "_this == s1"];


while {true} do {
waitUntil {!alive player};

waitUntil {alive player};

s1 addAction ["Cruise Missile.","scripts\launchMissile.sqf", [this, missilestart,"Bo_GBU12_LGB",1000], 1, false, true,"", "_this == s1"];
s1 addAction ["Ammo.","scripts\box.sqf", 0, 1, false, true,"", "_this == s1"];
s1 addAction ["Bike.","scripts\bike.sqf", 0, 1, false, true,"", "_this == s1"];
s1 addAction ["Ural.","scripts\MTVR.sqf", 0, 1, false, true,"", "_this == s1"];
s1 addAction ["APC.","scripts\APC.sqf", 0, 1, false, true,"", "_this == s1"];
s1 addAction ["Tank.","scripts\Tank.sqf", 0, 1, false, true,"", "_this == s1"];
s1 addAction ["Chopper.","scripts\Choppa.sqf", 0, 1, false, true,"", "_this == s1"];
s1 addAction ["Jet.","scripts\jet.sqf", 0, 1, false, true,"", "_this == s1"];
s1 addAction ["Rearm Truck.","scripts\rearm.sqf", 0, 1, false, true,"", "_this == s1"];
s1 addAction ["Refuel Truck.","scripts\Refuel.sqf", 0, 1, false, true,"", "_this == s1"]; 
s1 addAction ["Repair Truck.","scripts\repair.sqf", 0, 1, false, true,"", "_this == s1"];
};

In the above code I tried the following with no success.

 s1 = [s1,"squad",50] execVM "scripts\mark_unit.sqf";
[s1,"squad",50] execVM "scripts\mark_unit.sqf";
nul = [s1,"squad",50] execVM "scripts\mark_unit.sqf";
[s1,"squad",50] call compile preprocessfile "scripts\mark_unit.sqf";

I am now at a loss and cannot figure this out, any help would be awesome.

Edited by dooks

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  

×