Jump to content

Sgt. Dennenboom

Member
  • Content Count

    88
  • Joined

  • Last visited

  • Medals

Community Reputation

91 Excellent

3 Followers

About Sgt. Dennenboom

  • Rank
    Corporal

Profile Information

  • Gender
    Male
  • Location
    Knee-deep in UXO
  • Interests
    Physics & Scripting

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I'm not sure how your graphical interface works, but I guess if both admins place flags there will be two pairs of flags. You could either make it so the other admin cannot place flags when they already exist, or so that the new pair of flags replace the old pair. Determining the best solution would require your interface I guess.
  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. Sgt. Dennenboom

    AI multiplier

    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.
  4. Sgt. Dennenboom

    AI multiplier

    Definitely possible, how are the AI created?
  5. 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): If you let the client handle this from init.sqf it would look something like this: 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.
  6. The server and every client calls init.sqf when joining, and your script broadcasts the command to everyone so you get duplicates. You could either remoteExec your command from the server (with the JIP parameter set to true), or call it from init.sqf or initPlayerLocal.sqf instead of remoteExec.
  7. Sgt. Dennenboom

    [Solved] Debugging with IF statement & isNil

    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.
  8. Sgt. Dennenboom

    Can't we put vehicle weapons in Infantry?

    Adding vehicle weapons to infantry was disabled in the last patch 😭
  9. 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.
  10. 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]]; };
  11. Sgt. Dennenboom

    Helping with Syntax for CreateUnit

    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;
  12. Sgt. Dennenboom

    Helping with Syntax for CreateUnit

    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.
  13. Sgt. Dennenboom

    Helping with Syntax for CreateUnit

    My script works just fine for me. Where/how do you execute it? How did you create your markers?
  14. Sgt. Dennenboom

    Helping with Syntax for CreateUnit

    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;
  15. But to correct the code you're using (without regarding whether it's the best solution or not): In editor object init field: _null = this spawn {while {alive _this} do {_this setFuel 1; sleep 60;};};
×