Jump to content

Recommended Posts

Hello all,

 

I have just had a problem arise, and I have no idea why it is happening... 

Everything inside SFCutscene.sqf after the ExecVM "Scripts\SFInteraction.sqf" is working fine.

 

On trigger activation is this:

null = [] spawn {   
     
 ["Scripts\ArriveBackAtLocation2.sqf"] remoteExec ["ExecVM"]; 
 SF disableAI "ALL";   
 G1 lookAt player;   
 G2 lookAt player;   
 SF switchMove "Acts_ComingInSpeakingWalkingOut_1";   
 sleep 6.600;   
 SF playMove "Acts_ComingInSpeakingWalkingOut_2";   
 sleep 2.532;   
 SF enablesimulation false;   
 sleep 0.001;   
   
 ["Scripts\SFcutscene.sqf"] remoteExec ["execVM", 0, false];  
   
}; 

SFCutscene.sqf has this inside:

[west, ["Talk to the soldier"], ["Talk to the soldier", "Talk to the soldier", ""], [SF] ,true, 1, true, "", true] call BIS_fnc_taskCreate; 
  
  [   
     SF,              
     "Talk to Soldier",             
     "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",   
     "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",    
     "_this distance _target < 5",   
     "_caller distance _target < 5",         
     {},              
     {},                
     { 
		SF enablesimulation true; 
		player attachTo [SF, [0, 5, 0]]; 
		detach player; 
		player setDir 172; 
		
		private _camera = "camera" camCreate [0, 0, 0];
		_camera cameraEffect ["internal", "back"];
		_camera camPrepareTarget SF;
		_camera camPreparePos [5316.65, 5834, 1.6];
		_camera camPrepareFOV 0.75;
		_camera camCommitPrepared 0;
		
		[0,0,true,false] spawn BIS_fnc_cinemaBorder; 
		
		execVM "Scripts\SFInteraction.sqf";

		SF switchMove "Acts_ComingInSpeakingWalkingOut_2"; 
		sleep 2.532; 
		SF playMove "Acts_ComingInSpeakingWalkingOut_2"; 
		sleep 2.532; 
		SF playMove "Acts_ComingInSpeakingWalkingOut_3"; 
		sleep 9.532; 
		SF playMove "Acts_ComingInSpeakingWalkingOut_4";   
		sleep 12.836;   
		SF playMove "Acts_ComingInSpeakingWalkingOut_5";   
		sleep 2.267; 
		SF playMove "Acts_ComingInSpeakingWalkingOut_6";   
		sleep 10.905; 
		SF playMove "Acts_ComingInSpeakingWalkingOut_7";   
		sleep 6.666; 
		SF playMove "Acts_ComingInSpeakingWalkingOut_8";   
		sleep 3.400; 
		SF playMove "Acts_ComingInSpeakingWalkingOut_9";   
		sleep 4.899; 
		SF playMove "Acts_ComingInSpeakingWalkingOut_10";   
		sleep 2.666; 
		SF playMove "Acts_ComingInSpeakingWalkingOut_11";   
		sleep 7; 
			 
		cutText ["", "BLACK OUT", 7, false, false];  
		sleep 3;  
		playMusic "LeadTrack01_F"; 
		cutText ["", "BLACK FADED", 15, false, false];    
		 [  
		  [  
		   ["Operation Green Zone", "<br/ <t valign = 'top', <t align = 'Left' shadow = '1' size = '1.0'>%1</t>", 15],  
		   ["To be continued...", "<br/ <t valign = 'center', <t align = 'Left' shadow = '1' size = '1.0'>%1</t>", 15]  
		  ]  
		] spawn BIS_fnc_typeText;  
		 
			sleep 20;
			endMission "END1";  
     },       
     {},                
     [],                
     3,                
     0,                
     true,               
     false               
   ] remoteExec ["BIS_fnc_holdActionAdd", 0, SF]; 

The problem I am facing is that the:

execVM "Scripts\SFInteraction.sqf";

just isn't running... It was working fine earlier but now just magically stopped working.

 

Inside SFInteraction.sqf is:

