Jump to content

Donnovan

Member
  • Posts

    840
  • Joined

  • Last visited

  • Days Won

    12

Posts posted by Donnovan

  1. SYNTAX:

    result = [array,factor] call LOL_fnc_selectRandomFactor;

    array is an array with elements. Those elements can be of type array.

    factor is how much the elements with lower index will be priorized (look the image on the link bellow).

    result is an element of "array".

    EXAMPLE 1:

    //EXAMPLE
    //_randomVeh have a 55% chance to be "car_hatchback"
    //_randomVeh have a 20% chance to be "hilux1_civil_3_open"
    //_randomVeh have a 15% chance to be "UAZ_CDF"
    //_randomVeh have a 10% chance to be "HMMWV"
    
    _vehicles = ["car_hatchback","hilux1_civil_3_open","UAZ_CDF","HMMWV"];
    _randomVeh = [_vehicles,2.25] call LOL_fnc_selectRandomFactor;

    EXAMPLE 2 (making it like BIS_fnc_selectRandom):

    //EXAMPLE
    //_randomVeh have a 25% chance to be "car_hatchback"
    //_randomVeh have a 25% chance to be "hilux1_civil_3_open"
    //_randomVeh have a 25% chance to be "UAZ_CDF"
    //_randomVeh have a 25% chance to be "HMMWV"
    
    _vehicles = ["car_hatchback","hilux1_civil_3_open","UAZ_CDF","HMMWV"];
    _randomVeh = [_vehicles,1] call LOL_fnc_selectRandomFactor;

    THE FUNCTION:

    LOL_fnc_selectRandomFactor = {
    	_array = _this select 0;
    	_factor = _this select 1;
    	_array select (floor ((random ((count _array)^(1/_factor)))^(_factor)))
    };

    SHART ANALISYS OF THE FUNCTION:

    new%20select%20random_zpsfuals8n4.png

  2. This is how i make no-lobby after death:

    Files to change:

    1 - Client side: compile\player_death.sqf

    use this custom player_death.sqf: https://www.dropbox.com/s/4yaijzuj1ieegiq/player_death.sqf?dl=0

    2 - Client side: description.ext (on the root of the mission file)

    Change this:

    respawndelay = 5;
    to this:
    
    respawndelay = 0;
    3 - Server side: compile\server_playerSetup.sqf

    Look for this line:

    _playerObj addMPEventHandler ["MPHit", {_this spawn fnc_plyrHit;}];
    Add above it, this line:
    
    _playerObj removeAllMPEventHandlers "MPHit";
    Create new file:

    1 - Put this file in the root of the mission: https://www.dropbox.com/s/omb7n23bxcky2gl/player_monitor.fsm?dl=0

    It's a custom player_monitor.fsm to run everytime the player dies.

    2 - Create reinit.sqf, in root of the mission file, and add inside it this content:

    dayz_originalPlayer = player;
    _id = player addEventHandler ["Respawn", {_id = [] spawn player_death;}];
    
    if (isServer) then {
        waitUntil{dayz_preloadFinished};
    };
    mtdr_reinitOk = false;
    _id = [] execFSM "player_monitor.fsm";
    
    waitUntil {mtdr_reinitOk};
    
    //If you use ESS, uncomment the line bellow:
    //sorry, i dont know the start line for it
    
    //If you use ESS2, uncomment the line bellow:
    //execVM "spawn\start.sqf";

    Anti Hack Problems

    I believe antihack kill the player if he goes to the debug area (respawn_west marker set in mission.sqm) after first respawn, so if you use antihack, the player will enter in a die/respawn/die/respaw cicle and probabily crash the game. Without antihack, it seens to work ok, but tell me if you find a problem.

    Thankyou.

×
×
  • Create New...