Jump to content

zuff

Member
  • Content Count

    314
  • Joined

  • Last visited

  • Medals

  • Medals

Posts posted by zuff


  1. The commas must stay, it's an array. The function name however is wrong, it's FHQ_TT_addTasks

    (note 's' at the end)

    
    [       
       west,      
       [
          format ["%1%2", _taskType, _taskNum],      
          format ["%1 Target %2", _taskType, _taskNum],     
          format ["%1 %2", _taskType, _taskNum],      
          format ["%1", _taskType],      
          getMarkerPos _markerNum      
       ] 
    ] call FHQ_TT_addTasks;
    

    Oh my. I really hope that's the problem, I feel really stupid now. :P thanks ill try when I get home.

    EDIT: Got it to work with this:

    [
           player,
           [
                format ["%1%2", _taskType, _taskNum], 
                format ["%1 Target %2", _taskType, _taskNum], 
                format ["%1 %2", _taskType, _taskNum], 
                format ["%1", _taskType], getMarkerPos _markerNum
           ]
    ] call FHQ_TT_addTasks;

    I also think "west" instead of "player" wasn't working for some reason, this is being called across all clients in the server.


  2. How exactly does the error look like ? Can you quote the appropriate lines from the RPT file ?

    I'm at work but it was a "missing bracket" scripterror. Are you sure I'm writing the formats correctly? Should they be enclosed in brackets themselves? Or quotes?

    Like this?

    [
          west,
        [
        "format ["%1%2", _taskType, _taskNum]",
        "format ["%1 Target %2", _taskType, _taskNum]",
        "format ["%1 %2", _taskType, _taskNum]",
        "format ["%1", _taskType]",
        getMarkerPos _markerNum
        ]
    ] call FHQ_TT_addTask;
    


  3. [
           west,
           [
               format ["%1%2", _taskType, _taskNum], 
               format ["%1 Target %2", _taskType, _taskNum], 
               format ["%1 %2", _taskType, _taskNum], 
               format ["%1", _taskType], getMarkerPos _markerNum]
       --> ] <---
    ] call FHQ_TT_addTask;
    

    If you look at how many [ ] brackets you have your missing one.

    format ["%1", _taskType], getMarkerPos _markerNum]
    

    You have one open bracket and two close bracket. Looking through the whole thing you have 6 open's and 7 closes. That leave's you one extra. Hence the missing bracket warning.

    No you're looking at the wrong post, that's with the extra bracket he added, my first post, above that, my code originally looks like this when properly formatted:

    [
          west,
        [
        format ["%1%2", _taskType, _taskNum],
        format ["%1 Target %2", _taskType, _taskNum],
        format ["%1 %2", _taskType, _taskNum],
        format ["%1", _taskType],
        getMarkerPos _markerNum
        ]
    ] call FHQ_TT_addTask;
    

    I have the right amount of brackets. Still got the error.


  4. Varanon, how would I write this correctly?

    [
           west,
           [format ["%1%2", _taskType, _taskNum], format ["%1 Target %2", _taskType, _taskNum], format ["%1 %2", _taskType, _taskNum], format ["%1", _taskType], getMarkerPos _markerNum]
    ] call FHQ_TT_addTask;

    I'm not sure how to implement "format" into the code, keep getting missing bracket errors.


  5. I've put together this mission, here: https://github.com/zuffdaddy/dynalamp/tree/master/DYNALAMP-WIP.Stratis

    And I'm having major locality issues with tasks and unit creation.

    The main troublemaker is "tasks.sqf" in "scripts/tasks/"

    I have no clue what to do when it comes to what i need to send to the clients and what needs to stay on the server. I know random numbers should be server side, but how do I get them back to the client?

    init.sqf:

    enableSaving [false, false];
    
    waitUntil { !isNull player }; // Wait for player to initialize
    
    sleep 1;
    
    //Ammo Box Scripts
    _null = player execVM "scripts\ammo_boxes\weapon_box.sqf";
    _null = player execVM "scripts\ammo_boxes\backpack_box.sqf";
    _null = player execVM "scripts\ammo_boxes\item_box.sqf";
    
    //MHQ Scripts
    _null = player execVM "scripts\mhq\mhq_marker.sqf";
    
    // Compile scripts
    getLoadout = compile preprocessFileLineNumbers 'scripts\fnc_get_loadout.sqf';
    setLoadout = compile preprocessFileLineNumbers 'scripts\fnc_set_loadout.sqf';
    
    //Changeroom Script
    call compile preprocessFileLineNumbers "dsl_gear_get_lists.sqf";
    
    //Mission Maker Teleport Function
    // use // to comment out [] execVM "MissionEditing\missionEditing.sqf"; to deactive the use of the hide/unhide features and teleport before releasing the map.
    [] execVM "scripts\MissionEditing\missionEditing.sqf";
    
    //TPWCAS AI Suppression
    null = [3] execvm "scripts\tpwcas\tpwcas_script_init.sqf";
    
    // Save default loadout
    loadout = [player] call getLoadout;
    
    // Load saved loadout on respawn
    player addEventHandler ["Respawn", {
       [player,loadout] spawn setLoadout;
     }
    ];
    
    //Create Tasks
    //[(paramsarray select 2),(paramsArray select 3), (paramsArray select 4), (paramsArray select 5), (paramsArray select 6),(paramsArray select 7),(paramsArray select 8)] execVM "scripts\tasks\tasks.sqf";
    
    [] execVM "scripts\tasks\tasks.sqf";
    
    //Clean Dead Body Script
    [] execVM "scripts\clearCorpses.sqf";

    tasks.sqf:

    //if (!isServer) exitwith {}; // NOTE: in multiplayer, only server should create random numbers.
    timeSkip = (paramsArray select 0); // True or False for timeSkip
    tasksToComplete = (paramsArray select 1); // Set amount of Tasks to Complete to win mission here
    unitsMin = (paramsArray select 2); // Set min amount of units here
    unitsMax = (paramsArray select 3); // Set max amount of units here
    unitsLeft = (paramsArray select 4); // Units that can be left at objective before being considered completed
    
    vehOn = (paramsArray select 5); // True or False for Enemy Vehicles
    vehCount = (paramsArray select 6); // How many vehicles you'd like at each objective
    //hint format['timeSkip is %1,tasksToComplete is %2, unitsMin is %3, unitsMax is %4, unitsLeft is %5, vehOn is %6, vehCount is %7',timeSkip, tasksToComplete, unitsMin, unitsMax,unitsLeft, vehOn, vehCount];
    //sleep 20;
    SideHQ = createCenter east;
    
    taskscompletedcount = 0; 
    
    firstmark = false;
    secondmark = false;
    thirdmark = false;
    fourthmark = false;
    fifthmark = false;
    sixthmark = false;
    sevenththmark = false;
    
    locationPicked = false;
    taskNumber = 1;
    firsttask = false;
    
    m1 = 0;
    timeSkipped= 0;
    
    // Pick Location ///////////////////////////////////////////////////////////////////////
    while {taskscompletedcount < tasksToComplete} do {
    if (isServer) then {
     //n1 = round ((random tasksToComplete) + 0.5); // generates random number
     if (timeSkip == 1) then {
       timeSkipped = round ((random 6) + 6);// generates random number from 6-12
       publicVariable "timeSkipped";
     };
    };
    
    hint format['timeSkipped is %1', timeSkipped];
    
    
    
    if (!firsttask) then
    {
       firsttask = true;
       newgroup = createGroup east;
       newTask = player createSimpleTask [format ["Assault Units %1", taskNumber]];
       skipTime (timeSkipped);
       while {!locationPicked} do {
    	  if (isServer) then {
           m1 = round ((random 6) + 1);
           publicVariable "m1";
         };
      		if (m1 == 1 && !firstmark) then {
      			locationPicked = true;
           publicVariable "locationPicked";
      			newTask setSimpleTaskDestination (getMarkerPos "m1");
           publicVariable "newTask";   			
      			createUnits = ["m1","airfield", unitsMin, unitsMax, vehOn, vehCount] execVM "scripts\tasks\createUnits.sqf";
           sleep 5;
      			firstmark = true;
      			secondmark = false;
           thirdmark = false;
           fourthmark = false;
           fifthmark = false;
           sixthmark = false;
           sevenththmark = false;
      		};
      		if (m1 == 2 && !secondmark) then {  
      			locationPicked = true; 			
           publicVariable "locationPicked";
      			newTask setSimpleTaskDestination (getMarkerPos "m2");   	
           publicVariable "newTask";		
      			createUnits = ["m2","agia", unitsMin, unitsMax, vehOn, vehCount] execVM "scripts\tasks\createUnits.sqf";
           sleep 5;
      			firstmark = false;
      			secondmark = true;
    		  thirdmark = false;
    	  	fourthmark = false;
           fifthmark = false;
           sixthmark = false;
           sevenththmark = false;
      		};
      		if (m1 == 3 && !thirdmark) then {
      			locationPicked = true;			
           publicVariable "locationPicked";
      			newTask setSimpleTaskDestination (getMarkerPos "m3");	
           publicVariable "newTask";	
      			createUnits = ["m3","kamino", unitsMin, unitsMax, vehOn, vehCount] execVM "scripts\tasks\createUnits.sqf";   	
           sleep 5;
      			firstmark = false;
    	  	secondmark = false;
    	    thirdmark = true;
    	    fourthmark = false;
           fifthmark = false;
           sixthmark = false;
           sevenththmark = false;
      		};
      		if (m1 == 4 && !fourthmark) then {
      			locationPicked = true;
           publicVariable "locationPicked";
      			newTask setSimpleTaskDestination (getMarkerPos "m4");	
           publicVariable "newTask";
      			createUnits = ["m4","mike26", unitsMin, unitsMax, vehOn, vehCount] execVM "scripts\tasks\createUnits.sqf";
           sleep 5;
      			firstmark = false;
    		  secondmark = false;
    		  thirdmark = false;
           fourthmark = true;
           fifthmark = false;
           sixthmark = false;
           sevenththmark = false;
      		};
         if (m1 == 5 && !fifthmark) then {
           locationPicked = true;
           publicVariable "locationPicked";
           newTask setSimpleTaskDestination (getMarkerPos "m5");  
           publicVariable "newTask";
           createUnits = ["m5","maxwell", unitsMin, unitsMax, vehOn, vehCount] execVM "scripts\tasks\createUnits.sqf";
           sleep 5;
           firstmark = false;
           secondmark = false;
           thirdmark = false;
           fourthmark = false;
           fifthmark = true;
           sixthmark = false;
           sevenththmark = false;
         };
         if (m1 == 6 && !sixthmark) then {
           locationPicked = true;
           publicVariable "locationPicked";
           newTask setSimpleTaskDestination (getMarkerPos "m6");  
           publicVariable "newTask";
           createUnits = ["m6","tempest", unitsMin, unitsMax, vehOn, vehCount] execVM "scripts\tasks\createUnits.sqf";
           sleep 5;
           firstmark = false;
           secondmark = false;
           thirdmark = false;
           fourthmark = false;
           fifthmark = false;
           sixthmark = true;
           sevenththmark = false;
         };
         if (m1 == 7 && !seventhmark) then {
           locationPicked = true;
           publicVariable "locationPicked";
           newTask setSimpleTaskDestination (getMarkerPos "m7");  
           publicVariable "newTask";
           createUnits = ["m7","girna", unitsMin, unitsMax, vehOn, vehCount] execVM "scripts\tasks\createUnits.sqf";
           sleep 5;
           firstmark = false;
           secondmark = false;
           thirdmark = false;
           fourthmark = false;
           fifthmark = false;
           sixthmark = false;
           sevenththmark = true;
         };
       };
           locationPicked = false;
           publicVariable "locationPicked";
           newTask setTaskState "Assigned";
           publicVariable "newTask";
           player setCurrentTask newTask;
           waitUntil {({alive _x} count units newgroup) == 0 || ({alive _x} count units newgroup) <= unitsLeft};
           deleteGroup newgroup;
           newTask setTaskState "Succeeded";
           publicVariable "newTask";
           hint format["Objective %1 Complete",taskNumber];
           taskNumber = taskNumber + 1;
           publicVariable "taskNumber";
           taskscompletedcount = taskscompletedcount + 1;
           publicVariable "taskscompletedcount";
           firsttask = false;
           publicVariable "firsttask";
           sleep 5;
    
     };
    };
    
    hint "All done";

    createUnits.sqf:

    //if (!isServer) exitwith {}; // NOTE: in multiplayer, only server should create random numbers.
    //hint 'CreateUnits is Working';
    _marker = _this select 0;
    _patrolMarker = _this select 1;
    _unitsMin = _this select 2;
    _unitsMax = _this select 3;
    _vehOn = _this select 4;
    _vehCount = _this select 5;
    
    _unitsDif = 0;
    _unitsDif = (_unitsMax - _unitsMin);
    _unitsTotal = 0;
    if (isServer) then {
    _unitsTotal = round ((random _unitsDif) + unitsMin);
    publicVariable "_unitsTotal";
    };
    //hint format["Units Total is %1", _unitsTotal];
    //hint format["Vehicles are %1", _vehOn];
    _counter = 0;
    _vehCounter = 0;
    
    while {_counter < _unitsTotal} do {
    "O_Soldier_F" createUnit [getMarkerPos _marker, newgroup, "nul =[this, _patrolMarker, ""random"",""nofollow"",""showmarker""] execvm ""scripts\ups.sqf"""];
    if (_vehOn == 1) then {
    	while {_vehCount > _vehCounter} do {
    
    		_dist = random 45;// this chooses a random distance from 0-45
    		_dir = random 360;// this selects a random direction from 360 degrees rotation
    		_pos = getMarkerPos _marker;
    		if (isServer) then {
    		_positions = [(_pos select 0) + (sin _dir) * _dist, (_pos select 1) + (cos _dir) * _dist, 0];
    		};
    		_vehGroup = createGroup east;
    		_veh = "O_Galkin_MG_F" createVehicle (_positions);
    		_vehDriver = _vehGroup createUnit ["O_Soldier_F", _positions, [], 0, "FORM"];
    		_vehGunner = _vehGroup createUnit ["O_Soldier_F", _positions, [], 0, "FORM"];
    		_vehDriver assignAsDriver _veh;
    		_vehDriver moveInDriver _veh;
    		_vehGunner assignAsGunner _veh;
    		_vehGunner moveInGunner _veh;
    		_veh = nil;
    		_vehDriver = nil;
    		_vehGunner = nil;
    		_vehCounter = _vehCounter + 1;
    	};
    };
    _counter = _counter + 1;
    };

    If anyone has any advice, links, tutorials please help me. It's really bugging me I can't get this working correctly on a dedicated server.


  6. I've been working on a dynamic mission and I've run into a few server-sided issues. I've got a good grasp on scripting, but when it comes to what needs to be publicvariable'd, local variabled, server-sided I'm so frustratingly lost.

    I've managed to get a dynamic mission script going and it works perfectly fine in singleplayer, but once I threw it up on my client server, nothing worked for anyone except me. At the top of the tasks.sqf script there's a !isServer check which I'm sure is the root of my problems but its from another script I found on the forums and I know random numbers should be generated server side.

    What I'm needing is someone to tell me what I need to do to fix this so it works for everyone, even JIP. If you can, tell me if I'm using too many variables, or which variables should be public. Like I said, I'm comfortable with scripting except multiplayer scripting.

    Here's my mission folder if anyone wants to take more of a peak at what I have going on:

    https://dl.dropbox.com/u/1125473/Arma/%5BSHACK%5DCO30-DYNALAMP.Stratis.7z

    It works fine SP and client side server but dedicated is a no go. It's harder to test since I have no dedicated I have regular access to since there

    The main snippets of code I'm having issues with:

    Init.sqf:

    sleep 1;
    
    waitUntil { !isNull player }; // Wait for player to initialize
    
    [] execVM "scripts\tasks\tasks.sqf";

    tasks.sqf:

    if (!isServer) exitwith {}; // NOTE: in multiplayer, only server should create random numbers.
    timeSkip = (paramsArray select 0); // True or False for timeSkip
    tasksToComplete = (paramsArray select 1); // Set amount of Tasks to Complete to win mission here
    unitsMin = (paramsArray select 2); // Set min amount of units here
    unitsMax = (paramsArray select 3); // Set max amount of units here
    unitsLeft = (paramsArray select 4); // Units that can be left at objective before being considered completed
    
    vehOn = (paramsArray select 5); // True or False for Enemy Vehicles
    vehCount = (paramsArray select 6); // How many vehicles you'd like at each objective
    //hint format['timeSkip is %1,tasksToComplete is %2, unitsMin is %3, unitsMax is %4, unitsLeft is %5, vehOn is %6, vehCount is %7',timeSkip, tasksToComplete, unitsMin, unitsMax,unitsLeft, vehOn, vehCount];
    //sleep 20;
    SideHQ = createCenter east;
    
    taskscompletedcount = 0; 
    
    firstmark = false;
    secondmark = false;
    thirdmark = false;
    fourthmark = false;
    fifthmark = false;
    sixthmark = false;
    sevenththmark = false;
    
    locationPicked = false;
    taskNumber = 1;
    firsttask = false;
    
    // Pick Location ///////////////////////////////////////////////////////////////////////
    while {taskscompletedcount < tasksToComplete} do {
    
    n1 = round ((random tasksToComplete) + 0.5); // generates random number
    if (timeSkip == 1) then {
     timeSkipped = round ((random 6) + 6);// generates random number from 6-12
    };
    
    
    if (!firsttask) then
    {
       firsttask = true;
       newgroup = createGroup east;
       newTask = player createSimpleTask [format ["Assault Units %1", taskNumber]];
       skipTime (timeSkipped);
       while {!locationPicked} do {
    	  m1 = round ((random 6) + 1);
      		if (m1 == 1 && !firstmark) then {
      			locationPicked = true;
      			newTask setSimpleTaskDestination (getMarkerPos "m1");   			
      			createUnits = ["m1","airfield", unitsMin, unitsMax, vehOn, vehCount] execVM "scripts\tasks\createUnits.sqf";
           sleep 5;
      			firstmark = true;
      			secondmark = false;
           thirdmark = false;
           fourthmark = false;
           fifthmark = false;
           sixthmark = false;
           sevenththmark = false;
      		};
      		if (m1 == 2 && !secondmark) then {  
      			locationPicked = true; 			
      			newTask setSimpleTaskDestination (getMarkerPos "m2");   			
      			createUnits = ["m2","agia", unitsMin, unitsMax, vehOn, vehCount] execVM "scripts\tasks\createUnits.sqf";
           sleep 5;
      			firstmark = false;
      			secondmark = true;
    		  thirdmark = false;
    	  	fourthmark = false;
           fifthmark = false;
           sixthmark = false;
           sevenththmark = false;
      		};
      		if (m1 == 3 && !thirdmark) then {
      			locationPicked = true;			
      			newTask setSimpleTaskDestination (getMarkerPos "m3");		
      			createUnits = ["m3","kamino", unitsMin, unitsMax, vehOn, vehCount] execVM "scripts\tasks\createUnits.sqf";   	
           sleep 5;
      			firstmark = false;
    	  	secondmark = false;
    	    thirdmark = true;
    	    fourthmark = false;
           fifthmark = false;
           sixthmark = false;
           sevenththmark = false;
      		};
      		if (m1 == 4 && !fourthmark) then {
      			locationPicked = true;
      			newTask setSimpleTaskDestination (getMarkerPos "m4");	
      			createUnits = ["m4","mike26", unitsMin, unitsMax, vehOn, vehCount] execVM "scripts\tasks\createUnits.sqf";
           sleep 5;
      			firstmark = false;
    		  secondmark = false;
    		  thirdmark = false;
           fourthmark = true;
           fifthmark = false;
           sixthmark = false;
           sevenththmark = false;
      		};
         if (m1 == 5 && !fifthmark) then {
           locationPicked = true;
           newTask setSimpleTaskDestination (getMarkerPos "m5");  
           createUnits = ["m5","maxwell", unitsMin, unitsMax, vehOn, vehCount] execVM "scripts\tasks\createUnits.sqf";
           sleep 5;
           firstmark = false;
           secondmark = false;
           thirdmark = false;
           fourthmark = false;
           fifthmark = true;
           sixthmark = false;
           sevenththmark = false;
         };
         if (m1 == 6 && !sixthmark) then {
           locationPicked = true;
           newTask setSimpleTaskDestination (getMarkerPos "m6");  
           createUnits = ["m6","tempest", unitsMin, unitsMax, vehOn, vehCount] execVM "scripts\tasks\createUnits.sqf";
           sleep 5;
           firstmark = false;
           secondmark = false;
           thirdmark = false;
           fourthmark = false;
           fifthmark = false;
           sixthmark = true;
           sevenththmark = false;
         };
         if (m1 == 7 && !seventhmark) then {
           locationPicked = true;
           newTask setSimpleTaskDestination (getMarkerPos "m7");  
           createUnits = ["m7","girna", unitsMin, unitsMax, vehOn, vehCount] execVM "scripts\tasks\createUnits.sqf";
           sleep 5;
           firstmark = false;
           secondmark = false;
           thirdmark = false;
           fourthmark = false;
           fifthmark = false;
           sixthmark = false;
           sevenththmark = true;
         };
       };
           locationPicked = false;
           newTask setTaskState "Assigned";
           player setCurrentTask newTask;
           waitUntil {({alive _x} count units newgroup) == 0 || ({alive _x} count units newgroup) <= unitsLeft};
           deleteGroup newgroup;
           newTask setTaskState "Succeeded";
           hint format["Objective %1 Complete",taskNumber];
           taskNumber = taskNumber + 1;
           taskscompletedcount = taskscompletedcount + 1;
           firsttask = false;
           sleep 5;
    
     };
    };
    
    hint "All done";

    createUnits.sqf:

    if (!isServer) exitwith {}; // NOTE: in multiplayer, only server should create random numbers.
    //hint 'CreateUnits is Working';
    _marker = _this select 0;
    _patrolMarker = _this select 1;
    _unitsMin = _this select 2;
    _unitsMax = _this select 3;
    _vehOn = _this select 4;
    _vehCount = _this select 5;
    
    _unitsDif = 0;
    _unitsDif = (_unitsMax - _unitsMin);
    _unitsTotal = 0;
    _unitsTotal = round ((random _unitsDif) + _unitsMin);
    //hint format["Units Total is %1", _unitsTotal];
    //hint format["Vehicles are %1", _vehOn];
    _counter = 0;
    _vehCounter = 0;
    
    while {_counter < _unitsTotal} do {
    "O_Soldier_F" createUnit [getMarkerPos _marker, newgroup, "nul =[this, _patrolMarker, ""random"",""nofollow"",""showmarker""] execvm ""scripts\ups.sqf"""];
    if (_vehOn == 1) then {
    	while {_vehCount > _vehCounter} do {
    
    		_dist = random 45;// this chooses a random distance from 0-45
    		_dir = random 360;// this selects a random direction from 360 degrees rotation
    		_pos = getMarkerPos _marker;
    		_positions = [(_pos select 0) + (sin _dir) * _dist, (_pos select 1) + (cos _dir) * _dist, 0];
    		_vehGroup = createGroup east;
    		_veh = "O_Galkin_MG_F" createVehicle (_positions);
    		_vehDriver = _vehGroup createUnit ["O_Soldier_F", _positions, [], 0, "FORM"];
    		_vehGunner = _vehGroup createUnit ["O_Soldier_F", _positions, [], 0, "FORM"];
    		_vehDriver assignAsDriver _veh;
    		_vehDriver moveInDriver _veh;
    		_vehGunner assignAsGunner _veh;
    		_vehGunner moveInGunner _veh;
    		_veh = nil;
    		_vehDriver = nil;
    		_vehGunner = nil;
    		_vehCounter = _vehCounter + 1;
    	};
    };
    _counter = _counter + 1;
    };

    I guess my main issue is with variables, but I've tried to reach as much as I can but there doesn't seem to be much covered on the MP side of things.

    Thanks guys, you're the best.


  7. I've set up a MHQ with some addActions on it that I want to remove if the vehicle is moving or destroyed.

    The problem is I'm not quite sure how to setup my WHILE loop:

    This is in the mhq's init:

    this = execVM "mhq_action.sqf";

    mhq_action.sqf

    _mhqAdd1 = 0;
    _mhqAdd2 = 0;
    _mhqAdd3 = 0;
    while {true} do {
    if (alive mhq && ((speed mhq)) == 0) then {
    	_mhqAdd1 = mhq addAction ["<t color='#74E868'>Drop Ammo Box</t>", "scripts\mhq\mhq_drop_ammo.sqf", "", 0, false]; 
    	_mhqAdd2 = mhq addAction ["<t color='#74E868'>Packup Box</t>","scripts\mhq\mhq_delete_box.sqf", "", 0, false];
    	_mhqAdd3 = mhq addAction ["<t color='#74E868'>Teleport to Base</t>","scripts\mhq\mhq_tobase.sqf", "", 0, false];
    } else {
    	mhq removeAction _mhqAdd1;
    	mhq removeAction _mhqAdd2;
    	mhq removeAction _mhqAdd3;
    };	
    };

    I'm sure you see the problem here, the script keeps adding the addActions over and over, duplicating them.

    So I thought well I'll have the script remove them then add them:

    mhq_action.sqf

    _mhqAdd1 = 0;
    _mhqAdd2 = 0;
    _mhqAdd3 = 0;
    
    while {true} do {
    if (alive mhq && ((speed mhq)) == 0) then {
    	mhq removeAction _mhqAdd1;
    	mhq removeAction _mhqAdd2;
    	mhq removeAction _mhqAdd3;
    	_mhqAdd1 = mhq addAction ["<t color='#74E868'>Drop Ammo Box</t>", "scripts\mhq\mhq_drop_ammo.sqf", "", 0, false]; 
    	_mhqAdd2 = mhq addAction ["<t color='#74E868'>Packup Box</t>","scripts\mhq\mhq_delete_box.sqf", "", 0, false];
    	_mhqAdd3 = mhq addAction ["<t color='#74E868'>Teleport to Base</t>","scripts\mhq\mhq_tobase.sqf", "", 0, false];
    } else {
    	mhq removeAction _mhqAdd1;
    	mhq removeAction _mhqAdd2;
    	mhq removeAction _mhqAdd3;
    };
           sleep 3;
    };

    Which technically works, but the addactions themselves flicker when the script loops. If I set "sleep 15" the flicker is not as noticeable (until 15 seconds, of course) but then if the vehicle is moving or destroyed, the actions are still available for 15 or less seconds before removed.

    So then I tried a waitUntil condition instead of sleep:

    mhq_action.sqf

    _mhqAdd1 = 0;
    _mhqAdd2 = 0;
    _mhqAdd3 = 0;
    
    while {true} do {
    if (alive mhq && ((speed mhq)) == 0) then {
    	mhq removeAction _mhqAdd1;
    	mhq removeAction _mhqAdd2;
    	mhq removeAction _mhqAdd3;
    	_mhqAdd1 = mhq addAction ["<t color='#74E868'>Drop Ammo Box</t>", "scripts\mhq\mhq_drop_ammo.sqf", "", 0, false]; 
    	_mhqAdd2 = mhq addAction ["<t color='#74E868'>Packup Box</t>","scripts\mhq\mhq_delete_box.sqf", "", 0, false];
    	_mhqAdd3 = mhq addAction ["<t color='#74E868'>Teleport to Base</t>","scripts\mhq\mhq_tobase.sqf", "", 0, false];
    } else {
    	mhq removeAction _mhqAdd1;
    	mhq removeAction _mhqAdd2;
    	mhq removeAction _mhqAdd3;
    };
    waitUntil {!alive mhq || ((speed mhq)) != 0};
    };

    But this breaks after the vehicle has stopped moving at least once, and the actions never are added again.

    I'm racking my brain here, I hope someone can help!

    EDIT: Seemed to get it to work like this:

    _mhqAdd1 = 0;
    _mhqAdd2 = mhq addAction ["<t color='#74E868'>Packup Box</t>","scripts\mhq\mhq_delete_box.sqf", "", 0, false];;
    _mhqAdd3 = 0;
    
    while {true} do {
    if (alive mhq && ((speed mhq)) == 0) then {
    	_mhqAdd1 = mhq addAction ["<t color='#74E868'>Drop Ammo Box</t>", "scripts\mhq\mhq_drop_ammo.sqf", "", 0, false]; 
    	_mhqAdd3 = mhq addAction ["<t color='#74E868'>Teleport to Base</t>","scripts\mhq\mhq_tobase.sqf", "", 0, false];
    	waitUntil {!alive mhq || ((speed mhq)) != 0};
    } else {
    	mhq removeAction _mhqAdd1;
    	mhq removeAction _mhqAdd3;
    	waitUntil {alive mhq && ((speed mhq)) == 0};
    };
    
    };

    The waitUntil in each of the if statements tells the script to hold up until one of the conditions change.

    I also moved the Packup box script to always be available so you can pick up the box no matter if you're moving or not.


  8. EDIT: NVM it started working. Must not have saved my mission properly. Thanks anyways!

    Giallustio

    I'm trying to clean up my mission folder and put all scripts into a scripts folder

    I put "=BTC=_revive" into "scripts\=BTC=_revive"

    I changed my init.sqf to this:

    call compile preprocessFile "scripts\=BTC=_revive\=BTC=_revive_init.sqf";

    and my description.ext to:

    #include "scripts\=BTC=_revive\=BTC=_respawn.h"

    I then went into each of your sqfs and .h files and changed the directories anytime "=BTC=_revive" was called, for example in =BTC=_functions.sqf:

    _id = player addAction [("<t color=""#ED2744"">") + ("Release") + "</t>","scripts\=BTC=_revive\=BTC=_addAction.sqf",[[],BTC_release], 9, true, true, "", "true"];

    And in =BTC=_revive_init.sqf:

    call compile preprocessFile "scripts\=BTC=_revive\=BTC=_functions.sqf";

    But I cannot get the script to run, am I missing something here?

    Great script btw, I love it.


  9. Using the F3 framework, I am in the f_briefing_nato.sqf and I've created a task:

    _task2 = player createSimpleTask ["OBJ_2"];
    _task2 setSimpleTaskDescription ["Destroy AA Camps along your way to protect the helicopter during extraction.", "Destroy AA Camps 1", "AA CAMP 1"];
    _task2 setSimpleTaskDestination (getMarkerPos "aa1");
    _task2 setTaskState "Created";

    Now I want that task to be set to Succeeded after a certain man dies. I've made an OPFOR named "aa1_man" and put this below the tasks' script:

    _trg2 = createTrigger ["EmptyDetector", getPos player];
    _trg2 setTriggerArea[0,0,0,false];
    _trg2 setTriggerActivation ["NONE", "NONE", false];
    _trg2 setTriggerStatements ["!alive aa1_man","_task2 setTaskState 'Succeeded'",""];

    The trigger does work, as I've got it to produce a hint, but with "_task2 setTaskState 'Succeeded'" I get no results.

    I've even tried "OBJ_2 setTaskState 'Succeeded'" and I've tried "'OBJ_2' setTaskState 'Succeeded'" but still no luck.

    Any tips?

    With this code:

    _trg2 = createTrigger ["EmptyDetector", getPos player];
    _trg2 setTriggerArea[0,0,0,false];
    _trg2 setTriggerActivation ["NONE", "NONE", false];
    _trg2 setTriggerStatements ["!alive aa1_man","hint 'yes this works'",""];

    it does work, here's a screenshot: http://steamcommunity.com/sharedfiles/filedetails/?id=131918498

    I'm sure it has something to do with locality and local variables, but I figured if they are all being call in the same sqf it should work. I'm lost!


  10. I figured out a big problem, this is the code that works:

    init.sqf

    if (isServer) then {
    [] spawn {
    	while {TRUE} do {
    		if (alive mhq) then { 
    			"respawn_west" setMarkerPos position vehicle mhq;
    		} else {
    			"respawn_west" setMarkerPos getMarkerPos "base_foxtrot";
    		};
    		if !(alive mhq) then {
    			hint "MHQ Destroyed! Spawning at Foxtrot until new MHQ is delivered.";
    		};
    		sleep 3;
    	};
    };
    };

    The "alive" condition fixes most of my problems. If vehicle is blown up the respawn point is set to base until vehicle is respawned.

    My new problem is I'm trying to teleport to the vehicle. I have this addaction setup on the ammo crate back at base:

    ammo.sqf

    _box addAction ["Teleport to MHQ", "teleport_mhq.sqf"];

    teleport_mhq.sqf

    if (alive mhq) then { 
    player setPos mhq;
    } else {
    hint "MHQ is Destroyed, please wait for new MHQ to be delivered.";
    };
    

    The problem is you teleport INTO the vehicle, how can I setup a radius around the vehicle in which the player is teleported?


  11. I've got a simple MHQ script running with a vehicle named "mhq".

    I have the "respawn_west" marker move to the position of "mhq" like this in my init.txt:

    if (isServer) then {
    [] spawn {
    	while {TRUE} do {
    		if (!isNil "mhq") then { 
    			"respawn_west" setMarkerPos position vehicle mhq;
    		};
    		sleep 3;
    	};
    };
    };

    This works fine. If the mhq is non-existent the marker script doesn't run (i think?). The problem comes when I want the "respawn_west" marker to move to the base marker called "base_foxtrot" if the mhq is not available, so I tried this if else statement:

    if (isServer) then {
    [] spawn {
    	while {TRUE} do {
    		if (!isNil "mhq") then { 
    			"respawn_west" setMarkerPos position vehicle mhq;
    		};
    		else {
    			"respawn_west" setMarkerPos getMarkerPos "base_foxtrot";
    		};
    		sleep 3;
    	};
    };
    };

    But upon destroying said "mhq", the marker does not update to the "base_foxtrot" marker. Any clue what I'm doing wrong here?

    Thanks in advance!

    FIXED VERSION

    init.sqf

    if (isServer) then {
    [] spawn {
    	while {TRUE} do {
    		if (alive mhq) then { 
    			"respawn_west" setMarkerPos position vehicle mhq;
    		}
    			else {
    			"respawn_west" setMarkerPos getMarkerPos "base_foxtrot";
    		};
    		if !(alive mhq) then {
    			hint "MHQ Destroyed! Spawning at Foxtrot until new MHQ is delivered.";
    		};
    		sleep 3;
    	};
    };
    };

    NEW PROBLEM

    Trying to teleport to "mhq" from ammo crate back at base using this:

    ammo.sqf

    _box addAction ["Teleport to MHQ", "teleport_mhq.sqf"];

    teleport_mhq.sqf

    if (alive mhq) then { 
    player setPos mhq;
    };
    else {
    hint "MHQ is Destroyed, please wait for new MHQ to be delivered.";
    };
    

    Puts me almost INSIDE the vehicle, any way I can be placed around it so I'm not clipping in it?


  12. Getting these errors when I open the menu:

    Handler not present

    Warning Message: No entry 'mpmissions\__cur_mp.stratis\description.ext/Rio_gear_gui/helmet_b.textureNoShortcut'.

    Warning Message: '/' is not a value

    Warning Message: No entry 'mpmissions\__cur_mp.stratis\description.ext/Rio_gear_gui/helmet_b.soundPush'.

    Warning Message: Size: '/' not an array

    Warning Message: No entry 'mpmissions\__cur_mp.stratis\description.ext/Rio_gear_gui/helmet_b.soundClick'.

    Warning Message: Size: '/' not an array

    Warning Message: No entry 'mpmissions\__cur_mp.stratis\description.ext/Rio_gear_gui/helmet_b.soundEscape'.

    Warning Message: Size: '/' not an array

    Warning Message: No entry 'mpmissions\__cur_mp.stratis\description.ext/Rio_gear_gui/helmet_b.HitZone'.

    Warning Message: No entry '.left'.

    Warning Message: '/' is not a value

    Warning Message: No entry 'mpmissions\__cur_mp.stratis\description.ext/Rio_gear_gui/helmet_b.HitZone'.

    Warning Message: No entry '.top'.

    Warning Message: '/' is not a value

    Menu still works, they just pop-up when opened the first time.


  13. Ok after attempting this mission a few times here's what I have so far.

    The marker for Kasun shows his ingress direction. It should show up on the road somewhere but I've also had it show up off the visible map area. Figure out the path Kasun will be taking across the map and try to intercept him there. Once you intercept him, kill the driver and Kasun will get out and stand in front of you. Just walk up to him and once your character says the whole "you are arrested" speech, Kasun will start following you around. He won't get into your vehicle or anything so just drive back to point Orion and wait there at 4x speed. Eventually you will get a message telling you Kasun has been successfully apprehended.

    Awesome that worked for me. I figured he'd be on the road but I found him in a red car out in a field. Thanks again for that.

×