Jump to content
NeisAEL

Teleport with Timeskip Script

Recommended Posts

Hello Guys,

 

I could really use some help with a script I'm trying to run. I'm trying to implement a teleport script with Fade In/Out, Time, Date and Weather Change. Linking to an Object with addAction, so all players on the server get teleported at the same time to a predetermined location if one person activates it.

For some reason, this only works for the host (if im trying on local) and for none if its on dedicated. The Teleport is working, but no Time/Date/Weather Change or Fade Out.

This is the script I'm running:

 

teleport.sqf:

setDate [2012, 9, 1, 4, 30]; 0 setFog [0.4, 0.1, 25]; 
{ 
[0,"BLACK",0.1,3] call BIS_fnc_fadeEffect; 
_x SetPos ((getPos t1) vectorADD ([random[0, 12.5, 25], random[-1.5, 0, 1.5], 0]));
[1, "BLACK",5,1] call BIS_fnc_fadeEffect;
0=[[["near the coast... ","align = 'center' size = '0.7' font='PuristaBold'"],["","<br/>"],["5 days later","align = 'center' size = '0.7'","#aaaaaa"]]] spawn BIS_fnc_typeText2; 
}foreach allPlayers;

 

and this is in the Object Init

:

[this,["To U-Boat","scripts\teleport.sqf",[],1,false,true,"","_this distance _target < 3"]] remoteExec ["addAction",0, true];

Does anyone know what I'm doing wrong? I watched some youtube videos, but am new to scripting or mapping in general. Some insight if anyone has any would be really great. Thank you tons in advance.

Share this post


Link to post
Share on other sites

you need to remote exec your script to the server and your fade effects to the client

So in init.sqf put:

YourPrefix_fnc_teleportFade = {
	[0,"BLACK",0.1,3] call BIS_fnc_fadeEffect; 
 	player SetPos ((getPos t1) vectorADD ([random[0, 12.5, 25], random[-1.5, 0, 1.5], 0]));
 	[1, "BLACK",5,1] call BIS_fnc_fadeEffect;
	0=[[["near the coast... ","align = 'center' size = '0.7' font='PuristaBold'"],["","<br/>"],["5 days later","align = 'center' size = '0.7'","#aaaaaa"]]] spawn BIS_fnc_typeText2; 
};

YourPrefix_fnc_teleportPlayersToSub = {
	setDate [2012, 9, 1, 4, 30]; 
	0 setFog [0.4, 0.1, 25]; 
	[] remoteExecCall ["YourPrefix_fnc_teleportFade", 0];
};

And make your addaction the following:

this addAction ["To U-Boat",{[] remoteExec ["YourPrefix_fnc_teleportPlayersToSub", 2]},[],1,false,true,"","_this distance _target < 3"];

The init of a vehicle is executed every time someone joins, so you don't need to remote exec there (iirc)

 

Untested.

Share this post


Link to post
Share on other sites

Thanks for the input!

 

Toyed around with it a bit and some help from others. This is the fix I implied:

 

Into the Object Init, I put:

 

this addAction [ "To U-Boat", { [[], "scripts\teleport.sqf"] remoteExec ["execVM", 2]; }, [],1,false,true,"","_this distance _target < 3" ];

this addAction
[
  "To U-Boat",
  {
    [[], "scripts\teleport.sqf"] remoteExec ["execVM", 2];
  },
[],1,false,true,"","_this distance _target < 3"
];

 

teleport.sqf as follows:

 

setDate [2012, 9, 1, 4, 30];
[0, [0.4, 0.1, 25]] remoteExec ["setFog"];

[0, "BLACK", 0.5, 3] remoteExec ["BIS_fnc_fadeEffect"];
sleep 0.5;
{
  _x setPos (getPos t1 vectorAdd [random [0, 12.5, 25], random [-1.5, 0, 1.5], 0]);
} forEach allPlayers;
[1, "BLACK", 5, 1] remoteExec ["BIS_fnc_fadeEffect"];
[
  [
    ["near the coast... ", "align='center' size='0.7' font='PuristaBold'"],
    ["", "<br/>"],
    ["5 days later", "align='center' size='0.7'", "#aaaaaa"]
  ]
] remoteExec ["BIS_fnc_typeText2"];

In case someone has a smiliar problem.

 

Thank you again for your input!

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

×