null = [] spawn {
	
	["Maj. Briggs", "You Sgt. Richardson?"] spawn BIS_fnc_showSubtitle;
	sleep 2;
	
	["Sgt. Richardson", "Yes, sir. Whats the problem?"] spawn BIS_fnc_showSubtitle;
	sleep 2.1;
	
	["Maj. Briggs", "Sergeant, these captives are mine now. I need any intel you’ve acquired from them."] spawn BIS_fnc_showSubtitle;
	sleep 4;
	
	["Sgt. Richardson", "What? No, I am half way through an..."] spawn BIS_fnc_showSubtitle;
	sleep 1.5;
	
	["Maj. Briggs", "Did you not hear me Sergeant? They are mine now. Hand over any intel."] spawn BIS_fnc_showSubtitle;
	sleep 4;
	
	["Sgt. Richardson", "I don't have any physical intel."] spawn BIS_fnc_showSubtitle;
	sleep 4;
	
	["Maj. Briggs", "Are you sure?"] spawn BIS_fnc_showSubtitle;
	sleep 4;
	
	["Sgt. Richardson", "Yeah, of course im sure I dont have any intel! What do you want with them?"] spawn BIS_fnc_showSubtitle;
	sleep 4;
	
	["Maj. Briggs", "Need to know basis. this goes way higher than you Sergeant."] spawn BIS_fnc_showSubtitle;
	sleep 6;
	
	["Maj. Briggs", "Now back down. Am I clear?"] spawn BIS_fnc_showSubtitle;
	sleep 4;
	
	["Maj. Briggs", "I said am I clear, Sergeant?"] spawn BIS_fnc_showSubtitle;
	sleep 2.5;
	
	["Sgt. Richardson", "Yes, sir."] spawn BIS_fnc_showSubtitle;
	sleep 4;
	
	["Maj. Briggs", "Excellent."] spawn BIS_fnc_showSubtitle;
	sleep 10;
	
	["Maj. Briggs", "The guy is talking about a book, do you have it?"] spawn BIS_fnc_showSubtitle;
	sleep 2.2;
	
	["Sgt. Richardson", "A book? No, I dont have a book."] spawn BIS_fnc_showSubtitle;
	sleep 1.75;
	
	["Maj. Briggs", "Well... I hope you're not lying to me sergeant, or else you'll be fucked."] spawn BIS_fnc_showSubtitle;

};

 

 

Any Ideas?

 

TIA,

Aurora

Share this post


Link to post
Share on other sites

put a systemchat or hint before the execVM to be absolutely sure that the execution reaches there. same thing for others parts until you know how far it gets

Share this post


Link to post
Share on other sites

When you do this: null = [] spawn

you are creating a global variable 'null' that represents the handle and it's used multiple times above. That's a potential problem. You don't need to capture the handle unless you need to perform an action on it, such as scriptDone. Personally I do this: 0 = [] spawn, but only in triggers, and I'm not sure it's necessary anymore.

 

Do you have 'show script errors' checked when you load the game?

You can also check your error log which is the root of your profile directory for Arma.

 

If there's no other code inside 'SFInteraction.sqf' then get rid of the spawn inside it. ExecVM already spawns a new thread, and then you're spawning another thread inside that thread. Threads within threads.

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Remote executing an execution of an sqf is not the best idea.

Your sqf should become an homemade function from cfgFunctions in a description.ext, a config.cpp or an "included" .hpp. (see links)

This way the function is ready and you don't have to compile it. It's important when you call it multiple time or... when you remote execute it.

Some remote execution will never run in complex scenario, just because the scheduler will not achieve the code within a 3 ms/frame slot. There is no error, just an impossible timing.

Read also:

https://community.bistudio.com/wiki/Arma_3:_Functions_Library   Important!

https://community.bistudio.com/wiki/Mission_Optimisation  especially general script mistakes.

https://community.bistudio.com/wiki/Code_Optimisation

https://community.bistudio.com/wiki/Multiplayer_Scripting

 

Have fun!

 

  • Like 2

Share this post


Link to post
Share on other sites
On 3/8/2021 at 5:46 PM, AZCoder said:

0 = [] spawn

 Unfortunately, this didn't work.

 

On 3/9/2021 at 8:48 PM, pierremgi said:

Your sqf should become an homemade function from cfgFunctions in a description.ext

My first time ever doing this, so I may need a little bit of guidance.

So far I have this in my description.ext

class CfgFunctions
{
	class SFInteraction
	{
		class SFInteraction
		{
			class myFunction {file = "Scripts\SFInteraction.sqf";};
		};
	};
};

And I am calling it like this, inside an SQF.

[] call SFInteraction_fnc_myFunction;

But its not working, any advice?

 

TIA,

Aurora

Share this post


Link to post
Share on other sites

You must apply what is written in BIKI.

+ usually your tag is a short string like MGI (mine). say AURA for you. And this tag must be different from the classes myCategory and especially myFunction

So, example:

class CfgFunctions {

  class AURA {   // your tag

     class SFHolyCaterory { // to sort functions. Not used if you declare path from root to sqf

       class SFInteraction { file = "Scripts\fn_SFInteraction.sqf";}; // sqf name must have the fn_ prefix

     };

  };

};

Now your function is AURA_fnc_SFInteraction (should compile %ROOT%\Scripts\fn_SFInteraction.sqf)

