Jump to content
Rosso777

[SOLVED] Running scripts server side (a 2nd initServer)

Recommended Posts

In my initServer.sqf file (mission folder), I have a collection of simple objects:

 

private _vehicles = [
["Land_Hotel", [1281.08, 1067.3, 22.8993], [-0.99999, -0.00458476, 0], [0, 0, 1], false],
["Land_Hotel", [1281.29, 1025.94, 22.9204], [-0.999989, -0.00458476, 0.00109177], [0.00109178, 0, 0.999999], false],
["Land_Hotel", [1280.66, 1150.06, 22.9], [-0.999989, -0.00458476, -0.00109182], [-0.00109183, 0, 0.999999], false]

(this is just a tiny sample)

 

I am wondering if there is a way to run a second file similar to this format but from the actual server? For instance, I run most of my .sqfs from the server with:
[] execVM "\server\scripts\boathouse.sqf"; (listed in the initServer.sqf)

 

I would like to move this massive file (5 MB) to the server so it's not continuously downloaded with the mission file. Is this possible?
 

[SOLVED]:

I created a folder in my server's root directory called server, then created a subdirectory named scripts. Inside that folder is a file named island.sqf:

Spoiler


ExileRouletteChairs = [];
ExileRouletteChairPositions = [];

// 17,581 Vehicles
private _vehicles = [
["t_Ficus_small_F", [568.887, 1097.81, 20.099], [0.151047, 0.988527, 0], [0, 0, 1], false],
["t_Ficus_small_F", [608.895, 1063.99, 20.1387], [-0.943487, 0.331409, 0], [0, 0, 1], false],
["t_Agathis_wide_F", [1276.65, 1024.78, 21.969], [-0.924289, -0.381694, 0], [0, 0, 1], false],
["t_Agathis_wide_F", [1269.38, 1020.6, 21.9684], [0.856827, -0.515603, 0.00093551], [-0.00109183, 0, 0.999999], false]
];

{
    private _vehicle = (_x select 0) createVehicle (_x select 1);
    _vehicle allowDamage false;
    _vehicle setPosWorld (_x select 1);
    _vehicle setVectorDirAndUp [_x select 2, _x select 3];
    _vehicle enableSimulationGlobal (_x select 4);
    _vehicle setVariable ["ExileIsLocked", -1, true];
    
    if (_vehicle isKindOf "Exile_RussianRouletteChair") then
    {
        ExileRouletteChairs pushBack _vehicle;
        ExileRouletteChairPositions pushBack [_x select 1, getDir _vehicle];
    };
}
forEach _vehicles;

// 7 Simple Objects
private _invisibleSelections = ["zasleh", "zasleh2", "box_nato_grenades_sign_f", "box_nato_ammoord_sign_f", "box_nato_support_sign_f"];
private _simpleObjects = [
["a3\vegetation_f_exp\tree\t_ficus_small_f.p3d", [1431.57, 877.822, 20.0061], [0, 1, 0], [0, 0, 1]],
["a3\vegetation_f_exp\tree\t_ficus_small_f.p3d", [1241.2, 871.944, 20.021], [0, 1, 0], [0, 0, 1]],
["a3\vegetation_f_exp\tree\t_ficus_small_f.p3d", [1433.41, 854.71, 20.0121], [0, 1, 0], [0, 0, 1]],
["a3\structures_f\civ\camping\sleeping_bag_f.p3d", [1426.6, 1135.17, 15.3638], [0, 1, 0], [0, 0, 1]],
["a3\structures_f\civ\garbage\garbage_square3_f.p3d", [1427.24, 1136.11, 15.3899], [0, 1, 0], [0, 0, 1]],
["a3\structures_f\civ\garbage\garbage_square5_f.p3d", [1429.48, 1134.04, 15.3761], [0, 1, 0], [0, 0, 1]],
["a3\structures_f\civ\garbage\garbage_line_f.p3d", [1423.34, 1134.58, 15.3931], [0, 1, 0], [0, 0, 1]]
];

{
    private _simpleObject = createSimpleObject [_x select 0, _x select 1];
    _simpleObject setVectorDirAndUp [_x select 2, _x select 3];
    
    {
        if ((toLower _x) in _invisibleSelections) then 
        {
            _simpleObject hideSelection [_x, true];
        };
    }
    forEach (selectionNames _simpleObject);
}
forEach _simpleObjects;

 

sleep 10;
[] execVM "\server\scripts\RemoteIslandTroops.sqf";

 

This was created using the Exile 3Den plugin, specifically the create initServer feature. The false that I highlighted at the end of each line means that the simulation has been disabled and the objects will take significantly less resources (since this file contains 17,000+ trees/bushes on a small island). I still maintain steady FPS numbers on the server even though I've added in this many objects.

 

Additionally, the last couple lines:
sleep 10;
[] execVM "\server\scripts\RemoteIslandTroops.sqf";


were added because I included some buildings in the original file and wanted to ensure the buildings loaded BEFORE the AI that would be inside/on top of them would. Hope this all helps someone.

Share this post


Link to post
Share on other sites

Yes you can. But if your objects file is 5MB your server will run like crap with that many objects.

Share this post


Link to post
Share on other sites
3 minutes ago, El' Rabito said:

Yes you can. But if your objects file is 5MB your server will run like crap with that many objects.


Correction: The initServer is currently 1.5 MB.  So how do I go about making a 2nd file like this (using that type of object list's format) that can be run from the server?

Share this post


Link to post
Share on other sites

×