Jump to content
  • 0

Question: How to call Crash_spawner.sqf from within another script (ServerSide)


MatthewK

Question

Scenario: I'm running a script on my server (server.pbo) that randomly runs a set of missions, one of these is the crash_spawner with a simple map marker added. (I do it this way because I have over 30 missions now and the epoch event init was getting too full).

My question is this: How do I properly call the file from the script, is it:

nul = [] execVM ="filename.sqf";

or simply:

execVM = "filename.sqf";

Also, do I need to set a isServer condition anywhere, because when I call this script from within another script on my server my report file gets filled errors. But if i run it through the Epoch event init , it works fine ..

Just a little tired and a little confused lol

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

Does running it like this make any difference ?

_handle = [] execVM "\z\addons\dayz_server\modules\crash_spawner2.sqf"

Can't test it at the moment as my server is full..

Just wondering, because that's how the scripts are called in the epoch events script handler.

Link to comment
Share on other sites

  • 0

I think this would work just fine if your calling script is in server.pbo,

I use the missions script (server side)

and a sqf in my server.pbo call this line :

_aispawn = [_coords,80,6,6,1] execVM "\z\addons\dayz_server\missions\add_unit_server.sqf";//AI Guards 

but I have no idea if it's gonna work for a script in mission.pbo

 

In theory the server run mission.pbo too since init.sqf contain

if (isDedicated) then

By the way I use in my server.pbo this :

_coords =[Marker1,false] call SHK_pos;

it works and SHK_pos is located in dayz_mission\addons\SHK  folder

(in SHK_pos_init.sqf to be accurate) 

Link to comment
Share on other sites

  • 0

Hi Granok, I'm sorry but your reply has confused me. I'm not sure what exactly you're trying to tell me. Basically, just to clarify my problem..

In my mission.pbo init.sqf I call the script "487mission.sqf" via the Epoch Events every 10 minutes.

The script is loaded and at random it picks one of 30 custom missions which are all inside that one file.. (This part is irrelevant as those missions work fine) ...

If the script is called again but one of those 30 missions is still running I want the script to run one of the default Epoch scripts crash_spawner and supply_drop ... this is how I'm doing it:

 

if (MissionActive) exitWith { 
            diag_log("Mission Status Check: A mission is still running!");
			
		_rndOtherMission = floor(random 5);
		
			switch (_rndOtherMission) do
                {
 case 0: 
 {  diag_log("487Mission: No Beans!"); };

case 1: 
 { _handle = [] execVM "\z\addons\dayz_server\modules\supply_drop.sqf"; };
     
case 2: 
 {  diag_log("487Mission: No Beans!"); };
     
	  
case 3: 
 { diag_log("487Mission: No Beans!"); };
      

case 4: 
 { _handle = [] execVM "\z\addons\dayz_server\modules\crash_spawner.sqf"; };
     
			};
			}; 
Whenever I run those scripts like this, I get errors in my report file and they dn't run.. The exact same scripts, untouched, run perfectly using the Epoch Events.. 

 

So my question is , what am I doing wrong ? lol 

Link to comment
Share on other sites

  • 0

First of all sorry for my bad english this is certainly why my post confused you ^^

I was telling you that you can call a sqf located in dayz_mission from a script located in dayz_server 

but I wasn't sure the reverse was possible.

 

Second of all,

why not move the 487mission.sqf's file into dayz_server ?

If i understood correctly the purpuse of 487mission.sqf is to pick a mission randomly ?

I use a script mission file I found here : http://dayzepoch.com/forum/index.php?/topic/2611-sarge-ai-epoch-edition-mission-system-26-missions/

I think it should be pretty similar to yours and all the mechanics are serverside 

 

Instead of calling the file with init.sqf,

 

they call the file with server_function.sqf 

 if (isServer) then {
    [] execVM "\z\addons\dayz_server\missions\major\SMfinder.sqf";
}

SMfinder.sqf

if(!isServer) exitWith {};
private ["_numb","_element","_num","_firstRun"];

if(isNil {ReAccur}) then { ReAccur = ["SM1","SM2","SM3","SM4","SM5","SM6","SM7","SM8","SM9","SM10"];};
if(isNil {SMCarray}) then { SMCarray = [];};
if (count SMarray == 0) then
{
_element = ReAccur call BIS_fnc_selectRandom;
} else {
_numb = count SMarray;
_num = floor (random _numb);
_element = SMarray select _num;
_Earray = [_element];
};

[] execVM format ["\z\addons\dayz_server\missions\major\%1.sqf",_element];
Link to comment
Share on other sites

  • 0

This may not be the easiest way, but it works for me :).

 

By the way, maybe the crash_spawner.sqf and supply_drop.sqf needs parameters to work !

Like that :

_handle = ["Param1",param2,parameter3] execVM "\z\addons\dayz_server\modules\supply_drop.sqf"

EDIT :I had a quick look and it seems they don't need any parameters but i'm not an expert

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...