Jump to content

twirly

Member
  • Content Count

    1304
  • Joined

  • Last visited

  • Medals

Everything posted by twirly

  1. Mate ... it appears I gave you some bogus code above. It was worrying me.... so I tested and fixed it. So changes made to code above. All is good now. Spot on man! Dynamically named groups.
  2. Hope I read you right but you can do something like:- grplist = []; for "_i" from 0 to 4 do { [s]_grpnam = format ["grp_%1",_i][/s]; [s]_grpnam = [] call createMyGroup[/s]; [s]_grplist set [count _grplist, _grpnam][/s]; call compile format ["grp_%1 = [] call createMyGroup;",_i]; hint format ["grp_%1",_i]; call compile format ["_grplist set [count _grplist, grp_%1]",_i]; sleep 0.01; }; hint format ["_grplist:\n%1",_grplist]; Which will (tested) give you an array.... [grp_0,grp_1,grp_2,grp_3,grp_4]; The array is actually not necessary.... it's just included so that the names can be displayed after with hint. You should be able now to refer to those groups from anywhere. EDIT: I found that the names displayed in the hint are the usual Arma 2 groupnames. But using grp_1, grp_2 etc will also work.
  3. Hi mate... can't solve your problem for you but can suggest a way forward. Get Eliteness or some similar tool and de-pbo a single player mission that does what you want and try to figure it out from there. You can load the de-pbo'd mission into the editor and fiddle with it.
  4. Hi... Do a3,a4,a5 etc actually exist?
  5. F2K.... I had tested. Here are my files:- init.sqf:- waitUntil { !isNil "BIS_fnc_init" }; createMyGroup = compile preprocessFile "createMyGroup.sqf"; sleep 1; _grp = [] call createMyGroup; hint format ["_grp: %1",_grp]; createmygroup.sqf:- private ["_grp","_unit"]; _grp = createGroup East; _unit = _grp createUnit ["TK_Soldier_SL_EP1", [(getMarkerPos "pawn1") select 0,(getMarkerPos "pawn1") select 1,0], [], 3, "FORM"]; _unit = _grp createUnit ["TK_Soldier_GL_EP1", [(getMarkerPos "pawn1") select 0,(getMarkerPos "pawn1") select 1,0], [], 3, "FORM"]; _unit = _grp createUnit ["TK_Soldier_EP1", [(getMarkerPos "pawn1") select 0,(getMarkerPos "pawn1") select 1,0], [], 3, "FORM"]; _unit = _grp createUnit ["TK_Soldier_EP1", [(getMarkerPos "pawn1") select 0,(getMarkerPos "pawn1") select 1,0], [], 3, "FORM"]; _unit = _grp createUnit ["TK_Soldier_EP1", [(getMarkerPos "pawn1") select 0,(getMarkerPos "pawn1") select 1,0], [], 3, "FORM"]; _grp Can up a little demo if you need it. Let me know. PS. I did notice you had a space in "createmygroup(space here).sqf" ..so check that.
  6. Here mate. I knew I had something on Citycenters somewhere. Just dug it out and had a look. Not my code.... but might help. Many thanks to whoever wrote it. Did not play with it much... but seems to return stuff you'd be interested in. private ["_list", "_typeVar", "_neighbors", "_name"]; waituntil {!isnil "bis_fnc_init"}; //[] call BIS_fnc_help; _list = ["CityCenter",[position player,4000],true] call bis_fnc_locations; hint format ["list = %1", _list]; sleep 2; { hint format ["element %1 = %2", _x, getPos _x]; sleep 2; _typeVar = _x getVariable "type"; _neighbors = _x getVariable "neighbors"; _name = _x getVariable "name"; hint format ["neighbours: %1\ntypevar: %2\nname: %3", _neighbors, _typeVar, _name]; sleep 2; } forEach _list;
  7. Well... the main thing is doMove works with units..... not groups. This is why you need to look up the commands and not just guess mate! See how you go and post again.
  8. Use this for the function:- Get rid of _createMyGroup = { and the last bracket }. "createMyGroup.sqf":- private ["_grp","_unit"]; _grp = createGroup East; _unit = _grp createUnit ["TK_Soldier_SL_EP1", [(getMarkerPos "pawn1") select 0,(getMarkerPos "pawn1") select 1,0], [], 3, "FORM"]; _unit = _grp createUnit ["TK_Soldier_GL_EP1", [(getMarkerPos "pawn1") select 0,(getMarkerPos "pawn1") select 1,0], [], 3, "FORM"]; _unit = _grp createUnit ["TK_Soldier_EP1", [(getMarkerPos "pawn1") select 0,(getMarkerPos "pawn1") select 1,0], [], 3, "FORM"]; _unit = _grp createUnit ["TK_Soldier_EP1", [(getMarkerPos "pawn1") select 0,(getMarkerPos "pawn1") select 1,0], [], 3, "FORM"]; _unit = _grp createUnit ["TK_Soldier_EP1", [(getMarkerPos "pawn1") select 0,(getMarkerPos "pawn1") select 1,0], [], 3, "FORM"]; _grp What you have would work (with a few minor changes) if you used:- #INCLUDE "createMyGroup.sqf" at the top of your init.sqf.... or included the actual code in the file where it is called from (init.sqf). Then you would have been able to call the function.
  9. These posts here should get you started. If you're here 'till the end of the war.... you will have to learn how to modify code to suit your own needs at some point. You might as well start that learning process now. http://forums.bistudio.com/showthread.php?t=119376 http://forums.bistudio.com/showthread.php?t=112731 Familiarise yourself with these.... Scripting Commands
  10. Oooops... was too slow in my reply.
  11. Hi Carl. This is what I've been using to get an empty vehicles turrets/crew positions. Some BIS scripts modified by Murklor. Not sure if they will help you or not but here goes. As it is the functions are meant to be part of an include file. // These functions thanks to Murklor // -------------------------------------------------------- // // ----------------- Start Functions -------------------- // // -------------------------------------------------------- // // *WARNING* BIS FUNCTION RIPOFF - Taken from fn_returnConfigEntry as its needed for turrets and shortened a bit _fnc_returnConfigEntry = { private ["_config", "_entryName","_entry", "_value"]; _config = _this select 0; _entryName = _this select 1; _entry = _config >> _entryName; //If the entry is not found and we are not yet at the config root, explore the class' parent. if (((configName (_config >> _entryName)) == "") && (!((configName _config) in ["CfgVehicles", "CfgWeapons", ""]))) then { [inheritsFrom _config, _entryName] call _fnc_returnConfigEntry; } else { if (isNumber _entry) then { _value = getNumber _entry; } else { if (isText _entry) then { _value = getText _entry; }; }; }; //Make sure returning 'nil' works. if (isNil "_value") exitWith {nil}; _value; }; // *WARNING* BIS FUNCTION RIPOFF - Taken from fn_fnc_returnVehicleTurrets and shortened a bit _fnc_returnVehicleTurrets = { private ["_entry","_turrets","_turretIndex","_i"]; _entry = _this select 0; _turrets = []; _turretIndex = 0; //Explore all turrets and sub-turrets recursively. for "_i" from 0 to ((count _entry) - 1) do { private ["_subEntry"]; _subEntry = _entry select _i; if (isClass _subEntry) then { private ["_hasGunner"]; _hasGunner = [_subEntry, "hasGunner"] call _fnc_returnConfigEntry; //Make sure the entry was found. if (!(isNil "_hasGunner")) then { if (_hasGunner == 1) then { _turrets = _turrets + [_turretIndex]; //Include sub-turrets, if present. if (isClass (_subEntry >> "Turrets")) then { _turrets = _turrets + [[_subEntry >> "Turrets"] call _fnc_returnVehicleTurrets]; } else { _turrets = _turrets + [[]]; }; }; }; _turretIndex = _turretIndex + 1; }; sleep 0.01; }; _turrets; }; The call is:- _turrets = [configFile >> "CfgVehicles" >> [b]_vehicle[/b] >> "turrets"] call _fnc_returnVehicleTurrets; As I said.... I hope it is of some help.
  12. You know... I did not know this!! :) My bad!
  13. The purpose is to rotate (x,y) points around an origin. For instance if you had a marker and a bunch of (x,y) points in the area covered by the marker. Where would these points end up if you rotated the marker and the points by 20 degrees. Can't explain much better than that. Google "geometric rotation".
  14. The AI won't respawn unless you write a script to make them respawn.
  15. Try this mate.... this works with a marker. I'm sure you can figure it out from here. //rotate it _newx = 2 * ((_xdis * cos(_mkrdir)) - (_ydis * sin(_mkrdir))); _newy = 2 * ((_xdis * sin(_mkrdir)) + (_ydis * cos(_mkrdir))); //add it to center coords _newx = (_mkrpos select 0) + (_newx); _newy = (_mkrpos select 1) + (_newy);
  16. Make a copy of allGroups and then subtract whatever group(s) from the copy. Work with this new array. _mygroups = allGroups; _mygroups = _mygroups - [somegroup]; Then use _mygroups for bis_fnc_taskPatrol.
  17. You can get plugins for Explorer and Firefox that will allow you to download .flv video from YouTube. Here's a link to the Firefox one. http://www.downloadhelper.net/
  18. twirly

    Editor question

    Wrong forum section for this I think man.
  19. Here mate. Put together a little demo mission with random soldiers from a given group randomly patrolling the buildings within a given radius. They will patrol indefinately. Demo here. Look at the scripts. From those...it shouldn't be too hard to figure out how to make your two soldiers patrol between two building positions. Hope it helps you..... and maybe you will learn something along the way. Note that this code is in the INIT of the groups leader:- nul = [this,group this,50] execVM "rndbldpat.sqf";
  20. A couple things I found while playing with this. This should work but it doesn't seem to... _building = nearestBuilding _pos; This does work.... _building = nearestObject [_pos, "Building"]; Also... it seems _pos (pos1 object) can only be certain objects. It works with a fuel can... but not with a garbage can or flagpole! For instance... when you use a garbage can the nearest building returned is the garbage can itself.... so no positions to be found there!
  21. Here is a post I had found some time back with an example using the minimap. If you haven't already seen it maybe it might be of some help. http://forums.bistudio.com/showpost.php?p=1865767&postcount=8
  22. Hi... just a heads up mate. Your link "Download the Make Your Own Terrorist Hunt Template Here" needs fixing.
  23. Hi mate...don't know too much about dialogs but in that code true and false aren't defined so it probably won't work. Use 0 and 1 for movingEnable and enableSimulation Or define true and false with:- #define false 0 #define true 1
  24. I updated the link to the demo on that post and it is also linked here.
×