Jump to content
  • 0

Trying to do my own little Mission


Sandbird

Question

I've got Missions working on my test server but i want to create a small custom event as well that will run at random intervals, but i cant get the server to run it.

Following the code in Missions i started creating the following stuff. (the black stuff were already done by Missions, the red stuff are mine).

Basically in my dayz_server i got 1 folder called custom.

In it i got 2 files:   script.sqf and scriptinit.sqf

 

Step 1

Edit the "server_functions.sqf" file, and find this line:

fnc_plyrHit   = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\fnc_plyrHit.sqf";

Add this line directly below it:

fnc_hTime = compile preprocessFile "\z\addons\dayz_server\Missions\misc\fnc_hTime.sqf";

Then find this in the same file:

dayz_recordLogin = {
    private["_key"];
    _key = format["CHILD:103:%1:%2:%3:",_this select 0,_this select 1,_this select 2];
    _key call server_hiveWrite;
};

And add this directly below it:

  MyCustomScript = 0;
    if (isServer) then {
    [] execVM "\z\addons\dayz_server\custom\script.sqf"; //Starts my mission system
    };
 

 

In script.sqf i got:

if(!isServer) exitWith {};
private ["_unit","_message","_locationPlayer"];
[] execVM "\z\addons\dayz_server\custom\scriptinit.sqf";
WaitUntil {MyCustomScript== 1};
[nil,nil,rTitleText,"====== Hello World ======", "PLAIN",2] call RE;
diag_log ("EVENT: FINISHED RUNNING");
MyCustomScript = 0;

and my scriptinit.sqf:

_wait = [60,70] call fnc_hTime;
sleep _wait;
MyCustomScript = 1;

Step 2.

Copy the FILE: faction.sqf from the zip file at step 1. into the same folder as where you have put the debug folder.


Step 3.

Edit the file called "init.sqf" in the same folder as were you copied the faction.sqf,,,and exec the factions.sqf

 

 

 

Now.....since i am using Missions which is already working fine, the factions.sqf script should be enough to show my Hello World on the screen.

But its not working....I dont even see the EVENT: FINISHED.... in the log file....so my script is not working...and i got no idea why !?!

It looks fine to me.

How come the missions script is running and mine isnt ?

 

I know that i could use epoch_events to do the same thing....BUT i have a huge problem with showing text on the screen the way i want it....

I know there is a 'hack' you include in the init.sqf that sorta fixes this...but it really isnt. It works for hint and maybe with adding a function to it i can get titletext to show...But why try with a hack...when i can get the real thing. Missions make it work just fine....why is it that i cant 'tap' into the same way and do mine as well.

 

Any help ?

-Thanks

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Are you sure your fnc_hTime is returning a value ?

 

Also using scriptDone might be a better way of detecting if scriptinit.sqf is finished (http://community.bistudio.com/wiki/scriptDone).

 

Though waitUntil is not the best way as it runs on every tick, so  at 50fps it will loop 50 times a second, loads of these will eventually add to server lag..

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...