Jump to content

migueldarius

Member
  • Content Count

    63
  • Joined

  • Last visited

  • Medals

Posts posted by migueldarius


  1. I might be wrong, but don't you need to create a group for a createVehicle'd unit? I.e. your "grp = group _driver; doesn't return an actual group?

    And I guess you could use createunit instead.

    Yes is fixed, now the spawn car move to the waypoint, but right now don't delete the veichle, I don't know why if I write "deleteVehicle this" in the waypoint...

    generate_traffic.sqf

    /*
    null = [logic1, logic2, number] execVM "generate_traffic.sqf";
    */
    _start = _this select 0;
    _end = _this select 1;
    _number = _this select 2;
    
    _carList = [
    
    "C_Offroad_01_F",
    "C_Hatchback_01_F",
    "C_Hatchback_01_sport_F",
    "C_SUV_01_F","C_Van_01_transport_F",
    "C_Van_01_box_F",
    "C_Van_01_fuel_F"
    
    ];
    
    _manList = [
    
    "C_man_p_beggar_F",
    "C_man_1","C_man_polo_1_F",
    "C_man_polo_2_F",
    "C_man_polo_3_F",
    "C_man_polo_4_F",
    "C_man_polo_5_F",
    "C_man_polo_6_F",
    "C_man_shorts_1_F",
    "C_man_1_1_F",
    "C_man_1_2_F",
    "C_man_1_3_F",
    "C_man_p_fugitive_F",
    "C_man_p_shorts_1_F",
    "C_man_hunter_1_F",
    "C_man_shorts_2_F",
    "C_man_shorts_3_F",
    "C_man_shorts_4_F"
    
    ];
    
    for "_i" from 1 to _number do{
    	_civil = createGroup Civilian;
    	_randomCar = (_carList select (random (count _carList))); 
    	_spawnCar = createVehicle [_randomCar, (getpos _start), [], 2, "NONE"];
    	_spawnCar setDir (getDir _start);
    	_spawnCar setfuel 0.5 + (random 0.5);
    	_randomMan = (_manList select (random (count _manList)));
    	_driver = _civil createUnit [_randomMan, (getpos _start), [], 2, "FORM"];
    	_driver moveInDriver _spawnCar;
    	_driver setBehaviour "SAFE";
    	_grp = group _driver;
    	_waypointCar = _grp addWaypoint [(getPosASL _end), 0];
    	_waypointCar setWaypointStatements ["true", "deleteVehicle this"];
    	sleep 5;
    };
    
    


  2. So you want to restrict the UAV, but not the UAV?

    :Oo:

    How about you start over by writing a proper description of:

    1. What you want

    2. What you already have

    3. What you don't want

    4. Where the problem is

    Along with any other details that might be relevant. (type of mission, equipment availability, mp/sp, scripts used, ...)

    :blues:

    true, true hahaha, sorry, well I want that in the mission is restrict the UAV copter, I added a virtual ammo box and I don't know how to restrict chose the UAV backpack

    this addAction ["Arsenal", {["Open",true] spawn BIS_fnc_arsenal;}];


  3. Hi all,

    I Tried make spawn some cars in a logic point and this civil cars go to the other logic point in a traced road like a traffic.

    Well, I don't know why my civilians cars don't move I don't know what I do wrong :(

    generate_traffic.sqf

    /*
    null = [logic1, logic2, number] execVM "generate_traffic.sqf";
    */
    _start = _this select 0;
    _end = _this select 1;
    _number = _this select 2;
    
    _carList = [
    
    "C_Offroad_01_F",
    "C_Hatchback_01_F",
    "C_Hatchback_01_sport_F",
    "C_SUV_01_F","C_Van_01_transport_F",
    "C_Van_01_box_F",
    "C_Van_01_fuel_F"
    
    ];
    
    _manList = [
    
    "C_man_p_beggar_F",
    "C_man_1","C_man_polo_1_F",
    "C_man_polo_2_F",
    "C_man_polo_3_F",
    "C_man_polo_4_F",
    "C_man_polo_5_F",
    "C_man_polo_6_F",
    "C_man_shorts_1_F",
    "C_man_1_1_F",
    "C_man_1_2_F",
    "C_man_1_3_F",
    "C_man_p_fugitive_F",
    "C_man_p_shorts_1_F",
    "C_man_hunter_1_F",
    "C_man_shorts_2_F",
    "C_man_shorts_3_F",
    "C_man_shorts_4_F"
    
    ];
    
    trafficDone = false;
    
    for "_i" from 1 to _number do{
    	_civil = createGroup Civilian;
    	_randomCar = (_carList select (random (count _carList))); 
    	_spawnCar = createVehicle [_randomCar, (getpos _start), [], 2, "NONE"];
    	_spawnCar setDir (getDir _start);
    	_spawnCar setfuel 0.5 + (random 0.5);
    	_randomMan = (_manList select (random (count _manList)));
    	_driver = _civil createUnit [_randomMan, (getpos _start), [], 2, "FORM"];
    	_driver moveInDriver _spawnCar;
    	_driver setBehaviour "SAFE";
    	_grp = group _driver;
    	_waypointCar = _grp addWaypoint [(getPosASL _end), 0];
    	_waypointCar setWaypointStatements ["true", "deleteVehicle this; trafficDone = true"];
    	sleep 5;
    };
    
    


  4. "fireMortar.sqf"

    _mortar = _this select 0;
    _targetArray = _this select 1;
    
    _target  = _targetArray select 0;
    _theAmmo  = getArtilleryAmmo [_mortar] select 0;
    _idx = 0;
    
    //-- prevents firing at aircraft
    if(isTouchingGround _target) then {	
    
    //-- The number of times you want the _mortar to check for range
    while {(_idx < 8)} do{
    	_tgtPos = position _target;
    	_isInRange = _tgtPos inRangeOfArtillery [[_mortar], _theAmmo  ];
    
    	if (_isInRange) then {
    		_mortar commandArtilleryFire [_tgtPos, _theAmmo  , 1 ];			
    	};
    
    	sleep 5;
    	_idx = _idx + 1;
    };	
    };
    


  5. My last code block, as I stated, isn't working properly, the ones before I started messing with the "fire on area" effect, were working perfectly fine, so you have set something up wrong, could you supply your mission folder?

    Last working version being in post #35: http://forums.bistudio.com/showthread.php?150180-Enemy-AI-using-artillery&p=2832704&viewfull=1#post2832704

    Nope, I don't know what happen whit Sandstorm that don't fire more one time T-T


  6. Well, I don't know if AI will use the ammo truck, but in any case, below should make life easy in that regard:

    //null = [this,"mrkName",12,300] execVM "sandstormFire.sqf"; 
    
    //sandstormFire.sqf 
    _sandstorm = [_this,0,objNull,[objNull]] call BIS_fnc_param; 
    _markerPos = getMarkerPos ([_this,1,"",[""]] call BIS_fnc_param); 
    _numRnds = [_this,2,12,[0]] call BIS_fnc_param; 
    _timeBetween = [_this,3,300,[0]] call BIS_fnc_param; 
    
    if (isNull _sandstorm) exitWith { systemChat "Sandstorm is undefined or dead >> sandstormFire.sqf"; }; 
    
    while {true} do 
    { 
       if (isNull _sandstorm || !alive _sandstorm) exitWith {}; 
    
       _sandstorm commandArtilleryFire [_markerPos,"12Rnd_230mm_rockets",_numRnds]; 
    
       sleep _timeBetween;
    
    _sandstorm setVehicleAmmo 1;
    };  

    Just right now I put the setVehicleAmmo 1 exactly your code, the AI does not want to reload... AI derp... :butbut: T_T


  7. Maybe a bit more than needed, but eh, fun with functionality :D:

    //null = [this,"mrkName",12,300] execVM "sandstormFire.sqf";
    
    //sandstormFire.sqf
    _sandstorm = [_this,0,objNull,[objNull]] call BIS_fnc_param;
    _markerPos = getMarkerPos ([_this,1,"",[""]] call BIS_fnc_param);
    _numRnds = [_this,2,12,[0]] call BIS_fnc_param;
    _timeBetween = [_this,3,300,[0]] call BIS_fnc_param;
    
    if (isNull _sandstorm) exitWith { systemChat "Sandstorm is undefined or dead >> sandstormFire.sqf"; };
    
    while {true} do
    {
    if (isNull _sandstorm || !alive _sandstorm) exitWith {};
    
    _sandstorm commandArtilleryFire [_markerPos,"12Rnd_230mm_rockets",_numRnds];
    
    sleep _timeBetween;
    };

    You can put the call line in the init field of the object, or name the object something and put it in place of "this".

    So first argument in the call line is the object that will be doing the firing.

    Second argument is the marker position it's firing at.

    Third argument is the number of rounds to be fired in the burst (defaults to 12).

    Fourth argument is the time between firings (defaults to 300 seconds >> 5 minutes).

    I have a problem, the sandstorm dont want to reload their ammo, gets stuck. Why? :confused:

    I placed a ammo truck, but dont want reload.


  8. Ahh ok.

    So all players are able to heal one another, presumably, and if all players are dead then logically the mission is over so you want to end it.

    In that case, something like the below would work.

    It evaluates in a loop to check all the players. If less than 1 players are not (read that twice) in the BTC 'unconscious' state, then the mission will terminate.

    It's probably best to put some sort of delay at the beginning, as I can foresee issues when the players have entered the game but the BTC Revive code has not initialized yet, triggering the _allPlayersDead variable right at the start before the mission begins.

    // "init.sqf" or "initServer.sqf"
    
    if (isServer || isDedicated) then {
    
    [] spawn {
    	private ["_allPlayersDead"];
    
    	mission_in_progress = TRUE;
    	win = FALSE;
    	_allPlayersDead = FALSE;
    
    	while {mission_in_progress} do {
    
    		_allPlayersDead = ({(format ["%1",player getVariable "BTC_need_revive"] == "0")} count (playableUnits + switchableUnits)) < 1;
    
    		if (_allPlayersDead) exitWith {
    			sleep 1; 
    			["LOSER", false] call BIS_fnc_endMissionServer; 
    			sleep 1; 
    			forceEnd; 
    		};
    
    		if (win) exitWith {
    			sleep 1; 
    			["end1", true] call BIS_fnc_endMissionServer; 
    			sleep 1; 
    			forceEnd; 
    		};
                           sleep 5;
    	};
    };
    };
    

    Don't work in a Dedicated Server, Just start the mission, end the mission like all is dead. Why? Can help me please?


  9. Do you want the host scenario to end once all players are dead, or do you want each player to experience an 'end mission' after they die?

    Those are two different things.

    A petty issue I see is that 'win' is an undefined variable. Define as

    win = false;

    prior to the

    waitUntil {sleep 0.3; (win)};

    ---

    As for the structure, its going to require a listener on the server, and each player is going to have to send information to the listener on their death event.

    // init.sqf
    
    
    //========== SERVER
    
    if (isDedicated || isServer) then {
    
    // define some variables
    
    deathCounter = 0;
    deathLimit = 10; // set this number to the number of death events you require
    win = FALSE;
    
    // add a network variable handler
    
    "deathListener" addPublicVariableEventHandler {
    
    deathCounter = deathCounter + 1;
    
    };
    
    // spawn a monitor loop with 2 outcomes (win or lose)
    
    [] spawn {
    mission_in_progress = TRUE;
    
    while {mission_in_progress} do {
    
    // When each player dies it +1s the deathCounter variable.
    
    if (deathCounter == deathLimit) exitWith {
       sleep 1; 
       ["LOSER", false] call BIS_fnc_endMissionServer; 
       sleep 1; 
       forceEnd; 
    };
    
    // Not sure where how the win variable is redefined from FALSE to TRUE, thats up to your scenario flow.
    
    if (win) exitWith {
       sleep 1; 
       ["end1", true] call BIS_fnc_endMissionServer; 
       sleep 1; 
       forceEnd; 
    };
    };
    };
    
    
    } else {
    
    
    //=============== CLIENT
    
    // On the player, we add a killed event, and in the event of killed, we tell the server to +1 the deathCounter as per above.
    
    player addEventHandler ["Killed",{publicVariableServer "deathListener";}];
    
    
    };
    

    Also might be relevant to note that =BTC= Revive allows the player to die before sending them into a Revive'able state.

    For all players dead, If all player is dead, anyone cant revive to anyone so, end mission.

    The variable "Win" is defined in the editor yet with a trigger.


  10. Other cuestion, if in other mission without respawn or revive, only default in the description.ext "respawn = 0;" If i want Check if players is alive, this script maybe work?

    hint "Alive Check Start";
    sleep 2;
    if ({( isPlayer _x ) && !( alive _x )} count playableUnits == 0 ) then{
    hint "All dead or not exist";
    };
    sleep 2;
    hint "Alive Check End";
    sleep 2;
    AllPlayersDead = true;


  11. Hi Guys, I have a problem with my "Alive Check script", I'm noob in the world of scripting but I try to learn.

    My problem is that the mission not end when all players dies that mean the mission end lose, so, this script I want work with the revive script BTC, check that all players is dead and end the mission.

    Please any else to work this script, whats is my fail?

    Thank you for read, I hope help. :)

    In Editor

    Each players or units playable is named P1, P2, P3, P4... etc is for the script work

    "AliveCheck.sqf"

    hint "Alive Check Start";
    sleep 2;
    if ( { !(isNull _x) && { !(alive _x) } } count [P1, P2, P3, P4] == 0  ) then {
    hint "Todos estan muertos o no existen";
    };
    sleep 2;
    hint "Alive Check End";
    sleep 2;
    AllPlayersDead = true;

    "init.sqf"

    // ***************************** Alive Check Script **************************
    
    AllPlayersDead = false;
    [] execVM "AliveCheck.sqf";
    
    // ******************************* Revive Script *****************************
    
    enableSaving [false,false];
    call compile preprocessFile "=BTC=_revive\=BTC=_revive_init.sqf";
    //call compile preprocessFile "=BTC=_revive\lite\=BTC=_revive_init.sqf";
    
    // ******************************** Ends mission *****************************
    
    [] spawn {
    waitUntil {win};
    sleep 1;
    ["end1", true] call BIS_fnc_endMissionServer;
    sleep 1;
    forceEnd;
    };
    
    [] spawn {
    waitUntil {AllPlayersDead};
    sleep 1;
    ["LOSER", false] call BIS_fnc_endMissionServer;
    sleep 1;
    forceEnd;
    };
    
    // ******************************* End Init *****************************

    Link for the mission:

    mega.co.nz


  12. Hi Guys, I have a problem with my "Alive Check script", I'm noob in the world of scripting but I try to learn.

    My problem is that the mission not end when all players dies that mean the mission end lose, so, this script I want work with the revive script BTC, check that all players is dead and end the mission.

    Please any else to work this script, whats is my fail?

    Thank you for read, I hope help. :)

    In Editor

    Each players or units playable is named P1, P2, P3, P4... etc is for the script work

    "AliveCheck.sqf"

    hint "Alive Check Start";
    sleep 2;
    if ( { !(isNull _x) && { !(alive _x) } } count [P1, P2, P3, P4] == 0  ) then {
    hint "Todos estan muertos o no existen";
    };
    sleep 2;
    hint "Alive Check End";
    sleep 2;
    AllPlayersDead = true;

    "init.sqf"

    // ***************************** Alive Check Script **************************
    
    AllPlayersDead = false;
    [] execVM "AliveCheck.sqf";
    
    // ******************************* Revive Script *****************************
    
    enableSaving [false,false];
    call compile preprocessFile "=BTC=_revive\=BTC=_revive_init.sqf";
    //call compile preprocessFile "=BTC=_revive\lite\=BTC=_revive_init.sqf";
    
    // ******************************** Ends mission *****************************
    
    [] spawn {
    waitUntil {win};
    sleep 1;
    ["end1", true] call BIS_fnc_endMissionServer;
    sleep 1;
    forceEnd;
    };
    
    [] spawn {
    waitUntil {AllPlayersDead};
    sleep 1;
    ["LOSER", false] call BIS_fnc_endMissionServer;
    sleep 1;
    forceEnd;
    };
    
    // ******************************* End Init *****************************

    Link for the mission:

    mega.co.nz

×