Of course, your sqf must be renamed: fn_SFInteraction.sqf

  • Like 1

Share this post


Link to post
Share on other sites
15 hours ago, pierremgi said:

You must apply what is written in BIKI.

+ usually your tag is a short string like MGI (mine). say AURA for you. And this tag must be different from the classes myCategory and especially myFunction

So, example:

class CfgFunctions {

  class AURA {   // your tag

     class SFHolyCaterory { // to sort functions. Not used if you declare path from root to sqf

       class SFInteraction { file = "Scripts\fn_SFInteraction.sqf";}; // sqf name must have the fn_ prefix

     };

  };

};

Now your function is AURA_fnc_SFInteraction (should compile %ROOT%\Scripts\fn_SFInteraction.sqf)

Of course, your sqf must be renamed: fn_SFInteraction.sqf

 

I see. Thank you for explaining that.

I'll give it a go when I get home 🙂 

 

Share this post


Link to post
Share on other sites
On 3/8/2021 at 5:46 PM, AZCoder said:

That's a potential problem

It is not, there is absolutely nothing wrong in capturing return of the spawn command into a dummy global variable, please do not confuse people.

Share this post


Link to post
Share on other sites

@pierremgi I've put down what you've written but i'm getting an error when I try to execute it.

 

The error comes from SFcutscene.sqf and I believe its how I am calling the function:

[] call AURA_fnc_SFInteraction;

I have renames my SFInteraction.sqf to fn_SFInteraction.sqf.

I have also put this in the description.ext:

class CfgFunctions
{
	class AURA
	{
		 class SFHolyCaterory
		 {
			class SFInteraction { file = "Scripts\fn_SFInteraction.sqf";};
		 };
	};
};

Also, this needs to be exectued for everyone in the mission so needs to be remoteExec... I have given it a go but no subtitles show...

["Scripts\fn_SFInteraction.sqf"] remoteExec ["call"]; 

Also I get an error from ["call"];

Share this post


Link to post
Share on other sites
26 minutes ago, Aurora152 said:

Also, this needs to be exectued for everyone in the mission so needs to be remoteExec... I have given it a go but no subtitles show...


["Scripts\fn_SFInteraction.sqf"] remoteExec ["call"]; 

Also I get an error from ["call"];

call command doesn't accept path to a function.

Also, you already added your function into function library, so use this code:

remoteExec ["AURA_fnc_SFInteraction"];

 

  • Like 1

Share this post


Link to post
Share on other sites

Forget the sqf (fn_SFInteraction.sqf), the function now does the job! (AURA_fnc_SFInteraction)

 

You can remoteExec it as Schatten wrote. But you can't call it or remoteExecCall it because your function has sleep commands, so it must run in scheduled environment.

Note: I don't understand why you want to remoteExec such dialogs.

  • Like 1

Share this post


Link to post
Share on other sites
3 hours ago, pierremgi said:

Note: I don't understand why you want to remoteExec such dialogs.

 

This is running on a dedicated server, and the cutscene needs to be for everyone. Just wanted to make sure that everyone can see it 🙂

 

Share this post


Link to post
Share on other sites

In this case, a simple trigger (not server only) could run the code on each PC without any heavy net resource execution (trigger activation excepted)....

 

But I see you'd rather fire this code from an holdActionAdd BI function, so something local by one of the players. No problem. Instead of remote executing all this stuff, you just have to publicVariable a variable:

something like:

letsHaveTalk = TRUE; publicVariable "letsHaveTalk";

 

Then, in your sqf (so, in your own AURA function) you just have to add a first line:
waitUntil {sleep 1; !isNil "letsHaveTalk"};

<any stuff here>;

 

now, the function must run from init.sqf or, best, from initPlayerLocal.sqf (at root), like this way:

[] spawn AURA_fnc_SFInteraction;

 

When you create a function in description.ext (or config.cpp, for addon), everybody can run this code, waiting for the variable letsHaveTalk locally defined (not nil and broadcast with a value, like true or anything else). Here, any JIP can see the result at start, if the event occurred before they joins. (you can kill the process if not needed)

Share this post


Link to post
Share on other sites

Hello!

 

I want to make an air supply in a ww2 mission. Germans are outflanked in the Demyansk pocket and Luftwaffe give them supply . Unfortunatly Ju 52 diseppar from any ww2 mods so I have to use Dakotas. The planes will drop 20 german canisters. I'm using a trigger when the planes reach an area, it's activate the following execVM script (my friend recommended this):

 

_para = createVehicle ["B_Parachute_02_F", [0,0,1700], [], 0, ""];
_para setPosATL (player modelToWorld[0,0,2000]);
obj1 attachTo [_para,[0,0,0]]; 


