Search the Community
Showing results for tags 'params'.
Found 11 results
-
How can I simplify these three functions without losing their purpose? I get itchy hands when I find myself coding like this, without how to improve my time coding yet. If you'll suggest a functions merge, I will appreciate it if you also explain how should I call it. I have not enough experience with params yet (studying in progress...) THY_fnc_VO_checkPlayerVehRepair = { params ["_eachVeh"]; (alive _eachVeh) AND (speed _eachVeh < 2 AND speed _eachVeh > -2) AND (!underwater _eachVeh) AND ((getPos _eachVeh) select 2 < 0.1) AND (_serviceInProgress == false) AND (!isEngineOn _eachVeh) AND (damage _eachVeh > VO_minRepairService) }; THY_fnc_VO_checkPlayerVehRefuel = { params ["_eachVeh"]; (alive _eachVeh) AND (speed _eachVeh < 2 AND speed _eachVeh > -2) AND (!underwater _eachVeh) AND ((getPos _eachVeh) select 2 < 0.1) AND (_serviceInProgress == false) AND (!isEngineOn _eachVeh) AND (fuel _eachVeh > VO_minRefuelService) }; THY_fnc_VO_checkPlayerVehRearm = { params ["_eachVeh"]; (alive _eachVeh) AND (speed _eachVeh < 2 AND speed _eachVeh > -2) AND (!underwater _eachVeh) AND ((getPos _eachVeh) select 2 < 0.1) AND (_serviceInProgress == false) AND (({getNumber (configFile >> "CfgMagazines" >> _x select 0 >> "count") != _x select 1} count (magazinesAmmo _eachVeh)) > 0) };
-
Help required with passing params to function using BIS_fnc_holdActionAdd .
sekurlsa posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello community, I'm trying to optimize the code and further expand the functionality of a MP mission I've made: HazardZone The idea is to create an Apex's hold action by passing couple of params, issue is I really can't figure out how to pass them - especially line 4, 8 and 9 For example, I just put params ["_sample", "_unit"]; in lines 10-13 and it works like a charm, but is there anyway to do it for the rest or for the whole function without specifying params on each line? Hold Action Function: createSample = { params ["_sample", "_unit"]; [_sample, // Name of the object "Collect a sample", //title of the action "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "_unit distance _sample < 5", // The condition for the Action to be shown "_unit distance _sample < 5", // The condition for the Action to progress {}, // The code executed when the action starts {}, // The code executed on every progress tick {}, // The Code which is executed on action completion {}, // The code which is executed when the player is interrrupted or stops interaction [], // No idea! Some arguments... 5, // The duration how long will it take for the action to be completed in seconds 0, // Priority false, // Remove the action once it has been completed false // show Unconsious state ] remoteExec ["BIS_fnc_holdActionAdd", [0,-2] select isDedicated, true]; }; // This is how the function will be called [objVar, playerVar] call createSample; I really would really appreciate the help. Thank you!- 5 replies
-
- bis_fnc_holdactionadd
- function
-
(and 3 more)
Tagged with:
-
Hello again, everyone. I'm doing my first steps into functions and parameters. Everything in this matter is new for me so here is my idea: For studies purposes, I want to put a helmet in each unit I get close. To set the target units for the function, all I would like to do is set a "call" in each unit-target. That said, my try (not working): myFunctions\TAG_fnc_addingHelmet.sqf: if (!isServer) exitWith {}; TAG_fnc_addingHelmet = { params ["_unit"]; if ( ((player01 distance _unit) < 3) AND (headgear _unit != "H_HelmetB") ) then { removeHeadGear _unit; _unit addHeadgear "H_HelmetB"; hint "Oh, thanks for the helmet!"; }; }; [] spawn { while { alive player01 } do { // Do I need to call the TAG_fnc_addingHelmet function in here somehow? sleep 5; }; }; And all I would like to do is put it (below) in unit init for this call my function: Init of any random unit: [this] call TAG_fnc_addingHelmet; Where are my mistakes, folks? More info: description.ext: class cfgFunctions { #include "myFunctions\TAG_fnc_functions.hpp" }; myFunctions\TAG_fnc_functions.hpp: class TAG { class init { class TAG_addingHelmet { file = "myFunctions\TAG_fnc_addingHelmet.sqf"; preInit = 1; }; }; };
- 6 replies
-
- 1
-
- functions
- first steps
-
(and 2 more)
Tagged with:
-
Using class params for server.cfg on dedicated service
-JpS-RaptorMan posted a topic in ARMA 3 - SERVERS & ADMINISTRATION
I dug around with google search against site:https://forums.bohemia.net/ & had read the related wiki pages already ... but I am trying to clean up my server.cfg & the long list of changes my squad uses for mission parameters is pretty redundant. Is there anyway to share the mission parameter list between maps (I know sqf isn't really OO, but the underlying system for arma3 is)? I took a few stabs at various formats but not having much luck ... // // --- Mission file settings // class Missions { class Mission_1 { template = "Antistasi-WotP-2-3.Tanoa"; difficulty = "regular"; class Params { AntistasiJps001; }; }; class Mission_2 { template = "Antistasi-Altis-2-3.Altis"; difficulty = "regular"; class Params { AntistasiJps001; }; }; class Params { class AntistasiJps001 { loadsave = 1; gameMode = 1; autoSave = 1; autoSaveInterval = 3600; membership = 1; ... }; }; }; Thanks!-
- arma3
- hosted server
-
(and 2 more)
Tagged with:
-
params wogz187 learns Function Call Params
wogz187 posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I'm going to learn how to use params in order to make future scripts more effective and you might learn something about params, too (please use the debug console if you want to follow along). A simple example, fnc_learnThis= { params ["_caller","_some","_thing","_luck"]; if (_luck>0) exitWith { systemChat format ["%1", _caller]; systemChat format ["%1 %2", _some, _thing]; }; }; With some luck this call will prompt the functions to run with the parameters set, [player, "is", "cool",1] call fnc_learnThis; The next example shows how to select from an array and sub-array. We can create some helpers and make the orb jump between them. Make three sets so the result isn't binary. Create the array of helpers from named objects like this, Enter the function, and call the function with, [orb, 0] call you_fnc_help; The orb should continue to go around between the three helpers each time you enter the call. To change to the next helper group, [orb, 1] call you_fnc_help; More examples continue throughout the discussion below, Have fun! -
params Can't make the mission parameters to work properly
hydrobull3t posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello guys! Not long ago I had posted a topic with a problem in my loadout. I have tried long ago to fix it, but I forgot all of the scripting I have learned so there wasn't much to do... Unit today I had tried again as I am currently in a vacation from my military services (got injured). Well, I figured out that the loadout script and everything is ok, but the problem is much more small than I thought it is. I am using Mission Parameters to choose between Night or Day loadout, Add or Remove NVG according to mission time, as well as Silencer and Map Nav Aids. As the updates started to come the code was outdated, But I have tried couple of time to fix it with no luck.. If someone done it or Know how to fix it, Please reply here, As I want to regroup my old friends to start play again in this awesome MilSim. Loadout Description RPT Log fn_processParamsArray Huge Thanks Guys!!! -
Hi. I want to write a small function, spawning a soldier at a marker (just an understanding thing, I know it's way more easy to do this in a different way). params [ ["_class","",[""]], ["_wp","",[""]] ]; _posStart = getMarkerPos _wp; _grp01 = createGroup east; _unit01 = _grp01 createUnit [_class, _posStart, [], 0, "CAN COLLIDE"]; It's working, when called with _spawnUnit = ["O_G_Soldier_F","marker1"] call TACP_fnc_Test_spawnSoldier; Given class is spawning at the marker. But I always got the failure message "'call{_spawnUnit |#|= ["O_G_Soldier_F","marker1"] call TACP_fnc..." Error Generic error in expression." What am I doing wrong? *confused*
-
Patrol Script - Need to pass Object as a param
MrGamer100 posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hey there! I've begun learning SQF scripting around a week ago, so still quite the newbie. I've been reading through the Fockers tutorial series (which I have yet to finish), and decided to try and get some practical experience making something, since that's the best way I learn code. My friend, who makes missions and does zeus stuff, suggested I make a patrol script. I liked the idea, and went along with trying to make a patrol script callable by execVM, accepting the calling unit and an array of Markers as parameters. The script works by sending the entire group to those markers assuming the group still exists and there's at least one unit alive in it. If the marker they are about to head to does not exist, the marker is deleted from the array and the loop starts from the beginning until a valid marker exists. Irrelevant at this point as I can't test to make sure that actually works, since I can't seem to get an object param passed to the file. It looks like it only accepts arrays, which I am having trouble understanding. So I need to solve this one of two ways: I need to find a way to pass an object as a parameter and keep it intact when it reaches the function. Or, I need to find a way to take the array sent as the unit, and turn it back in to the object, which I don't know how to do. This script is meant to be multiplayer friendly (despite me not having the slightest clue of how to code it for multiplayer) so please keep that in mind with the solution. My goal is not to just come to a solution to fix my issue, but to understand why it works, since I'm trying to learn SQF and understanding what the code is doing and why will help me advance in that goal. I appreciate the help and can try to give as much information as I can when asked. This is in the team leader's init box: patrolArray = [patrolMarker1, patrolMarker2, patrolMarker3]; PatrolScriptHandle = [this, patrolArray] execVM "Patrol.sqf"; This is the Patrol.sqf: // Patrol.sqf // Parameters: // 0: (Object) Unit // 1: (Array) Markers params ["_unitObject", "_markerArray"]; debugPatrolRunning = True; // Use this only for debug purposes to see if the script is still running. _unitMarkerPatrolArray = _this select 1; _patrolArrayCount = (count _unitMarkerPatrolArray) - 1; _unitGroup = group _this select 0; _shouldRun = True; while (_shouldRun) do { scopeName "patrolCheck"; sleep 0.1; for "_i" from 0 to _patrolArrayCount do { _unitsAlive = {alive _x} count units _unitGroup; _curMarkerSelection = _unitMarkerPatrolArray select _i; if ( isNull _curMarkerSelection ) then { _tempA = [_curMarkerSelection]; _unitMarkerPatrolArray = _unitMarkerPatrolArray - _tempA; _tempA = nil; breakTo "patrolCheck"; }; if ( _unitsAlive >= 1 && {!isNull _unitGroup} ) then { // I don't think I can use the Marker object itself in getMarkerPos, so let's convert it to string first. _curMarker = format ["%1", _curMarkerSelection]; _unitGroup move getMarkerPos _curMarker; sleep random [3, 5, 10]; } else { _shouldRun = False; debugPatrolRunning = False; breakOut "patrolCheck"; }; }; };- 5 replies
-
- scripting
- troubleshooting
- (and 4 more)
-
[solved] check if param is piece of code
M1ke_SK posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I have params defined like this: params ["_object", ["_code", {}]]; Question: how to check if there is some code? if !(_code isEqualTo "") then { _object spawn _code; }; -
passing parameters getting returns problem
stuguy posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I am very familiar with programming and I have been experimenting how ARMA passes variables to functions. I think I understand how params and param work, but I am having difficulty calling a function to return a desired result. This below code is simply trying to call on a function that requires the input of a group, in this instance, I am sending it "group player" with the call function. From what I understand, the function returns the last line, so the count should return the number of men in the group. However, it sends an error stating that it is expecting a number, but is getting type string. This is confusing because I am sending it Group Player, an array of men to be counted. Just writing a count out with "_num = count units group player" works without a hitch. So why is it I am unable to pass it the _grp parameter? getGrpCount = { param ["_grp"]; count units _grp; }; _num = [group player] call getGrpCount; hint format ["%1",_num]; no workie _num = count units group player; hint format ["%1",_num]; works Existing user? Sign In -
ok so basically I'm editing some code of load outs, and as I am told call Bis_fnc_Param (is no good). and private []; "should be" params []; but as I do so, (change code) I see no difference. old Private ["_unit","_PERIdent","_Randomise","_role","_Uniforms","_Voice","_Uniform","_Headgear","_Goggles"]; _unit=[_this,0,objNull,[ObjNull]] call Bis_fnc_Param; _PERIdent=[_this,1,true,[true]] call Bis_fnc_Param; _Randomise=[_this,2,true,[true]] call Bis_fnc_Param; _role=typeOf _unit; new params ["_unit","_GBIdent","_Randomise","_role","_Uniform","_Uniforms","_Voice","_Headgear","_Goggles"]; _unit = param [0]; _GBIdent = param [1]; _Randomise = param [1]; _role = typeOf _unit; why is the reason of using params to private, or the reason to need to change and not use call Bis_fnc_Param ? I don't see the optimization. I'm Only asking so ill have a better understanding wiki explains params ["_one","_two","three"]; blah blah blah [1,2,3]; better yet I wish people posting in wiki would sometimes remember that no everybody understands and maybe should post some working code as an example kinda like what I posted above (but with the rest of the code).