Jump to content

Recommended Posts

Hi together,

 

I am a scripting beginner and am trying to learn from problem delivery to problem delivery. after a few days of research and a lot of trying, i've reached a point where i just can't figure it out anymore and every reading leads to more confusion and so i'm asking for your support.

 

Scenario: a SOG CDLC Jet is connected to a Multiplayer Respawn Module. After destruction and respawn, two addactions should be attached, Nightvision and Thermal should be switched off (also with regard to other Jets of Unsung Mod etc.) and a function that defines the group membership in the Mike Force script should be executed. My two .sqf are still rudimentary at this point and I will only continue to build them once I have solved the problem of execution. It currently works in the SP / Selfhosted but not on the Dedicated Server.

 

I have both the way of directly executing the code in the expression of the respawn module and calling it from an external .sqf via remoteEexec.

That means I have:

- a locality problem

- it is not clear to me whether my variable from the editor is retained after respawn or whether it has to be reassigned and so I had a failure because of doubling the params for new and old vehicle

 

 

Init Vehicle (not Init Respawn Module - works on Dedicated by start):

Spoiler

//veh Init Feld

this disableTIEquipment true;

this disableNVGEquipment true;

this addAction ["Flugzeug drehen","umdrehen.sqf",nil,1.5,true,true,"","true",10,false];

this addAction ["<t color='#ebeb00'>Exit", "exit.sqf",nil,1.5,true,true,"","true",10,false];

call{[this, ["GreenHornets"]] call vn_mf_fnc_lock_vehicle_to_teams}

 

First Version Expression Field Resspawn Module - Direct Code :

Spoiler

if (isServer) then {params ["_newVeh","_oldVeh"];

_newVeh setVehicleVarName "F1";

F1 = _newVeh; publicVariable "F1";

_newVeh disableTIEquipment true;

_newVeh disableNVGEquipment true;

_newVeh addAction ["Flugzeug drehen","umdrehen.sqf",nil,1.5,true,true,"","true",10,false];

_newVeh addAction ["<t color='#ebeb00'>Exit", "exit.sqf",nil,1.5,true,true,"","true",10,false];

call{[_newVeh, ["GreenHornets"]] call vn_mf_fnc_lock_vehicle_to_teams}};

 

Second Version Expression Field Resspawn Module - calling a .sqf:

Spoiler

params ["_newVeh","_oldVeh"]; [[_newVeh, _oldVeh], "newf1.sqf"] remoteExec ["execVM", 2];

 

Content of umdrehen.sqf (not urgent but for "awareness"):

Spoiler

_richtung = getDir f1;

_grad = 90.000;

//hint format ["Richtung: %1", _richtung];

//sleep 5;

//hintSilent "";

_richtung = _richtung + _grad;

//sleep 5;

//hint format ["Richtung: %1", _richtung];

//sleep 5;

hint format ["Zuruecktreten %1. \n Flugzeug dreht sich um 90 Grad", name player];

sleep 3;

hintSilent "";

f1 setDir _richtung;

f1 setPosWorld getPosWorld f1;

sleep 1;

 

Content of exit.sqf (not required but for "awareness"):

Spoiler

_gunner = gunner F1;

_gunner moveOut F1;

 

Content of newf1.sqf (maybe required, belongs to variabel and calling condition):

Spoiler

params ["_newVeh","_oldVeh"];

_newVeh setVehicleVarName "F1";

F1 = _newVeh;

publicVariable "F1";

F1 disableTIEquipment true;

F1 disableNVGEquipment true;

F1 addAction ["Flugzeug drehen","umdrehen.sqf",nil,1.5,true,true,"","true",10,false];

F1 addAction ["<t color='#ebeb00'>Exit", "exit.sqf",nil,1.5,true,true,"","true",10,false];

call{[F1, ["GreenHornets"]] call vn_mf_fnc_lock_vehicle_to_teams}

 

Thank you very much in advance for your thoughts, suggestions and support.

 

 

Share this post


Link to post
Share on other sites

Hello,

instead of :

_newVeh setVehicleVarName "F1";

F1 = _newVeh;

publicVariable "F1"

 

try:

[_newVeh,"F1"] remoteExec ["setVehicleVarName",0,_newVeh];

missionNameSpace setVariable ["F1",_newVeh,TRUE];

 

in your umdrehen.sqf, setPosWorld is GA GE so it's fine for all players. On the other hand, setDir is LA GE. That means, even if the effect is global, the argument must be applied where the F1 object is owned. In your case probably on server, not on action caller's PC.

So, replace :

f1 setDir _richtung;

by:

[F1,_richtung] remoteExecCall ["setDir",F1];

 

 

 

  • Thanks 1

Share this post


Link to post
Share on other sites

Hi, thank you @pierremgi for your help. I get the idea behind it and it seems to be working.

 

After vehicle resapawn, I couldn't get into the vehicle because the Mike Force Script creates a group I didn't belong to for testing.

But the addactions on the respawn vehicle are not visible on the dedicated. I have to think again here.

 

For my umdrehen.sqf the variant with remoteExecCall is a bit confusing. The vehicle is clearly displayed next to the position and then "pulled" into the correct start position for approx. 1 second. This triggers an explosion when spawning in a hall. My setposworld getposworld variant works "smoother" there.

 

But as I said, thank you very much and maybe you still have an idea for making the addactions global.

Share this post


Link to post
Share on other sites

Thank you again, because "rework" was successfully used in our Mike Force mission on Saturday.

 

While observing, I noticed that the moment the old vehicle is deleted and the new one spawns, the spawn point does not match exactly with old position at the moment the new vehicle is beeing created. Sometimes the vehicle is spawned a vehicle length in front of, behind or next to it, which is of course problematic if you spawn jets in a hall, for example. These then explode immediately and only after 5 - 10 further explosions do you stand correctly.

 

But I only noticed that on the Dedicated, not on the Eden Selfhost. For the next campaign it will probably make more sense to write a respawn script yourself and not use the module.

Share this post


Link to post
Share on other sites
40 minutes ago, SirBassi said:

While observing, I noticed that the moment the old vehicle is deleted and the new one spawns, the spawn point does not match exactly with old position at the moment the new vehicle is beeing created. Sometimes the vehicle is spawned a vehicle length in front of, behind or next to it, which is of course problematic if you spawn jets in a hall, for example. These then explode immediately and only after 5 - 10 further explosions do you stand correctly.

 

But I only noticed that on the Dedicated, not on the Eden Selfhost. For the next campaign it will probably make more sense to write a respawn script yourself and not use the module.

 

Yes, that's one of the multiple reasons I wrote and shared my own module for vehicle respawn. One of these issues was respawning jets and UAV on USS carrier.

Share this post


Link to post
Share on other sites

Oh, sounds interesting for further missions / campaings. May you post the Link for your shared Modul? Thanks a lot.

 

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

×