Day and Weather scritp DayZ Standalone

  • DEFINE VARIABLES
    //////////////////////////////////////////////////
    _p1 = 1;
    _p2 = 1;


    if (isMultiplayer) then
    {
    _p1 = paramsArray select 0;
    _p2 = paramsArray select 1;
    };


    //////////////////////////////////////////////////
    // GLOBAL WIND SETTINGS
    //////////////////////////////////////////////////
    if (isServer) then
    {
    if (isNil "MdhDwWx") then
    {
    MdhDwWx = (switch (_p2) do
    {
    case 1: {(-10+(random 20))};
    case 2: {((-0.5)+(random 1))};
    case 3: {(-1+(random 2))};
    case 4: {(-2.5+(random 5))};
    case 5: {(-5+(random 10))};
    case 6: {(-10+(random 20))};
    });

    publicvariable "MdhDwWx";
    };


    if (isNil "MdhDwWy") then
    {
    MdhDwWy = (switch (_p2) do
    {
    case 1: {(-10+(random 20))};
    case 2: {((-0.5)+(random 1))};
    case 3: {(-1+(random 2))};
    case 4: {(-2.5+(random 5))};
    case 5: {(-5+(random 10))};
    case 6: {(-10+(random 20))};
    });

    publicvariable "MdhDwWy";
    };


    //////////////////////////////////////////////////
    // SERVER DAYTIME SETTINGS
    //////////////////////////////////////////////////
    switch (_p1) do
    {
    case 1: {skiptime (ceil random 96)};
    case 2: {setDate [2020, 7, 25, 4, 0]};
    case 3: {setDate [2020, 7, 25, 5, 0]};
    case 4: {setDate [2020, 7, 25, 12, 0]};
    case 5: {setDate [2020, 7, 25, 20, 0]};
    case 6: {setDate [2020, 7, 25, 1, 0]};
    case 7: {setDate [2020, 7, 20, 1, 0]};
    case 8: {setDate getSystemTime;};
    };
    //////////////////////////////////////////////////
    // SERVER WEATHER AND RAIN SETTINGS
    //////////////////////////////////////////////////
    if (isNil "MdhDwAktWeather") then
    {
    switch (_p2) do
    {
    case 1: {MdhDwAktWeather = random 1};
    case 2: {MdhDwAktWeather = 0};
    case 3: {MdhDwAktWeather = 0.25};
    case 4: {MdhDwAktWeather = 0.5};
    case 5: {MdhDwAktWeather = 0.75};
    case 6: {MdhDwAktWeather = 1};
    };

    0 setOvercast MdhDwAktWeather;
    0 setrain MdhDwAktWeather;
    publicvariable "MdhDwAktWeather";
    };
    };


    //////////////////////////////////////////////////
    // WAITUNTIL PLAYER EXISTS
    //////////////////////////////////////////////////
    if (!isDedicated) then
    {
    waitUntil {!(isNull player)};
    waitUntil {player == player};
    waitUntil {!isNil"MdhDwAktWeather"};
    };


    //////////////////////////////////////////////////
    // CLIENT WEATHER SETTINGS
    //////////////////////////////////////////////////
    sleep 1;
    0 setOvercast MdhDwAktWeather;
    sleep 1;


    //////////////////////////////////////////////////
    // CLIENT WETAHER SETTINGS FOR LONG TIME
    //////////////////////////////////////////////////
    36000 setOvercast MdhDwAktWeather;


    //////////////////////////////////////////////////
    // PERMANENT FORCED CLIENT WIND AND RAIN SETTINGS
    //////////////////////////////////////////////////
    while {!isNil"MdhDwAktWeather"} do
    {
    setwind [MdhDwWx,MdhDwWy,true];
    3 setrain MdhDwAktWeather;
    sleep 1;
    };


    Quelle: Mpmissioncache unter C:-benutzer-deinname-appdata-local-dayz


    ;D

    Einmal editiert, zuletzt von Adebar ()

  • Pff, du siehst pro Einstellung verschiedene Möglichkeiten genannt "Case"


    Vor dem "do" steht die Bedingung.


    Zum beispiel


    [Wert zum Auswerten (z.B. Nutzereingabe)] do


    case [Auswertung = 1] : {Auszuführende Anweisung}
    case [Auswertung = 2] : {Auszuführende Anweisung}


    Je nach dem welche Auswertung zutrifft wird die Anweisung nach dem Doppelpunkt ausgeführt.


    Noch fragen? :P

  • :P


    DAY&WEATHER SCRIPT PARAMETERS
    //////////////////////////////////////////////////
    class Params
    {
    class DayTime
    {
    //paramsArray[0]
    title = "Time Of Day";
    values[] = {1, 2, 3, 4, 5, 6, 7, 8};
    texts[] = {"Random", "Early Morning", "Morning", "Noon", "Sundown", "Night with Full Moon", "Dark Night", "Server Time"};
    default = 0;
    };

    class Weather
    {
    // paramsArray[1]
    title = "Weather:";
    values[] = {1, 2, 3, 4, 5, 6};
    texts[] = {"Random", "Clear", "Partly Cloudy", "Cloudy", "Overcast", "Storm"};
    default = 1;
    };
    };


    / START DAY&WEATHER SCRIPT
    ////////////////////////////
    execVM "Day&WheaterScript\DW_init.sqf";


    publicVariableServer "HighWater";
    publicVariableServer "HighEnergy";


    DZ_MP_CONNECT = true;
    DZ_MAX_ZOMBIES = 1000;




    //dbLoadHost;
    dbSelectHost "http://localhost:9090/DayZServlet/";


    DZ_spawnparams = [
    1 / 7.0, // SPT_gridDensity
    35.0, // SPT_gridWidth
    35.0, // SPT_gridHeight
    4.0, // SPT_minDist2Water
    20.0, // SPT_maxDist2Water
    30.0, // SPT_minDist2Zombie
    70.0, // SPT_maxDist2Zombie
    25.0, // SPT_minDist2Player
    70.0, // SPT_maxDist2Player
    0.5, // SPT_minDist2Static
    30.0, // SPT_maxDist2Static
    -0.785398163, // SPT_minSteepness
    +0.785398163 // SPT_maxSteepness
    ];


    DZ_spawnQuad0 = [
    [13608.1, 6062.31, 0.0014],
    [13587.1, 6095.31, -0.27] ,
    [13556.5, 6071.73, 0.0014],
    [13570.5, 6036.73, 0.0014]
    ];


    DZ_posbubbles = [
    [ 9765.67 , 1749.21 , 0.00176013] ,
    [ 10544.3 , 2003.19 , 0.000682116] ,
    [ 11076.8 , 2619.9 , 0.0010798] ,
    [ 11998 , 3400.88 , 0.00117755] ,
    [ 13502.3 , 3905.05 , 0.000827312] ,
    [ 13417.7 , 5449.19 , 0.00129318] ,
    [ 7118.22 , 7652.72 , 0.00143433] ,
    DZ_spawnQuad0,
    [ 13314.1 , 7041.18 , 0.00136793] ,
    [ 13115.5 , 7638.63 , 0.00145864] ,
    [ 13526.9 , 5096.7 , 0.00142241] ,
    [ 11569 , 3144.31 , 0.00150204] ,
    [ 11998.6 , 3780.79 , 0.00128365] ,
    [ 13362.8 , 5900.33 , 0.00143862] ,
    [ 13460.8 , 6598.57 , 0.001423]
    ];


    _createPlayer =
    {
    //check database
    _savedChar = dbFindCharacter _uid;
    _isAlive = _savedChar select 0;
    _pos = [_savedChar select 1,_savedChar select 2,_savedChar select 3];
    _idleTime = _savedChar select 4;


    //process client
    [_id,_isAlive,_pos,overcast,rain] spawnForClient {
    titleText ["","BLACK FADED",10e10];
    diag_log str(_this);

    _uid = getClientUID(owner _id);
    diag_log format["[INFO] Player %1 (%2) spawned new character",_id,_uid];
    debuglog ["[INFO] *** test ***"];

    playerQueueVM = _this call player_queued;


    0 setOvercast (_this select 4);
    simulSetHumidity (_this select 4);
    0 setRain (_this select 5);
    };
    };


    //DISCONNECTION PROCESSING
    _disconnectPlayer =
    {
    _agent action ["Eject", vehicle _agent];
    if ((lifeState _agent == "ALIVE") and (not captive player)) then {
    //execVM "waitScreen.sqf";
    _agent call dbSavePlayerPrep;
    dbServerSaveCharacter _agent;
    }
    else {
    dbKillCharacter _uid;
    _id statusChat["Player %1 was killed by %2",name _agent, name _killer];
    };


    deleteVehicle _agent;
    };


    // Create player on connection
    onPlayerConnecting _createPlayer;
    onPlayerDisconnected _disconnectPlayer;


    "clientReady" addPublicVariableEventHandler
    {
    _id = _this select 1;
    //_uid = getClientUID(owner _id);
    //diag_log format["[INFO] Player %1 (%2) ready to load previous character",_id,_uid];
    diag_log format["Player %1 ready to load previous character",_id];
    debuglog ["[INFO] *** test ***"];


    execVM "newdaytime.sqf";


    _handler =
    {
    if (isNull _agent) then
    {
    //this should never happen!
    diag_log format["Player %1 has no agent on load, kill character",_uid];
    _id statusChat ["Your character was unable to be loaded and has been reset. A system administrator has been notified. Please reconnect to continue.","ColorImportant"];
    dbKillCharacter _uid;
    }
    else
    {
    call init_newBody;
    };
    };
    _id dbServerLoadCharacter _handler;
    };


    "respawn" addPublicVariableEventHandler
    {


    _agent = _this select 1;
    diag_log format ["CLIENT request to respawn %1 (%2)",_this,lifeState _agent];
    debuglog ["[INFO] *** test ***"];


    execVM "newdaytime.sqf";


    if (lifeState _agent != "ALIVE") then
    {
    //get details
    _id = owner _agent;
    _uid = getClientUID _id;
    _agent setDamage 1;


    //process client
    [_id,false,[0,0,0]] spawnForClient
    {
    titleText ["Respawning... Please wait...","BLACK FADED",10e10];
    diag_log str(_this);
    playerQueueVM = _this call player_queued;
    };
    };


    };


    "clientNew" addPublicVariableEventHandler
    {
    _array = _this select 1;
    _id = _array select 2;
    //_uid = getClientUID(owner _id);
    //diag_log format ["[INFO] CLIENT %1 (%3) request to spawn %2",_id,_this,_uid];
    diag_log format ["CLIENT %1 request to spawn %2",_id,_this];
    _id spawnForClient {statusChat ['server config by Kortal','']};


    _savedChar = dbFindCharacter (getClientUID _id); //ClientUID //steamUID
    //if (_savedChar select 0) exitWith {
    //diag_log format ["CLIENT %1 spawn request rejected as fake",_id];
    //};


    _charType = _array select 0;
    _charInv = _array select 1;
    _pos = findSpawnPoint [ DZ_posbubbles, DZ_spawnparams ];


    //load data
    _top = getArray(configFile >> "cfgCharacterCreation" >> "top");
    _bottom = getArray(configFile >> "cfgCharacterCreation" >> "bottom");
    _shoe = getArray(configFile >> "cfgCharacterCreation" >> "shoe");


    _myTop = _top select (_charInv select 0);
    _myBottom = _bottom select (_charInv select 1);
    _myShoe = _shoe select (_charInv select 2);
    _mySkin = DZ_SkinsArray select _charType;


    _agent = createAgent [_mySkin, _pos, [], 0, "NONE"];
    {null = _agent createInInventory _x} forEach [_myTop,_myBottom,_myShoe];


    _v = _agent createInInventory "tool_flashlight";
    _v = _agent createInInventory "consumable_battery9V";_v setVariable ["power",30000];
    //_v = _agent createInInventory "M4A1";
    //_v = _agent createInInventory "Spraycan_Green";_v setVariable ["quantity",1];
    _agent call init_newPlayer;
    call init_newBody;


    };


    //this addWeapon "Binocular";
    //this addWeapon "AK74";


    //call dbLoadPlayer;



    _humidity = 0.3;


    //setDate getSystemTime;
    //setDate [2014, 01, 01, 23, 0]


    simulSetHumidity _humidity;
    0 setOvercast _humidity;


    _position = [7500,7500,0];
    //exportProxies [_position,200000];
    call init_spawnZombies;
    sleep 1;
    importProxies;


    //while{true} do {
    spawnLoot [_position,15000,25000];
    //sleep 7200;
    //};


    setTimeForScripts 0.03;

    Einmal editiert, zuletzt von Adebar ()

  • Ja wäre recht nice,wenn man mal endlich vollen Datenbank zugang hätte,aber das dauert noch ein bisschen.

  • Aber sicher doch,da ich ja auch plan vom Arma scripten habe ;D


    Quelle: Mpmissioncache unter C:-benutzer-deinname-appdata-local-dayz