Jump to content

Zenophon

Member
  • Content Count

    530
  • Joined

  • Last visited

  • Medals

Everything posted by Zenophon

  1. You could add this to the player's init field: titleText ["Good Luck", "BLACK FADED", 0.3]; That should black out the screen for a few seconds and give the server and clients time to synch. Just adjust '0.3' to increase or decrease the time. This seems like cheap trick but it is better than nothing.
  2. You could try this: http://community.bistudio.com/wiki/enableSimulation
  3. The 'enableSimulation' command would work well. It saves a lot of CPU cycles when used on AI, and is easy to switch on or off. It also reduces network traffic a lot in multiplayer. Be sure to read the comments on its wiki page for details. Using both commands removes the object entirely, except you still cannot walk through it. If you want to quickly disable objects in a large area, you could try something like this in the On Act. field of a trigger: { _x enableSimulation false; _x hideObject true; } forEach thislist; You could simply reverse that in the On Dea. field. Then just figure out a good condition for the trigger. The merge function in the editor is also nice. If you need everything to be extremely precise, then placing objects in the editor will be the only reasonable way to do it, time-wise. However, if you are willing to have some randomization, you could write some very general, reusable functions to populate an area with infantry and vehicles. You might want to consider EOS: http://forums.bistudio.com/showthread.php?153100-Enemy-occupation-system-%28eos%29 If you design your own functions, I recommend starting with small functions that you can later combine into a more complex system. This is much easier to debug and more flexible.
  4. For the objects falling through the table, that is a side effect of them being physics-enabled when they spawn. Add these lines at the end the forEach loop: _intel enableSimulation false; _table enableSimulation false; That should disable the physics, and the object will probably never move. I tested this on a hill and neither the table nor the object fell down the hill. I also tested the action and it still worked. Regarding the error, it means that some command was expecting a string, but got an array. I cannot reproduce that error no matter how many times I run the function. The only string used in the loop is the current element of the array (defined as '_x'). Ensure that all of the tables exist in the editor (you would get a different error if they did not, but it doesn't hurt to be thorough). I assume that the error appears when using different object classnames, so try spawning each one like this to confirm that is it not the objects themselves: _intel = createVehicle ["Land_File1_F", (getPosATL player), [], 0, "NONE"]; If all of the objects spawn without errors, then try to determine if the error is completely random or if there is some pattern. Run the mission 5 or so times every time you change anything and see how many times the error appears. It could also be some sort of variable scope issue (I have seen some strange ones). You might want to define '_x' as another variable and declare all variables private for the function. I am not sure how you are defining and calling this function, but I recommend that you place it in your init.sqf like this: RandomIntel = { private ["_tableArray", "_table", "_intel", "_intelClassname"]; _tableArray = [table1, table2, table3, table4, table5]; { _intelClassname = _x; _table = (_tableArray select (floor (random ((count _tableArray) - 0.0001)))); _tableArray = _tableArray - [_table]; _intel = createVehicle [_intelClassname, (getPosATL _table), [], 0, "NONE"]; _intel setPosATL [((getPosATL _table) select 0), ((getPosATL _table) select 1), (((getPosATL _table) select 2) + 0.8)]; _intel addAction ["Investigate", (format ["agia%1.sqf", (_forEachIndex + 1)])]; _intel enableSimulation false; _table enableSimulation false; } forEach ["land_suitcase_f", "land_bucket_f", "Land_SurvivalRadio_F", "Land_BottlePlastic_V1_F", "Land_Basket_F"]; }; I have included the changes that I suggested above in that code. Also, I would call it like this: 0 = [] call RandomIntel; If none of this works, then I am at a loss for what is causing the error. If the function works in an empty editor mission with just tables, then something else in your mission could be conflicting with the function somehow.
  5. Firstly, what exactly do you mean by 'saving' objects? You could simply add their names to a global array with a clear, precise name and then use it somewhere else. You could create some templates for spawning with very exact arguments. You might want a script that can very accurately record the current state of the mission and recreate it later. Secondly, spawning a patrol is basically always the same as what you have there. Get a position, spawn the group, order the group to patrol. You are going to need about three lines of code for each group spawned. You could use loops and patrol scripts that manage multiple groups at once. You could write or find a random position system so you have to place fewer markers. I am not sure what you mean by the code looking 'horrible'. If you use someone else's spawning system, their code will follow the same three steps, you will just not be able to see it. Also, they will add a lot of extra code on top to provide extra features if you do not want to code them yourself. Clean, fast code is good, but making it work the way you want is the priority. You already have BIS functions and UPS doing the majority of the work for, so it is not like you are starting from scratch. Regarding the HC module, I have never used and cannot give any solid advice about it.
  6. You could try this: (driver this) disableAI "FSM"; (driver this) disableAI "TARGET"; (driver this) disableAI "AUTOTARGET"; Just put that code in the helicopter's init field. Being shot at causes the AI to start running a lot of code so that they do not look robotic or helpless. It does not always work very well, as you can see. Preventing fsm's from running could prevent some of their wild behavior. I did not test this and it will probably not fix everything. You should also make sure that their waypoint behavior is "careless" and the speed is "limited".
  7. The 'setPos' command will move an object regardless of where it was originally spawned, so adding those arguments to 'createVehicle' would not change anything. If you want different intel items to appear on different tables, you can pick a table at random to use. You could try a loop like this: _tableArray = [table1, table2, table3, table4, table5]; { _table = (_tableArray select (floor (random ((count _tableArray) - 0.0001)))); _tableArray = _tableArray - [_table]; _intel = createVehicle [_x, (getPosATL _table), [], 0, "NONE"]; _intel setPosATL [((getPosATL _table) select 0), ((getPosATL _table) select 1), (((getPosATL _table) select 2) + 0.8)]; _intel addAction ["Investigate", (format ["agia%1.sqf", (_forEachIndex + 1)])]; } forEach ["land_suitcase_f", "land_bucket_f", "Land_SurvivalRadio_F", "Land_BottlePlastic_V1_F", "Land_Basket_F"]; This code should keep the order of objects the same, so that the action assigned to them uses the correct script, the tables should be used in a random order. There can more tables than there are objects, if you really want to randomize it (players won't know which tables to go to each time). But you cannot have fewer tables than objects, that would break the script. This is tested and working with those objects and both 5 and 6 tables; the actions also work (I just used test scripts to make sure the numbers match).
  8. You could just use two triggers, one with a radio command, and another with a condition for there being no humans on the blufor side. The triggers would activate the same code, and they could delete the other one when they fire. Only one trigger will ever fire anyway though.
  9. Zenophon

    handle damage eh

    As a last-ditch effort, you could code your eventhandler to filter out damage to parts that are not overall damage. It appears that the overall damage is being added up as some function of the part damage and returned along with the part damage. If you dealt with just overall damage, the eventhandler would only run one or two times when unit is hit. Alternatively, you could do the opposite and filter out overall damage and damage only certain parts: http://community.bistudio.com/wiki/setHit Unfortunately, there is no getHit or similar command, so it may be impossible to keep track of damage. You could even try other eventhandlers, such as 'hit', 'damaged', or 'hitPart', and try to prevent the unit from dying. I wish you luck, but it seems that there is no solution, for the time being.
  10. Thank you for answering all of my questions, I did not mean to overwhelm you. You could confirm that the code is running placing something like 'hint "Spawning Intel";' just above the code to create the objects. The 'createVehicle' statements could say 'getPosATL tab#' instead of 'getMarkerPos "intel#"'. You would then not need the intel markers (unless you are using them elsewhere in your mission). You could also replace '(((getPosATL _intel5) select 2) + 0.8)' with '(((getPosATL table1) select 2) + 0.8)'. These two changes will make 'table#' your only global variable so that it is easier to debug. I recommend starting in a blank editor mission to test creating just a single object. Place a player unit and a table named 'table1', then in the debug console, execute this: _intel1 = createVehicle ["land_suitcase_f", (getPosATL table1), [], 0, "NONE"]; _intel1 setPosATL [((getPosATL table1) select 0), ((getPosATL table1) select 1), (((getPosATL table1) select 2) + 0.8)]; _intel1 addAction ["Investigate", "agia1.sqf"]; There should be a table with a suitcase on top that has an action to 'Investigate' (the action may take a little while to appear for some odd reason). I used a suitcase to make sure there are no issues with the objects you are trying to spawn. The action will not do anything, but this confirms that the action would work if you had the script in your mission folder. If you can get the above to work, then just duplicate it for all the tables and change the object classname to what you want. If you confirm that the script is actually running and test after every change, you will be able to see what causes the problem.
  11. Zenophon

    handle damage eh

    Looking at that, handle damage seems more broken than I thought. If the reports at T=3.38 and T=3.408 are from the same bullet, then there could be an engine or config issue with simulating the bullet hitting the unit. The times on those reports look like they are about 1 frame apart (depending on your framerate), meaning that perhaps the engine calculated multiple impacts on different frames. The report at T=3.408 repeats itself with different values for damage, so maybe the engine thinks that the bullet hit three times. Also, the appearance of '<NULL-object>' is probably not a good sign. It is possible that the bullet is hitting body armor, and the engine is attempting to use some armor config value to modify the damage or the bullet in some way. I am not sure how much body armor logic has been implemented into the engine. Helmets are also supposed to have armor. This could also be an issue with the engine calculating bullet penetration of the unit or the armor. It is even possible that the bullet deflected or passed through the unit's rifle, causing the hands to be damaged. You could try several things to see what the effect would be. First, use an unarmored civilian to test. Second use a less powerful weapon; it is possible that the damage spreads based upon the amount. If you use a pistol, the damage to parts you did not hit may be nearly 0 or there may not be duplicates. If the damage does spread, that could explain a lot of duplicate hits that did not come directly from the bullet (even thought the bullet is printed in the results). The last thing to try is to use a handle damage eventhandler with no code in it, except to print information, and use an new, empty mission in the editor. You should try to test the pure behavior of the eventhandler without anything else that could interfere. In the end, speculating and testing is almost useless until BIS fixes this eventhandler, as only they know the exact details of the engine code.
  12. Firstly, I recommend 'setPosATL', 'getPosATL', and 'createVehicle array' as they execute faster. http://community.bistudio.com/wiki/setPosATL http://community.bistudio.com/wiki/getPosATL http://community.bistudio.com/wiki/createVehicle_array Secondly, what is tab2, tab3, etc? Thirdly, what is 'this select 1'? Are they any arguments to this function? You must use '_this' to get arguments. Fourthly, the 'setpos' statements are either in 2d or missing a comma before the third element. Fifthly, what error message appears in-game? What exact error does it name? What line does it name? Sixthly, how are you calling this function? Lastly, what is in 'agia1.sqf', 'agia2.sqf', etc.? Can you see the actions? Do they work? Knowing all that would help, but here you go anyway: private ["_intel1", "_intel2", "_intel3", "_intel4", "_intel5"]; _intel1 = createVehicle ["Box_East_Ammo_F", (getMarkerPos "intel2"), [], 0, "NONE"]; _intel1 addAction ["Investigate", "agia1.sqf"]; _intel2 = createVehicle ["ARP_Objects_computer", (getMarkerPos "intel2"), [], 0, "NONE"]; _intel2 setPosATL [((getPosATL tab2) select 0), ((getPosATL tab2) select 1), (((getPosATL _intel2) select 2) + 0.8)]; _intel2 addAction ["Investigate", "agia2.sqf"]; _intel3 = createVehicle ["ARP_Objects_Folder", (getMarkerPos "intel3"), [], 0, "NONE"]; _intel3 setPosATL [((getPosATL tab3) select 0), ((getPosATL tab3) select 1), (((getPosATL _intel3) select 2) + 0.8)]; _intel3 addAction ["Investigate", "agia3.sqf"]; _intel4 = createVehicle ["ARP_Objects_toughbook", (getMarkerPos "intel4"), [], 0, "NONE"]; _intel4 setPosATL [((getPosATL tab4) select 0), ((getPosATL tab4) select 1), (((getPosATL _intel4) select 2) + 0.8)]; _intel4 addAction ["Investigate", "agia4.sqf"]; _intel5 = createVehicle ["ARP_Objects_Folder", (getMarkerPos "intel6"), [], 0, "NONE"]; _intel5 setPosATL [((getPosATL tab5) select 0), ((getPosATL tab5) select 1), (((getPosATL _intel5) select 2) + 0.8)]; _intel5 addAction ["Investigate", "agia5.sqf"]; I assume you want to create each object, move it to a height of 0.8, and then add an action to it. That function should do that, but you might want to check that your marker and object names match up.
  13. First, I made an obvious mistake in the example of using the function. It should be 'spawn' not 'call' that is used. I have edited my previous post to reflect that. Next, looking at your mission and poking around the mission.sqm, I saw that you used my function four times in four task modules. That would create four threads that are looping at the same time, causing odd behavior. To clarify, execute the function only once from a single object's init field in the editor. Also, I did not find a create task module named 'task00', even when searching for that word in the mission.sqm. However, the call to Zen_AssignRandomTask includes 'task00' as an argument. Make sure you create that task with a module or a script. Then, I tested in an empty mission to confirm that it worked. I set up four task modules synch'd to the player and used my function and BIS functions in the debug console to test. I found an odd issue with BIS_fnc_taskSetCurrent in which the function redefined the local variable '_task'. I am not sure if there is some error in the function itself or it is a bug. There is some issue with variable scope that I cannot track down in the BIS functions. To fix this, I have used 'spawn' instead of 'call' for BIS_fnc_taskSetCurrent; I have made this change in my previous post. Also note, in my tests I used BIS_fnc_taskSetState to complete the tasks, but I assume that a task state module works the same way. Finally, I did get the function to work in singleplayer, but I still cannot comment on multiplayer performance.
  14. Zenophon

    handle damage eh

    The handle damage eventhandler fires for each body part that is hit (head, body, hands, legs, and overall). See this wiki page for details: http://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HandleDamage The 'setDamage' command sets overall damage, and this may be causing damage to hands or legs to kill the unit, if the part damage value is transfered to overall damage. Because the eventhandler fires five times instantly, the line 'if (damage _unit + _dmg >= 1)' could have been true at least one time or more. Another instance of the function could have seen something different and determined that 'if (_reviveScriptDamage > 1)' was true, killing the unit. Your logic to determine if a downed unit is shot again could cause the function to think a hit in the hands was from a different bullet because of the order that eventhandler fired for each part. Also, because 'hint' replaces the last hint, I recommend using 'diag_log' or even 'player sidechat'; this will show you how many times something is printed and if there is anything else being printed. In general, you are going to need to print out a lot more debug information throughout the function to trace its behavior. Sorry that I cannot point out exactly what lines of your function cause the problem, but you did say you wanted ideas. The code you posted seems like part of a larger system, so I cannot just copy the function into the editor and test it. Honestly, handle damage is not working as well as it could (it should only fire for one part that was actually hit by the bullet), so making a good wounded system is fairly difficult.
  15. I assume you are using an editor trigger to complete the first task. The code I wrote below will run in parallel with the trigger until the first task is completed. Then, the function relies on another trigger to complete the next task, and so on. In you init.sqf, define a function like this: Zen_AssignRandomTask = { /* * Loops through the given array of tasks and uses BIS functions to set * a new random task as current when the current task is failed or succeeded * Params: 1. Array of strings, the task names * Return: Null */ if !(isServer) exitWith {}; private ["_taskArray", "_task"]; _taskArray = _this select 0; _task = _taskArray select 0; _taskArray = _taskArray - [_task]; 0 = [_task] spawn BIS_fnc_taskSetCurrent; while {((count _taskArray) > 0)} do { waitUntil { sleep 2; (([_task] call BIS_fnc_taskState) in ["failed", "succeeded"]) }; _task = (_taskArray select (floor (random ((count _taskArray) - 0.0001)))); _taskArray = _taskArray - [_task]; 0 = [_task] spawn BIS_fnc_taskSetCurrent; }; }; You could then call the function from any object's init field in the editor like so: 0 = [["task0", "task1", "task2", "task3", "task4"]] spawn Zen_AssignRandomTask; You will have to change 'task0' etc to the correct names of your tasks, and this function sets the first task a current for you. This is untested in both singleplayer and multiplayer, as I cannot test it in the context of your mission (actually giving the tasks that this script requires). If it does not work in multiplayer, try removing 'if !(isServer) exitWith {};' from the beginning of the function. I do not use the BIS task functions very much, so I do not know how well they work in multiplayer or if you need that check. I also assume from briefly looking at the BIS functions about tasks, that the units that get the task set as current are given when calling BIS_fnc_taskCreate and not BIS_fnc_taskSetCurrent. If this does not work in multiplayer, consider looking for tasks systems made by community members, as they might be able to manage tasks better than manually calling BIS functions.
  16. Copy the function below into your init.sqf to define the function, then call it like so: SectorArray = ["sector1", "sector2", "sector3"]; NearestMarker = [sectorArray, player] call Zen_FindMinMarkerDistance; The function itself: Zen_FindMinMarkerDistance = { /* * Evaluates the distance between each element of an array and a given center * Params 1. Array of markers, the array evaluate * 2. Object, position, or marker, the center * Return: Element of array that is closest to the center */ private ["_testArray","_center","_outElement"]; _testArray = _this select 0; _center = _this select 1; if (typeName _center == "STRING") then { _center = getMarkerPos _center; }; _outElement = _testArray select 0; { if (((getMarkerPos _x) distance _center) < (_center distance (getMarkerPos _outElement))) then {_outElement = _x;}; } forEach _testArray; _outElement }; This function only accepts an array of markers, it can be changed to accepts objects and positions, but that requires more code that you do not seem to need. It does accept an object, position, or marker for the center. This function will return the name of the marker, not its position.
  17. Zenophon

    Set min health for nonplayable

    You would first need an eventhandler to control how much damage the unit received to prevent them from dying. In the unit's init line in the editor, write something like this: this addEventHandler ["HandleDamage", { (if (((damage (_this select 0)) + (_this select 2)) > 0.99) then { (_this select 0) setDamage 0.98; (_this select 0) switchMove "AinjPpneMstpSnonWnonDnon"; 0 } else { (_this select 2) }); }]; You can then add an action to heal/revive the unit; this action only appear when the unit is in the wounded/incapacitated state. In the init field after the above code, use this: this addAction [format ["Revive %1", (name this)], {(_this select 0) setDamage 0.5; (_this select 0) switchMove "";}, 0, 0, false, true, "", "(damage _target) > 0.96"]; This may not work in multiplayer, and it is just a very quick system to show you what you would need to do this. It is also instant and magical, and it probably does not work well with IFAK's (they would prevent the action from appearing). I have tested it on a civilian and it works well in singleplayer in stable patch 0.76. If you want a much better medical system, you will have to search this forum or google.
  18. Zenophon

    [HELP!] stealing the intel.

    It is unclear if you want to script a random location for the intel, if so you will need to generate a random position in the town and deal with placing the object in a building so that its not in a wall, under the floor, etc. Regarding a script to interact with it, I will assume that you already placed the object in the editor. In the object's init field, write something like this: this addAction ["Steal Intel", {(_this select 0) removeAction (_this select 2); (_this select 1) switchMove "AmovPknlMstpSlowWrflDnon_relax"; sleep 30; (_this select 1) switchMove "";}]; When a player uses this action, the action will be removed and the player will kneel down for 30 seconds, then stand back up. The player can still slide around a little even though no animation is played and look around also. I am not sure if you want to complete a task or have something happen in the mission when the intel is stolen, so I did not include anything like that. K120's suggestion is a good idea, so the player does not get bored and try to move away or do something else. You should also take K120's advice about calling an external file; it will be easier to manage as the amount of code increases. You could try a loop like this: for "_i" from 1 to 100 do { hint (str _i + "%"); sleep 0.5; };
  19. It would take a significant amount of time to translate every value of that code into a script. You would then have a script that was very specific and useless in any other mission. I recommend that you use more general functions that can do what you want fairly closely. You may interested in this function for spawning them: http://community.bistudio.com/wiki/BIS_fnc_spawnGroup Using that, you could write this code in the On Act. field of the trigger: 0 = OpforPatrolGroup = [[14070, 17520, 0], East, ["O_soldier_TL_F", "O_soldier_AA_F", "O_soldier_AA_F", "O_soldier_AAA_F"], [], [], [0.2, 0.6]] call BIS_fnc_spawnGroup; I highly recommend that you use markers and 'getMarkerPos' to instead of writing out those position arrays. Nevertheless, the above lines will spawn a group at the given position. The skill levels and soldier types are there, but I did not include ranks. Next, you need them to move exactly to the waypoints. You can use a script to give all of those waypoints with their correct properties, but I think it would be easier to use simple loop to order the group to move. You could try this: 0 = [] spawn { private "_patrolGroup"; _patrolGroup = OpforPatrolGroup; { if (({alive _x} count (units _patrolGroup)) > 0) exitWith {}; (leader _patrolGroup) move _x; _patrolGroup setCombatMode "red"; _patrolGroup setSpeedMode "normal"; _patrolGroup setBehaviour "safe"; waitUntil { unitReady (leader _patrolGroup); sleep 2; }; } forEach [[14230, 17612, 0], [14415, 17696, 0], [14415, 17690, 0], [14080, 17522, 0]]; }; This loops keeps the global name as a local variable, in case that global variable changes, and only orders the group to move to the next position when they are done moving. It also sets their behaviour and speed as in your code; this is necessary every time a 'move' command is given. It will also stop executing if all of the group members are dead. Again, I suggest not using those positions directly in the function. You can just combine both code blocks into the trigger field. I have tested this in stable patch 0.76 and it worked perfectly.
  20. To implement the action menu as you describe, all you need is a simple function to spawn vehicles and addAction statements to past arguments into that function. I would start by placing down some object on the map that the player interacts with to spawn the vehicles, I will call this object 'MenuObject'. Naming the object is important so that the code executed by the action can reference it. Then, in the init line of any object in the editor, or in your init.sqf, use code like this: MenuObject addAction ["Spawn ATV", {createVehicle [(_this select 3), (getPosATL MenuObject), [], 5, "NONE"];}, "B_Quadbike_01_F"]; You can just list an many addActions as you want options to spawn vehicles, just change the classname and action text ('B_Quadbike_01_F' and 'Spawn ATV' above) to match whatever vehicle you want to spawn. If the function in the addAction was longer and more complicated, you would want to place it into an external file or compile into a variable to use in the addAction, but repeated the code in this one line will work fine here. If you want to make the menu look cleaner by adding an action that takes you to a submenu where you pick the vehicle, or even the vehicle type and then another submenu, then you will need more advanced scripting to manage the actions that appear. I could do something like that for you if you really think it will improve your mission.
  21. I have never used that method to compile scripts (I am not very good with configs). There seems to be different ways to do it, according to this page: http://community.bistudio.com/wiki/Functions_Library_%28Arma_3%29#Adding_a_Function The only thing that looks wrong to me is 'file = "\functions";'. You might want to try 'file = "functions";' and 'file = "functions\";'. Also, the file name may be case sensitive, so make sure it matches exactly. I compile all of my scripts manually, at the beginning of the init, using code like this: Zen_StringIsInString = compileFinal preprocessFileLineNumbers "functions\Zen_StringIsInString.sqf"; This seems to do that same thing the game does automatically (use 'compileFinal' to store it permanently) and is faster for me, but it could get tedious listed dozens of functions like this. To fix that, I place the function compiles in separate files, then use something like this at the top of the init: #include "CompileFunctions.sqf"
  22. It should call BIS_fnc_arrayCompare; that was my mistake. I edited my first post to change that, and the script should work now. The main difference between my function and Lifted86's is that my function is searching for the given key string anywhere in the other string. Lifted86's function is looking for the strings to match exactly. You could use my function to search for "r_", but it does not seem like you need to do that in the example you gave. My function can also be case sensitive (probably a useless feature), and accepts '#' as a wildcard to match any character if you are unsure. If Lifted86's function fits your needs then use. My function will be slightly slower because it is looping and checking more (and it calls BIS_fnc_arrayCompare). If you need to check for strings that may contain other characters before or after "door_x", then my function will help you there.
  23. You can convert any value to a string with the 'str' command. Then, use the function I wrote below to evaluate the string and determine if your keyword is in it. You must define the function by coping the code into the init.sqf. I have no experience with animationSources exactly, but this is a general function that works on all strings. This function is thoroughly tested and has worked well for me. This function is very useful for a lot of other things as well. Zen_StringIsInString = { /* * Determines if the first given string is a contiguous part of the second string, * may be case sensitive or not, use a # as a wildcard that will match any character * params: 1. String, to search for * 2. String, to search in * 3. Boolean, optional, true to be case sensitive (default false) * return: Boolean */ private ["_keyString", "_totalString", "_useCase", "_keyIsInTotal", "_stringPiece"]; _keyString = _this select 0; _totalString = _this select 1; _useCase = false; if ((count _this) > 2) then { _useCase = _this select 2; }; if !(_useCase) then { _keyString = toUpper _keyString; _totalString = toUpper _totalString; }; _keyString = toArray _keyString; _totalString = toArray _totalString; _keyIsInTotal = false; if ((count _keyString) <= (count _totalString)) then { { if ((count _keyString) > ((count _totalString) - _forEachIndex)) exitWith {}; if (_x == (_keyString select 0) || ((_keyString select 0) == 35)) then { _stringPiece = []; private "_i"; for "_i" from _forEachIndex to ((count _keyString) - 1 + _forEachIndex) do { _stringPiece set [(count _stringPiece), (_totalString select _i)]; }; { if (_x == 35) then { _stringPiece set [_forEachIndex, _x]; }; } forEach _keyString; _keyIsInTotal = [_stringPiece, _keyString] call BIS_fnc_arrayCompare; }; if (_keyIsInTotal) exitWith {}; } forEach _totalString; }; _keyIsInTotal }; You could use the function like so: _filteredArray = []; { if (["door_#", (str _x)] call Zen_StringIsInString then { _filteredArray set [(count _filteredArray), _x]; }; } forEach [door_1, door_2, house_1, house_2, door_3, car_1]; Just change the 'door_#' argument to anything you want.
  24. Zenophon

    Creating tasks.

    Concerning a helicopter insertion, I was going to post detailed steps and explanations as well as a short script to call for a helicopter insertion or extraction at any time. That is a bit off-topic in a thread about tasks, but I did say I would post something about it. I will just link a thread that shows a simpler, faster method: http://forums.bistudio.com/showthread.php?158122-Helicopter-insertion&highlight=helicopter+insertion You also mentioned randomizing the civilian in the town. You could try making the civilian move randomly in the town. This can be done by placing this code in the init field of the civilian: 0 = [(group this), (getPosATL this), 100] call BIS_fnc_taskPatrol; This code will make the civilian move semi-randomly in a 100 meter circle around his starting position. The civilian may start to run around randomly if he sees any guys with guns or combat.
  25. Zenophon

    teleport script

    The name of the function given in the addAction must be a string if it refers to a script file. The path to a script file is relative to the mission directory. The addAction line is: this addAction ["Teleport", "teleport.sqf"]; If you want to take teleporting a step further, you can teleport to where the center of your screen is using this: (findDisplay 46) displayAddEventHandler ["KeyDown","if (_this select 1 == 21) then {player setPosATL (screenToWorld [0.5,0.5]);}"]; This will instantly teleport the player to a position on the terrain and ignores objects. You may get odd behavior trying to move into buildings using this. This is best used in conjunction with map teleporting, as it is possible to teleport very far off the map and into the ocean if you look at the sky and use this. The '21' in the eventhandler means the Y key (it is unassigned for me). Other key numbers can be found here: http://community.bistudio.com/wiki/ListOfKeyCodes
×