Jump to content

Sgt. Dennenboom

Member
  • Content Count

    93
  • Joined

  • Last visited

  • Medals

Posts posted by Sgt. Dennenboom


  1. I'm sure that what you are asking for is possible, I'm just not sure I understand what you are asking...

    In your example, what is "coolstuff"?

    • Is it a classname which you use to retrieve all objects with that class?
    • Is it a variable name that refers to a (pre-made) array of objects?
    • Or is it a string parameter that is used inside SomeFunction to run specific functionality?

  2. The problem is the arrayFlags variable. That global variable only exists on the client that created the flags (your PC), not on everybody elses.

    Let's restructure your code by passing along the teleport target flag as an argument in the addAction parameters.

     

    _actionCode = {
    	params ["_actionObject","_actionCaller","_actionID","_teleportTarget"];
    	_actionCaller setPos getPos _teleportTarget;
    };
    
    // flag 1 to flag 2
    [arrayFlags # 0, [_arrayTextFlag # 1, _actionCode, arrayFlags # 1]] remoteExec ["addAction",0,false]; // "#" is the same as a simple "select"
    
    // flag 2 to flag 1
    [arrayFlags # 1, [_arrayTextFlag # 0, _actionCode, arrayFlags # 0]] remoteExec ["addAction",0,false];

    And beyond the scope of your question just for fun, let's make it so you can have many flags instead of 2, all allowing teleportation to every other one:

    arrayFlags = [flag1,flag2,flag3,flag4];
    _arrayTextFlag = ["flag 1","flag 2","flag 3","flag 4"];
    
    _actionCode = {
    	params ["_actionObject","_actionCaller","_actionID","_teleportTarget"];
    	_actionCaller setPos getPos _teleportTarget;
    };
    
    {
    	_currentFlag = _x;
    	{
    		_targetFlag = _x;
    		if (_targetFlag != _currentFlag) then {
    			[_currentFlag, [_arrayTextFlag # _forEachIndex, _actionCode, _targetFlag]] remoteExec ["addAction",0,false];
    		};
    	} forEach arrayFlags;
    } forEach arrayFlags;

    You could also make this entire thing a function that is called locally to reduce network traffic (not really important for this tbh), but to cleanly do that you need some knowledge of the Functions Library.


  3. You could do something like this:

    _multiplier = if (count allPlayers >= 4) then {2} else {1};
    // You could make a mathematical equation instead of just an if statement
    
    SP_Missions_Squad_Members = (3 + (floor random 3 + 4)) * _multiplier;
    // random results in a decimal value instead of an integer, which is wonky to use in a loop so it is rounded
    
    for "_x" from 0 to SP_Missions_Squad_Members do ....

    There are many ways to achieve what you want, but this snippet uses the number of in-game players at the moment the script runs to increase the amount of spawned enemies.

    • Like 2

  4. BIS_fnc_holdActionAdd needs to be executed on every client.

     

    If you let the server handle this from init.sqf it would look something like this (the isServer check is critical here, or you'd end up with the same problem of having duplicate actions):

    Spoiler
    
    // init.sqf
    
    if (isServer) then {
    	[
    		 Truck,
    		"<t color='#58D68D'>Enganchar UH60</t>",
    		"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa",
    		"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa",
    		"(_this distance _target < 3) && (Truck_Bar distance Heli_1 < 10)",
    		"(_caller distance _target < 3) && (Truck_Bar distance Heli_1 < 10)",
    		{},
    		{},
    		{
    			params ["_target","_caller","_actionId","_arguments","_progress","_maxProgress"];
    			[Truck,_actionId] call BIS_fnc_holdActionRemove;
    			_null = ["Scripts\Interacciones\Remolcador\Soltar_Heli_1.sqf","BIS_fnc_execVM",false,false] spawn BIS_fnc_MP;
    		},
    		{},
    		[],
    		5,
    		6,
    		true,
    		false
    	] remoteExec ["BIS_fnc_holdActionAdd",0,Truck]; 
    };

     

     

    If you let the client handle this from init.sqf it would look something like this:

    Spoiler
    
    // init.sqf
    
    [
    	 Truck,
    	"<t color='#58D68D'>Enganchar UH60</t>",
    	"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa",
    	"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa",
    	"(_this distance _target < 3) && (Truck_Bar distance Heli_1 < 10)",
    	"(_caller distance _target < 3) && (Truck_Bar distance Heli_1 < 10)",
    	{},
    	{},
    	{
    		params ["_target","_caller","_actionId","_arguments","_progress","_maxProgress"];
    		[Truck,_actionId] call BIS_fnc_holdActionRemove;
    		_null = ["Scripts\Interacciones\Remolcador\Soltar_Heli_1.sqf","BIS_fnc_execVM",false,false] spawn BIS_fnc_MP;
    	},
    	{},
    	[],
    	5,
    	6,
    	true,
    	false
    ] call BIS_fnc_holdActionAdd; 

     

     

    There are better/more elegant solutions for how to call your function and what is happening inside it, but this should quickly do the trick using your own script.


  5. You are using the isNil command wrong. You can use it to check the existence of variables by supplying the variable name, or the existing of the result of code by supplying a code block.

     

    So using the former:

    ("-----Test-----") call BIS_fnc_log;
    
    _b = '< my valid steam UID>' call fn_getUIDPermissions;
    _c = if (isNil "_b") then {false} else {true}; // essentially the same as _c = !isNil "_b";
    
    (format ["-----Test %1 ...", _c]) call BIS_fnc_log;

    And using the latter:

    ("-----Test-----") call BIS_fnc_log;
    
    _c = !isNil {'< my valid steam UID>' call fn_getUIDPermissions};
    
    (format ["-----Test %1 ...", _c]) call BIS_fnc_log; 

     Format also takes care of converting boolean _c into a string, so no need to do the weird string "true"/"false" definition.

    • Like 1

  6. You're going to have to create a graph model of your maze, after which you can apply shortest pathfinding algorithms such as A*.
    These algorithms can be quite resource-intensive so you definitely do not want to run them on each frame.

     

    I'm actually working on a dynamic graph-model representation of Arma's road systems, but my scripts are so specific for that that I don't think they'd be of much use for you.


  7. You can use the moveOut command to safely kick a unit from a vehicle, but then you need a way to determine which units need to be kicked.

    The fullCrew command returns an array which also gives the cargo index for each unit in the vehicle.

    You can compare that to your list of cargo indexes like such (quick and dirty):

     

    _ZamakTrans = nearestObjects [ _this select 0,["Truck_02_transport_base_F"],25];
    if (count _ZamakTrans > 0) then {
    	target = _ZamakTrans select 0;
    	
    	// Kick units from cargo slots and lock them
    	_lockIndexes = [2,3,4,5,6,7];
    	{if ((_x select 2) in _lockIndexes) then {moveOut (_x select 0)};} forEach fullCrew target;
    	{target lockCargo [_x,true];} forEach _lockIndexes
    	
    	// Attach box
    	box attachTo [target,[0,0.25,-0.15]];
    	box setVectorDirAndUp [[1,0,0],[0,0,1]];
    };

     

    • Like 1
    • Thanks 1

  8. Wait you used something else than map markers to indicate where you wanted to spawn enemies @voidbyte?

     

    The "getMarkerPos" command only works for map markers, not for objects. If you're using some kind of helper object to indicate the spots do:

     

    _spawnObjectArray = [opfor_0,opfor_1,opfor_2,opfor_3,opfor_4,opfor_5];
    _unitClass = "O_Survivor_F";
    
    {
    	(createGroup EAST) createUnit [_unitClass,getPos _x,[],0,"NONE"];
    } forEach _spawnObjectArray;

    The createUnit command with the "NONE" special argument places the unit on an approximate position at a free spot near that position.

     

    To make the command spawn the unit exactly where you want, either change "NONE" to "CAN_COLLIDE", or set the position of the unit after it was spawned, like such:

    _spawnObjectArray = [opfor_0,opfor_1,opfor_2,opfor_3,opfor_4,opfor_5];
    _unitClass = "O_Survivor_F";
    
    {
    	_unit = (createGroup EAST) createUnit [_unitClass,[0,0,0],[],0,"NONE"];
    	_unit setPosASL getPosASL _x; (getPosASL is used because it's accurate inside buildings too, unlike the standard getPos)
    } forEach _spawnObjectArray;

     

    • Like 1

  9. I don't think any of these mods would affect this extremely basic script, so what I'm currently thinking of is that your markers are defined wrong.

     

    Execute the following script in the debug console so you can see the positions of your markers:

    ["opfor_0", "opfor_1", "opfor_2", "opfor_3", "opfor_4", "opfor_5"] apply {getMarkerPos _x};

    If these positions are [0,0,0], then the markers don't actually exist and your units spawn there.


  10. You're making small but different syntax errors with everything you're trying to do, read the createUnit page more carefully.

     

    Your first code-block is nonsense, but you figured that out yourself too.

    Your second code-block uses "O_Survivor" as the class, which doesn't exist (It's ""O_Survivor_F")

    Your third code-block has uses a marker as the spawn point instead of a position.

     

    Here's how you achieve what you want to achieve:

    _markerArray = ["opfor_0", "opfor_1", "opfor_2", "opfor_3", "opfor_4", "opfor_5"];
    _unitClass = "O_Survivor_F";
    
    {
    	(createGroup EAST) createUnit [_unitClass,getMarkerPos _x,[],0,"NONE"];
    } forEach _markerArray;

     

    • Like 3

  11. @jbs1949
     

    Spoiler

    It is a little puzzle to get the alien to communicate with you.

     

    You have to hit their signal peaks with whatever noise/music to get them to switch frequency.

    Transmitting at their new signal, and then stopping will then make them transmit a different frequency.

    Use trial-and-error to find which of their peaks you need to hit. If you choose the wrong one, their pattern resets and you can try anew.

     

    When you complete this little frequency hopping dance, you'll get the vision

×