Jump to content
Sign in to follow this  
kahna

Executing scripts only for certian players

Recommended Posts

I'm working on a downed pilot (choppers sabotaged, find that out later) + search and rescue mission. I want the pilots and passengers to have a cinematic into (of sorts) where their input is disabled, they're blacking in and out (injuries, g-forces etc) and sounds are playing (music atm, until I find a good damage alarm .ogg file). I've got the intro sorted, but the SAR team also experiences the blackouts, disable and sounds.

Init of Pilots/Passengers:

nul = [this] execVM "crashing.sqf";

crashing.sqf:

player moveInDriver Heli; // Heli is a pre-positioned UH-80 at 650m ATL that takes critical damage from modules via triggers 2 seconds after loading in.
disableUserInput true; // Allows cinematic, first person will be forced by difficulty.
sleep 4;
playMusic "Track11_StageB_stealth";
titleText ["", "BLACK OUT"]; // G-Forces + Injuries from the sabotage damage.
sleep 3;
titleText ["", "BLACK IN"];
sleep 3;
deleteVehicle Escort; // Deletes the AH-99 flying escort duty in front of the UH-80 after it spectacularly bursts into flames from it's own sabotage damage and falls out of view.
titleText ["", "BLACK OUT"];
sleep 3;
titleText ["", "BLACK IN"];
sleep 3;
titleText ["", "BLACK OUT"];
sleep 2;
titleText ["", "BLACK IN"];
sleep 2;
titleText ["", "BLACK OUT"];
sleep 2;
player action ["eject", Heli]; 
player moveInDriver Angel; // Angel is a pre-positioned critically damaged/no fuel/no ammo UH-80 on the ground where the player starts the mission. Objects hidden in the ground employ light points that are used to simulate emergency lighting.
deleteVehicle Heli; // Deletes the doomed UH-80 before it crashes, don't want the flaming wreck of ANOTHER UH-80 at night somewhere else... That would just be silly.
SkipTime 2; // Pilots/Passengers knocked unconscious, they wake up two hours after impact and night has fallen.
0 setFog 0.3;
0 setOvercast 1.0;
sleep 5;
systemChat "Two Hours Later...";
sleep 5;
titleText ["", "BLACK IN"];
sleep 3;
titleText ["", "BLACK OUT"];
sleep 3;
playMusic ""; // Stops the music from playing.
titleText ["", "BLACK IN"];
sleep 2;
titleText ["", "BLACK OUT"];
sleep 2;
titleText ["", "BLACK IN"];
disableUserInput false; // Returns control to the player. Mission starts. Task assigned - Survive, Evade, Resist, Escape.

Edited by Kahna

Share this post


Link to post
Share on other sites

Just remember the init of objects placed in editor are global. You would need to run those effects on a local to player scripts from the init.sqf and check to see if player == the unit you want to have the effects on.

Share this post


Link to post
Share on other sites

Did not know that, thanks!

Made a simple check script to solve this problem. Works like a charm.

_Allow = ["B_Helipilot_F"];

if ((typeof player) in _Allow) then {[] execVM "crashing.sqf"} else {};

Share this post


Link to post
Share on other sites

you do not need to make it a if then else, unless you have code going into the else block

Share this post


Link to post
Share on other sites

In crashing.sqf you can check locality.

 
_unit = _this select 0;
if (not (local _unit)) exitWith {}

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  

×