WaitUntil {((((position obj1) select 2) < 0.6) || (isNil "_para"))};
detach obj1;
obj1 SetVelocity [0,0,-5];
sleep 0.3;
obj1 setPos [(position obj1) select 0, (position obj1) select 1, 1];
obj1 SetVelocity [0,0,0];

 

"obj1" is the 1st canister.  It's working, but only with 1st canister. If I change the "obj" variables, the script didn't work with other canisters only the 1st one. I try with 2 scripts in one sqf file, i try with 2 files don't work too. I try with 1 and 2 triggers don't work.

 

What I have to do I I want to drop my all (20) canisters?

Share this post


Link to post
Share on other sites

 hello @Herbert Sobel    First of all, don't post anywhere! You have to create your own topic. That's basic. So I will not answer here.

  • Like 1

Share this post


Link to post
Share on other sites
  • Okay, so from what I can gather, I need to put: 
letsHaveTalk = TRUE; 
publicVariable "letsHaveTalk";

instead of my:

remoteExec ["AURA_fnc_SFInteraction"];

in the SFCutscene.sqf. 

 

  • Then, I put:
[] spawn AURA_fnc_SFInteraction;

in my Init.sqf.

 

  • Lastly, at the top of fn_SFInteraction.sqf, I put:
waitUntil {sleep 1; !isNil "letsHaveTalk"};

for a start condition for the script?

 

I'm a little confused about the first point with the publicVariable but I think I understand the reasoning behind the other points.

As I understand it, the second point initialises at the start, but will wait until the condition in the waitUntil is true before triggering?

Then, the waitUntil is just a loop with a condition, which waits until "LetsHaveTalk" is true before continuing?

 

I really appreciate you going through this with me, I can't thank you enough. 🙂

 

Share this post


Link to post
Share on other sites

Yes, the function is spawned from init.sqf or initPlayerLocal.sqf (better)

The waitUntil is a lazy loop (slept) waiting for a variable existing on local PC (it's a global one in term of script, a local one in term of PC)

As you holdActionAdd code triggers locally (on caller's PC), if you don't publicVariable it (public means global and shared), the variable exists only on the caller's PC (not broadcast). As soon as the variable is public, the waitUntil is OK on each PC, so the script continues on each PC.

In fact, the whole stuff is ready on each PC (normal, you started a function, present on each PC), and you just have to share a common "flag", like !isNil "someVariable". It's fine for resource and broadcast flow. When you remoteExec something, you broadcast a string which can be long, not saying the job to do with, once sent.

  • Like 1

Share this post


Link to post
Share on other sites

Still having problems... Are you able to have a quick check whether i've got everything set up correctly.

 

In SFCutscene.sqf I have the publicVariable in like this:

...
		SF_1 setPos [5318.653, 5829.094, 0]; 
		boy1 setPos [5318.653, 5829.094, 0]; 
		SF_1 switchMove "Acts_Abuse_abusing"; 
		Boy1 switchMove "Acts_Abuse_abuser"; 
		SF_1 setDir 90;
		boy1 setDir 90;
		
		letsHaveTalk = TRUE; 
		publicVariable "letsHaveTalk";

		SF switchMove "Acts_ComingInSpeakingWalkingOut_2"; 
		sleep 2.532; 
		SF playMove "Acts_ComingInSpeakingWalkingOut_2"; 
		sleep 2.532; 
		SF playMove "Acts_ComingInSpeakingWalkingOut_3"; 
		sleep 9.532; 
		SF playMove "Acts_ComingInSpeakingWalkingOut_4";   
...

Then in the fn_SFInteraction.sqf I have this:

[] spawn {
	
	waitUntil {sleep 1; !isNil "letsHaveTalk"};
	
	["Maj. Briggs", "You Sgt. Richardson?"] spawn BIS_fnc_showSubtitle;
	sleep 2;
	
	["Sgt. Richardson", "Yes, sir. Whats the problem?"] spawn BIS_fnc_showSubtitle;
	sleep 2.1;
  
  ...

In the description.ext I have this:

class CfgFunctions
{
	class AURA
	{
		 class SFHolyCaterory
		 {
			class SFInteraction { file = "Scripts\fn_SFInteraction.sqf";};
		 };
	};
};

And lastly, in the Init.sqf I have this:

[] spawn AURA_fnc_SFInteraction;

Still no subtitles showing...

Share this post


Link to post
Share on other sites

place 2 simple hints before and after the waitUntil. Try to chase where the problem is. I can't help with bits of code, untested paths, unknown mods (I hope you're testing in Vanilla Arma), and scenario context. Try in SP then in MP.

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

×