Jump to content
wingnutwn

CAS being called from cfgCommand

Recommended Posts

Hoping one of you pro-programmers can help me out. I'm trying to call (3) different cas types in MP from the CFGCommand menu. This works great from launching a server from EDEN but once it goes dedicated not so much.

INIT.SQF

wncas2 = [
["Cas",false],
["CAS Gun and Run",[2],"",-5,[["expression","[cursorTarget,300,'B_Plane_CAS_01_F',0] execVM 'scripts\casgun.sqf';"]],"1","1"],
["CAS Gun and Missle",[3],"",-5,[["expression","[cursorTarget,300,'B_Plane_CAS_01_F',1] execVM 'scripts\casgr.sqf';"]],"1","1"],
["CAS Missle",[4],"",-5,[["expression","[cursorTarget,300,'B_Plane_Fighter_01_Stealth_F',2] execVM 'scripts\casmissle.sqf';"]],"1","1"]
];



CASGUN.SQF

hint "CAS Gun and Run Strike inbound!";

_position = screenToWorld [0.5,0.5];
_direction = round(random 360);


_logic = "Logic" createVehicleLocal _position;
_logic enableSimulationGlobal false; _logic hideObjectGlobal true;
_logic setDir _direction;
_logic setVariable ["vehicle",_vehicle];
_logic setVariable ["type",_type];


[_logic,nil,true] spawn BIS_fnc_moduleCAS;

[_logic] Spawn {
sleep 5;
deleteVehicle (_this select 0);



Yeah I know my coding and formatting is terrible - I'm old. I have tried using remoteExec and remoteExecCall again it works great locally. This idea stems from Xeno's domination scripts which are way over my paygrade.

 

And now that I'm posting this I'm missing a } at then end - would that break it?

 

Thanks for any suggestions.

Share this post


Link to post
Share on other sites
20 hours ago, wingnutwn said:

And now that I'm posting this I'm missing a } at then end - would that break it?

Sorry, I can't help ya with your quest, but for sure if you open a {"whatever-in"} you have to close it, followed by";" in your case.

ps: I'm old too brotha (probably even older than you😢😉😂)... let's keep up with this youngster😜!

 

ps2: after checking your code, I found a few notorious forum-bug "red dots". If you "copy-paste" codes from the forum, ALWAYS run them through the CODE button in the reply window.

Share this post


Link to post
Share on other sites

BIS_fnc_moduleCAS exits if it is not run on the server. By the very nature of a commandingMenu, a gui, must be shown on a client. So you need to remoteExec from the expression field in your menu items so the function is run on the server.

["CAS Gun and Run",[2],"",-5,[["expression","[[cursorTarget,300,'B_Plane_CAS_01_F',0],'scripts\casgun.sqf'] remoteExec['BIS_fnc_execVM',2];"]],"1","1"],

 

  • Thanks 1

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

×