Jump to content

Larrow

Member
  • Content Count

    2704
  • Joined

  • Last visited

  • Medals

Community Reputation

1503 Excellent

About Larrow

  • Rank
    Warrant Officer

Profile Information

  • Gender
    Male
  • Location
    LAR setpos (you getpos [-2,getdir you]);LAR say3d["BOO!"]

Recent Profile Visitors

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

  1. Dont go using profileNamespace as a tempory store for variables like that. AddAction already has a parameter for passing in variables to the actions code OR you can save the variables on the player object using setVariable. _spawnPos = getPosATL player; //Store teleport position on player object player setVariable[ "telePos", getPosATL player ]; //Example passing in variable to actions code player addAction["<t color='#d9006c'>Go to Spawn</t>", {player setPosATL ( _this select 3 );},_spawnPos]; //Retreive value from player object player addAction["<t color='#bfff00'>Teleport</t>", {player setPosATL ( player getVariable "telePos" );}]; player addAction["<t color='#4cffff'>set Teleport</t>", {player setVariable[ "telePos", getPosATL player ];}];
  2. That's cool, no better way to learn that writing your own code. Consider learning to use the functions library( CfgFunctions ) and place all your functions for a particular system in one folder. This way all you have to do is copy and paste the folder into a new mission and update the reference in description.ext. Much like the actionMenu I linked in my previous post. This will enable you to separate out your code into individual functions, enabling better readability and you are not looking at actions embedded in actions all with their code. Are you sure the variables are defined from where you originally call? Try replacing the params for this... If you receive the "Invalid Arguments...... " error then either a variable is not defined( is Nil ) or possibly of the wrong type. What exactly are _activate, _show and _hide for? Other than assigning their values they are never actually used for anything in your code. So these slingloadactivate, heloslingloadtakeoff and supplyhelolanded must be global variables, is there really any need to pass them around if they are global? Same with player1 as that is what you are placing the actions on I'm presuming this is possibly the local players vehicleVarName( name given to unit in Eden )? If so why not just use player, again no need to pass the variable around. slingloadhelogroup this must be a group as your are adding waypoints for it. Where does this variable come from? Set in Eden? or assigned somewhere else? Again its already a global variable so is there really any need to pass it around? The rest I presume are all objects as you retrieve their positions in your code. Names set in Eden? or assigned else where? I would recommend adding each action separately, all at the same time, then use its condition argument for when to show it... Easier to read. No actions embedded in actions. No need to keep removing/adding actions. Although this all depends on how large your menu system is going to be, on whether this may adversely effect client performance. Even so once you have it working you can think about adding/removing each menus actions as needed. Just a few things to think about.
  3. Maybe this helps? Rather than reinventing your own? There is no need to unpack the variables in _myPassedVariables if all you are doing is passing them to a script. Just pass the whole array... { params ["_target","_caller","_actionID","_myPassedVariables"]; //snip _nul = _myPassedVariables execVM "1slingload1.sqf"; } This is also true for your main function, there is no need to _this select # each variable if all you are doing is packaging them back up in the same order into _myVariables. _myVariables would just be the same as _this. There is also no need to rename _myPassedVariables eg. _myPassedVariables1 , 2, 3 etc. They each exist within their own scope so will not effect each other. For note this... Is the same a doing... Improves readability and has the added benefit of making the variables private, making sure no variable is overwriting one from a parent scope.
  4. //Make an array of variables to send to the action _myVariables = [_activate,_show,_hide,_player,_slingloadgroup,_trashloc,_slingloadhelortb,_vehiclesupplyloc,_supplyloc,_cargonetloc,_technicalloc,_truckloc,_repairloc]; //Add the action _player addAction [ //Action Title "SUPPORTS", //Action code { //Default variables provided to the code via the action //_target is the entity the action is placed on( _player ) //_caller is the unit that used the action //_actionID is the ID of the action( can be used to remove the action from the _target ) //_myPassedVariables is whatever is passed as param 2 of the action( //PASSED VARIABLES ) params ["_target","_caller","_actionID","_myPassedVariables"]; //As _myPassedVariables is an array( _myVariables ), now extract each variable from the array _myPassedVariables params ["_activate","_show","_hide","_player","_slingloadgroup","_trashloc","_slingloadhelortb","_vehiclesupplyloc","_supplyloc","_cargonetloc","_technicalloc","_truckloc","_repairloc"]; //Remove this current action from the _target _target removeAction _actionID; }, //PASSED VARIABLES, variables passed into actions code @ param 3 _myVariables, 10, //Priority false, //Show Window true, //Hide on use "", //Shortcut //Condition //Make sure only the unit who has the action attached to them( _target ) can use the action( _this ) //Mainly for MP so a player cannot use an action attached to another player "_target isEqualTo this", //Distance3D 3 ];
  5. Larrow

    Trigger synced with vehicle

    Place empty vehicle. Place trigger. Right click trigger and select "Connect" > "set trigger owner" and select the vehicle. (Should end up with cyan line from trigger to vehicle) Open up the triggers attributes and change its condition... player in triggerAttachedVehicle thisTrigger Change any onAct/onDeAct as needed. But do not change any of its dropdowns (Type, Activation, Activation Type ).
  6. Yes getMissionLayerEntities "LayerName" params[ "_objects", "_markers" ]; { deleteVehicle _x; }forEach _objects; { deleteMarker _x; }forEach _markers;
  7. The easiest option is most probably to place all the objects that are removable onto a layer in the editor and get them all during runtime via getMissionLayerEntities.
  8. Just use apply, rather than compiling the string. Bools stored as numbers. TAG_fnc_getBoolArray = { params[ "_path" ]; getArray( _path ) apply{ _x > 0 }; } Bools stored as strings. TAG_fnc_getBoolArray = { params[ "_path" ]; getArray( _path ) apply{ _x == "true" }; }
  9. Larrow

    Set button image

    Or use a RscActivePicture/KeepAspect that can use ctrlSetText to set its picture, of which also behaves as a button.
  10. How about an Eden tool something like... Just run it from the debugConsole whilst in Eden. Could have some better options for drilling down to specific sets, but will do as a quick test piece.
  11. He said to filter, and likely meant to filter out anything that is < 2. Same as the example that filters inclusion of scope >= 2. ConfigClasses returns an array of config paths. Applying configname to each path returns the items class name.
  12. Aye should really read... _rotateDistance = 5; _minArrivalDistance = 1; //While the unit is more than min arrival distance away from target while { _unit distanceSqr _targetPosition >= ( _minArrivalDistance ^ 2 ) } do { Is there just to make sure what ever min distance is, is squared, I realise 1^2 == 1
  13. Could always use linearConversion to retrieve a direction based on time or distance. Code just as an example to get idea across. Would need playing with... _targetPosition = /*some postion*/ _targetDistance = _unit distanceSqr _targetPosition; _minArrivalDistance = 1; _rotateDistance = 5; //While the unit is more than minArrivalDistance away from target while { _unit distanceSqr _targetPosition >= ( _minArrivalDistance ^ 2 ) } do { //If the relative dir to the target is <> 5 degree from facing //Just to try and stop to many distance calcualtions if !( _unit getRelDir _targetPosition < 5 || { _unit getRelDir _targetPosition > 355 } ) then { //Get a direction to face, based off of... _dir = linearConversion[ //From starting distance _targetDistance, //To starting distance minus the rotating distance (( _targetDistance - ( _rotateDistance ^ 2 )) max ( _minArrivalDistance ^ 2 )), //Based off of current distance from unit to target _unit distanceSqr _targetPosition, //Turn from current facing direction getDir _unit, //May need to be starting direction //To the direction to the target _unit getDir _targetPosition, //Clamp the value true ]; //Set units direction _unit setDir _dir; }; };
  14. TAG_fnc_cancelTask = { params[ "_taskID" ]; if ( _taskID call BIS_fnc_taskExists && { !( [ _taskID ] call BIS_fnc_taskState in [ "CANCELED", "FAILED", "SUCCEEDED" ] ) } ) then { _taskDescription = [ _taskID ] call BIS_fnc_taskDescription; _taskDescription set[ 0, "The task has been canceled" ]; [ _taskID, _taskDescription ] call BIS_fnc_taskSetDescription; [ _taskID, "CANCELED" ] call BIS_fnc_taskSetState; }; }; _taskID = format[ "Tarea_%1", _IDTarea ]; _descript1 = format[ "<execute expression='[ %1 ] call TAG_fnc_cancelTask'>CANCEL</execute>", str _taskID ]; [blufor, _taskID, [_descript1,_titulo,_marker], _posicion, true, 1, true] call BIS_fnc_taskCreate;
  15. They changed some of the initialisation code for modules in A3 1.88. If the module needs to initialise on the server then you have to set this flag to false. Otherwise the module will just sit there waiting. So either the above (when done exactly as you spawn the module) or... _cas setVariable [ "bis_fnc_initModules_activate", true, !isServer ]; at sometime after module creation.
×