Jump to content

Binesi

Member
  • Content Count

    76
  • Joined

  • Last visited

  • Medals

Everything posted by Binesi

  1. Updated to 1.1 - The debug parameter is now optional. Slack space has also been increased to create a more rough circular patrol path and also give a greater chance for the script to find safe positions to place waypoints. Updated to 1.2 - Performance optimizations (no spawn calls, less code). Formation type and combat mode semi randomized. Accepts 2D map coordinates (thanks Wolffy.au). **** Following up with my tweaks to BIS_fnc_taskDefend I also had a go at BIS_fnc_taskPatrol. My version creates a continually randomized roughly circular patrol path around a given point (as opposed to the BIS function which is purely random and chaotic). Generally it will move clockwise with a random chance to skip ahead and intersect across to another waypoint. It will also occasionally search out the area inside of this circle. It is very low CPU usage and doesn't use any continually running scripts after it starts but instead relies on code attached to waypoints. It won't compete with UPS or a more advanced patrol script, but it can accomplish similar goals while using a small fraction of the resources. It will probably work best with infantry in relatively open areas or aircraft as it doesn't use a lot of intelligence for creating the patrol points other than making sure they are clear of obstacles and level enough for movement. I may improve this in the future as I think of any new ideas which keep within the framework of using low resources and no continually running scripts. Suggestions welcome. ***** Copy and paste the code into a new file called "BIN_taskPatrol.sqf" and then put into your mission directory. After, in the mission editor copy the below line into the group leader's init field that you want to do the patrolling. Make sure he is in the right position as this method creates a circular path of waypoints around him. In this case the patrol will have a radius of 250m which you can change to whatever you like and the script will compensate by using more waypoints. Also make sure you have a "Functions" module placed on the map. null = [group this,(getPos this),250] execVM "BIN_taskPatrol.sqf" Just use notepad to create this script and make sure you save the file as "BIN_taskPatrol.sqf" and not "BIN_taskPatrol.sqf.txt". To make sure go to Windows Explorer and then find folder options and see that "Hide extensions for known file types" is NOT checked. /* ======================================================================================================================= Script: BIN_taskPatrol.sqf v1.2 Author(s): Binesi Partly based on original code by BIS Description: Creates a continually randomized patrol path which circles and intersects a given position. Parameter(s): _this select 0: the group to which to assign the waypoints (Group) _this select 1: the position on which to base the patrol (Array) _this select 2: the maximum distance between waypoints (Number) _this select 3: (optional) debug markers on or off (Number) _this select 4: (optional) blacklist of areas (Array) Returns: Boolean - success flag Example(s): null = [group this,(getPos this),250] execVM "BIN_taskPatrol.sqf" null = [group this,(getPos this),250,1] execVM "BIN_taskPatrol.sqf" // Same with debug markers ----------------------------------------------------------------------------------------------------------------------- Notes: ======================================================================================================================= */ _grp = _this select 0; _pos = _this select 1; _max_dist = _this select 2; _debug = if ((count _this) > 3) then {_this select 3} else {0}; _blacklist = if ((count _this) > 4) then {_blacklist = _this select 4} else {[]}; _mode = ["YELLOW", "RED"] call BIS_fnc_selectRandom; _formation = ["STAG COLUMN", "WEDGE", "ECH LEFT", "ECH RIGHT", "VEE", "DIAMOND"] call BIS_fnc_selectRandom; _grp setBehaviour "AWARE"; _grp setSpeedMode "LIMITED"; _grp setCombatMode _mode; _grp setFormation _formation; _center_x = (_pos) select 0; _center_y = (_pos) select 1; _center_z = (_pos) select 2; if(isNil "_center_z")then{_center_z = 0;}; _wp_count = 4 + (floor random 3) + (floor (_max_dist / 100 )); _angle = (360 / (_wp_count -1)); _new_angle = 0; _wp_array = []; _slack = _max_dist / 5.5; if ( _slack < 20 ) then { _slack = 20 }; while {count _wp_array < _wp_count} do { private ["_x1","_y1","_wp_pos"]; _newangle = count _wp_array * _angle; _x1 = _center_x - (sin _newangle * _max_dist); _y1 = _center_y - (cos _newangle * _max_dist); _wp_pos = [[_x1, _y1, _center_z], 0, _slack, 6, 0, 50 * (pi / 180), 0, _blacklist] call BIS_fnc_findSafePos; _wp_array = _wp_array + [_wp_pos]; sleep 0.5; }; sleep 1; for "_i" from 1 to (_wp_count - 1) do { private ["_wp","_cur_pos","_marker","_marker_name"]; _cur_pos = (_wp_array select _i); // Create waypoints based on array of positions _wp = _grp addWaypoint [_cur_pos, 0]; _wp setWaypointType "MOVE"; _wp setWaypointCompletionRadius (5 + _slack); [_grp,_i] setWaypointTimeout [0, 2, 16]; // When completing waypoint have 33% chance to choose a random next wp [_grp,_i] setWaypointStatements ["true", "if ((random 3) > 2) then { group this setCurrentWaypoint [(group this), (floor (random (count (waypoints (group this)))))];};"]; if (_debug > 0) then { _marker_name = str(_wp_array select _i); _marker = createMarker[_marker_name,[_cur_pos select 0,_cur_pos select 1]]; _marker setMarkerShape "ICON"; _marker_name setMarkerType "DOT"; }; sleep 0.5; }; // End back near start point and then pick a new random point _wp1 = _grp addWaypoint [_pos, 0]; _wp1 setWaypointType "SAD"; _wp1 setWaypointCompletionRadius (random (_max_dist)); [_grp,(count waypoints _grp)] setWaypointStatements ["true", "group this setCurrentWaypoint [(group this), (round (random 2) + 1)];"]; // Cycle in case we reach the end _wp2 = _grp addWaypoint [_pos, 0]; _wp2 setWaypointType "CYCLE"; _wp2 setWaypointCompletionRadius 100; true
  2. Updated to 1.1 - Added in a random repeating delayed waypoint swap between search & destroy and dismissed to confine micro patrol ranges to about 75m and increase overall activity. They will continuously switch between various activities such as sitting down, standing around, going on 1-4 man patrols, or doing an occasional coordinated sweep of their local area. Updated to 1.2 - Typo fixed which could break the cycle and allow patrols to wander out of range. Updated to 1.3 - Prevented units from running around while they are not in combat as it looked a bit off. Updated to 1.3a - Fixed typo which shouldn't effect anything either way. Alternative version added "BIN_taskDefendLoose.sqf". This one has simplified coding and will re-man defenses after completing each combat. However there is a downside with this script in that individual units may wander quite far from their defense point. ***** I made some improvements to BIS_fnc_taskDefend. I know a lot of you are using this function as it's convenient so I thought I would share my optimized version as I've been very happy with it's behavior. Basically more efficient and effective. This version will reliably man all nearby defenses (even buggy spawned BIS compositions) and will additionally send out micro patrols in it's vicinity and otherwise act fairly believably without using much CPU. When enemies are detected the area is searched and cleared before resuming their normal activities. This version will also man empty vehicle turrets so you can place vehicles as static defenses. Read the code notes to see how to prevent this behavior if not desired. ***** Copy and paste this code into a new file called "BIN_taskDefend.sqf" and then put into your mission directory. After, in the mission editor copy the below line into the group leader's init field that you want to do the defending. Make sure he is in the right position. null = [group this,(getPos this)] execVM "BIN_taskDefend.sqf" Just use notepad to create this script and make sure you save the file as "BIN_taskDefend.sqf" and not "BIN_taskDefend.sqf.txt". To make sure go to Windows Explorer and then find folder options and see that "Hide extensions for known file types" is NOT checked. BIN_taskDefend.sqf /* ======================================================================================================================= Script: BIN_taskDefend.sqf v1.3a Author(s): Binesi Partly based on original code by BIS Description: Group will man all nearby static defenses and vehicle turrets and guard/patrol the position and surrounding area. Parameter(s): _this select 0: group (Group) _this select 1: defense position (Array) Returns: Boolean - success flag Example(s): null = [group this,(getPos this)] execVM "BIN_taskDefend.sqf" ----------------------------------------------------------------------------------------------------------------------- Notes: To prevent this script from manning vehicle turrets find and replace "LandVehicle" with "StaticWeapon". The "DISMISS" waypoint is nice but bugged in a few ways. The odd hacks in this code are used to force the desired behavior. The ideal method would be to write a new FSM and I may attempt that in a future project if no one else does. ======================================================================================================================= */ private ["_grp", "_pos"]; _grp = _this select 0; _pos = _this select 1; _grp setBehaviour "SAFE"; private ["_list", "_units","_staticWeapons"]; _list = _pos nearObjects ["LandVehicle", 120]; _units = (units _grp) - [leader _grp]; // The leader should not man defenses _staticWeapons = []; // Find all nearby static defenses or vehicles without a gunner { if ((_x emptyPositions "gunner") > 0) then { _staticWeapons = _staticWeapons + [_x]; }; } forEach _list; // Have the group man empty static defenses and vehicle turrets { // Are there still units available? if ((count _units) > 0) then { private ["_unit"]; _unit = (_units select ((count _units) - 1)); _unit assignAsGunner _x; [_unit] orderGetIn true; sleep 16; // Give gunner time to get in, otherwise force. _unit moveInGunner _x; _units resize ((count _units) - 1); }; } forEach _staticWeapons; // Setup Waypoints private ["_wp1","_wp2","_wp3","_wp4"]; _wp1 = _grp addWaypoint [_pos, 0]; _wp1 setWaypointType "MOVE"; [_grp, 1] setWaypointSpeed "LIMITED"; [_grp, 1] setWaypointBehaviour "SAFE"; [_grp, 1] setWaypointCombatMode "YELLOW"; [_grp, 1] setWaypointFormation "STAG COLUMN"; [_grp, 1] setWaypointCompletionRadius 50; [_grp, 1] setWaypointStatements ["true", "null = [this] spawn { _grp = group (_this select 0); sleep (30+(random 60)); {doStop _x} forEach units _grp; _grp setCurrentWaypoint [_grp,3]; {_x doMove getPos _x} forEach units _grp; sleep 1; {_x forceSpeed 3} forEach units _grp; if ((random 3)> 2) then {sleep 3} else {sleep 30 + (random 30)}; _grp setCurrentWaypoint [_grp, 1]; }; "]; _wp2 = _grp addWaypoint [_pos, 0]; _wp2 setWaypointType "DISMISS"; [_grp, 2] setWaypointStatements ["true", "null = [this] spawn { _grp = group (_this select 0); {_x forceSpeed -1 } forEach units _grp; }; "]; _wp3 = _grp addWaypoint [_pos, 0]; _wp3 setWaypointType "SAD"; [_grp, 3] setWaypointSpeed "FULL"; [_grp, 3] setWaypointBehaviour "ALERT"; [_grp, 3] setWaypointCombatMode "RED"; [_grp, 3] setWaypointFormation "VEE"; [_grp, 3] setWaypointCompletionRadius 50; [_grp, 3] setWaypointStatements ["true", "null = [this] spawn { _grp = group (_this select 0); _grp setCurrentWaypoint [_grp, 1]; }; "]; _wp4 = _grp addWaypoint [_pos, 0]; _wp4 setWaypointType "CYCLE"; // Redundant failsafe true BIN_taskDefendLoose.sqf /* ============================================================================================================ Script: BIN_taskDefendLoose.sqf v1.0 Author(s): Binesi Partly based on original code by BIS Description: Group will man all nearby static defenses and vehicle turrets and guard/patrol the position and surrounding area. Parameter(s): _this select 0: group (Group) _this select 1: defense position (Array) _this select 2: radius (Number) Returns: Boolean - success flag Example(s): null = [group this,(getPos this)] execVM "BIN\BIN_taskDefend.sqf" ------------------------------------------------------------------------------------------------------------ Notes: To prevent this script from manning vehicle turrets find and replace "LandVehicle" with "StaticWeapon". Beware that this script uses the "DISMISS" waypoint waypoint which allows some units to wander quite far from their defense position. ============================================================================================================ */ private ["_grp", "_pos", "_radius", "_list", "_static_weapons", "_units", "_wp1","_wp2","_wp3"]; _grp = _this select 0; _pos = _this select 1; _radius = if ((count _this) > 2) then {_this select 2} else {100}; _grp setBehaviour "SAFE"; _list = _pos nearObjects ["LandVehicle", _radius]; _units = (units _grp) - [leader _grp]; // The leader should not man defenses _static_weapons = []; // Find all nearby static defenses or vehicles without a gunner { if ((_x emptyPositions "gunner") > 0) then { _static_weapons = _static_weapons + [_x]; }; } forEach _list; // Have the group man empty static defenses and vehicle turrets { // Are there still units available? if ((count _units) > 0) then { private ["_unit"]; _unit = (_units select ((count _units) - 1)); _unit assignAsGunner _x; [_unit] orderGetIn true; // Give gunner time to get in, otherwise force. _unit spawn { sleep 16; _this moveInGunner _x; }; _units resize ((count _units) - 1); }; } forEach _static_weapons; // Setup Waypoints _wp1 = _grp addWaypoint [_pos, 0]; _wp1 setWaypointType "DISMISS"; [_grp, 1] setWaypointSpeed "LIMITED"; [_grp, 1] setWaypointBehaviour "SAFE"; [_grp, 1] setWaypointCombatMode "YELLOW"; [_grp, 1] setWaypointFormation "STAG COLUMN"; [_grp, 1] setWaypointCompletionRadius 50; [_grp, 1] setWaypointStatements ["true", "null = [this] spawn { _grp = group (_this select 0); _grp setBehaviour 'STEALTH'; { _x setUnitPos 'DOWN'; } forEach units _grp; sleep (2+(random 3)); { _x setUnitPos 'MIDDLE'; } forEach units _grp; sleep (20+(random 40)); { _x setUnitPos 'AUTO'; } forEach units _grp; }; "]; _wp2 = _grp addWaypoint [_pos, 0]; _wp2 setWaypointType "SAD"; [_grp, 2] setWaypointSpeed "FULL"; [_grp, 2] setWaypointBehaviour "ALERT"; [_grp, 2] setWaypointCombatMode "RED"; [_grp, 2] setWaypointFormation "VEE"; [_grp, 2] setWaypointCompletionRadius 50; [_grp, 2] setWaypointStatements ["true", "null = [this] spawn { _grp = group (_this select 0); _list = position (_this select 0) nearObjects ['LandVehicle', 120]; _static_weapons = []; { if ((_x emptyPositions 'gunner') > 0) then { _static_weapons = _static_weapons + [_x]; }; } forEach _list; { _units = units _grp; if ((count _units) > 0) then { _unit = (_units select ((count _units) - 1)); _unit assignAsGunner _x; [_unit] orderGetIn true; _unit spawn { sleep 16; _this moveInGunner _x; }; _units resize ((count _units) - 1); }; } forEach _static_weapons; }; "]; _wp3 = _grp addWaypoint [_pos, 0]; _wp3 setWaypointType "CYCLE"; true
  3. You can also import some layouts with this. You cannot import a full map you have made but if you have some particular pieces of it - for example, maybe you configured a tent with tables and objects on top of them, etc - you can import that into RTE. Just read that thread and you will see I've given two tips on how to do this. i0n0s, I'm definitely interested in helping with development if I can. You have my email address from my earlier bug report (...@kinsman.org)
  4. I found RTE also works well together with this. Instead of saving out RTE templates you can create standard BIS compositions. I've already used RTE to edit and fix the default BIS compositions and make a dozen or so new ones. As the BIS compositions are used in Domination and a large number of other missions this is an easy way to improve and extend those missions.
  5. Very nice. I've already made a dozen new compositions (and fixed some of the default BIS ones) using this. Another trick if you are also using RTE. Make another version of the object mapping script and add this to the last line: {_x call ION_RTE_pAddObject;} forEach _newObjs; Now when you use a composition all the objects will be added to RTE so you can edit them in real time and even save them back out into the mission.sqm. This is a great way to edit the existing BIS compositions.
  6. try: this setVectorUp [0,0,1] If that doesn't work I can give you a few other methods.
  7. Very nice. I have been looking for a good solution to do this. One question though, or maybe a feature request. In some of the BIS compositions they do a bit more then just setting the position of an object. For example this is from a script in the campaign missions: _group_6 = createGroup _center_0; _unit_13 = objNull; if (true) then { _this = _group_6 createUnit ["USMC_Soldier_Pilot", [10434.267, 1932.4336, 2.0980835e-005], [], 0, "CAN_COLLIDE"]; _unit_13 = _this; _this setVehicleVarName "BIS_BMaddox"; BIS_BMaddox = _this; _this setVehicleInit "this setRank ""Sergeant""; this setIdentity ""Maddox""; this setBehaviour ""CARELESS""; this setCombatMode ""BLUE""; group this setGroupId [localize ""str_callsign_starforce""]"; _this setUnitAbility 0.60000002; _this moveInDriver _vehicle_524; if (false) then {_group_6 selectLeader _this;}; }; Would it be possible to extend your solution to capture the object's init? I assume it is a variable somewhere. This would allow for things like grass cutting as you can create a helo H that has an init to spawn a deletion of itself, which is how I usually handle getting grass out of the way. This would also give enough functionality to put in real units and do any number of odd or complex setups. *EDIT* Oh, also - one trick for people using this. If you already have some layouts which you've created in the editor you can transfer them into this pretty easily. Just move whatever it is you want to map close to 0,0,0 (the lower left hand corner of the map). Then copy that mission.sqm into a new folder with a ".render" extension. Load that up with the render map and there is your composition.
  8. Just want to confirm I am also getting this bug with 1.04. Alt-tab out of the editor and back will sometimes make the mouse disappear.
  9. Binesi

    JTD Fire And Smoke

    I must say about this mod... if I had to choose only one this is it. Atmosphere and fun factor +50% Great work. Now if only those burning objects would actually look burnt. I wonder if their is a simplified way of doing it? Like layering another shader on top of the existing textures.
  10. Binesi

    cti prBF (clone of crbf)

    I like the coding. Looks pretty clean. It's like a very lightweight warfare. Something like this could also layer over a more traditional mission to create a sort of hybrid background war with static content to flesh it out. Except the swarms of vehicles spawning out of thin air... that's a bit jarring on reality. What might be interesting is a modification of this which only spawns lighter units and uses paradrops to deploy them. It would add an additional element of protecting your airspace to allow the transports to make it to their drop points.
  11. Binesi

    AWP Warfare [www.awpaholica.com]

    Interesting. Although from reading the changelog I see tweaks rather than substantial new scripting or the adding of any major features. Seems like it should be named something like "Warfare BE, AWP version". But if Benny isn't complaining...
  12. Binesi

    AI Defend Bunker

    I should have another version of that above script out soon that will man bunker positions in addition to static weapons. The later script, the "loose" on will at least go into a crouch position to shoot over some low fortifications but it won't deliberately sit inside the bunker. For now you have two choices. First is name the bunker something - for example "BUNKER". Next put this in the init of a unit which you to man it: this setPos (BUNKER buildingPos 1) Experiment with buildPos 2, 3,4 and so one to see how many and which positions you want to use. Second option is you can place units directly in the bunker where they should be with the editor. Use setUnitPos in their init to give them the right stance (for example setUnitPos "UP") and then use this forceSpeed 0 to lock them in place. If the bunker is a bit off the ground use: this setPos [(getPos this select 0),(getPos this select 1),0.3] The 0.3 is the part you can change to go higher or lower. Using 0.3 will raise the unit up about 1/3 of a meter. For the second story of a bunker you will need to use a larger number there.
  13. setMarkerPos Move the UPS marker for that civ unit to another city. Perhaps you could do this on a random schedule.
  14. Interesting... Is that sleep necessary? I'd rather do this as a call. Doing it execVM is a bit slow for using on "fired".
  15. You are not going to get units spawned by the ACM to sync with FA. I haven't seen that ACM or FA has any code to account for that. You could mod the ACM to do it or do something like trawling through allUnits on a timely schedule and try to synchronize the entire list, perhaps using a set variable to see if they are already synced. Not a really efficient solution though.
  16. Hahaha, Wolffy - as you mentioned before our coding style is really similar. The logic you are using is not much different at all from what I have been working on. Thanks for that, I'll see if I can push forward with this script again. It was starting to get a bit too hamfisted with workarounds and I need to clean it up.
  17. The problem with the BIS function is that it doesn't take into accounts roads or any kind of logical pathing so if you use this the car will just as likely get stuck driving against a fence or a rock or some other cross country obstacle. It doesn't look very good at all. Actually if you aren't going to use too many vehicles you could try using Kronzky's UPS script. I think it does take in account roads and has special handling for civilians. They will just drive around endlessly and will look fine if no one pays too much attention. If I get some time I would like to write something that both takes in account roads and also picks logical start and end points. For example you could pick one building to start from and another building in the same city or another to be your destination. After the vehicle arrives the passenger will exit and enter in the building door looking fairly believable. You will also need some code that sets a variable on cars which are in use by civilians so you can remove them from the pool if a player starts using it. Another thing to keep in mind is group limits. If you use waypoints to move around a civilian it will have to be a group by itself and will eat up one of the 144 total possible groups you can have in ArmA. I think if I scripted it I would put them all in one group and use doMove commands.
  18. The command disableAI "MOVE" will stop the unit from moving completely, including turning. The command forceSpeed 0 will stop movement EXCEPT turning (but this can be overridden with an engage order from the squad leader though so make sure you set combat yellow mode or the unit might start moving anyway). Last is doStop this, This command will stop the unit until any new order is given by the squad leader. This will cause units to stay in place at the start of the mission if they have no other waypoints or battles to attend to. One more thing you might want to do is turn off "In Formation" when you create the unit so they will be exactly where you place them in the editor.
  19. Thanks for catching the typo shk. It could potentially cause an issue if anyone uses the call command to start this script and already has a _wp4 defined in that calling script. I added in a second version, BIN_taskDefendLoose.sqf. This is the one I am using for missions. It is a bit more simple in that it doesn't try to work around the wandering units issue in the "Dismiss" type waypoint but instead relies on the normal cycling of that waypoint to add in some additional actions. The first is that it will re-man defenses after each engagement, and the second is that it will change through different combat stances at the start of battle to allow it to dive for cover immediately and then to move quickly into firing positions and fire over mid height fortifications like sandbags for a short time before going into automatic mode. I am currently working on the latest version which does not use waypoints at all but runs in a loop to control each unit. This version tries to simulate normal ambient behavior. Units will cycle between different actions like talking to each other, sitting on benches and chairs, watching a campfire or burning barrel or television, lying down, etc. They will continue to do small patrols and man defenses. Still working out bugs in this version though...
  20. Very nice. Huge improvements everywhere. You really come a long way with this coding and I have also been learning from reading it. I need to tweak a few things for this mission I'm still toiling on. For example the body handling is well done but its something I like to do centrally as my centralized script is a single running queue and has more layers of checking in it. Also I still want to capture each individual unit's init so I can rerun the various scripts and settings applied to the units I place down. Hope you don't mind if I customize it a bit?
  21. Ya, hideBody isn't reliable. Add a small sleep and then a deleteVehicle in case it doesn't work.
  22. Binesi

    AWP Warfare [www.awpaholica.com]

    So this is just Warfare BE with come configuration changes or did you make a new Warfare? If it is Benny's work did you mention it somewhere?
  23. I answered this on OFPEC already for you, but just for the record in case anyone else has this question you need to do two things: 1. When you create the units make sure Special: is set to "None" and not "In Formation". The later will always assemble your units into formation regardless of where they where placed and what options where used. 2. Set "this forceSpeed 0" on a unit you want to not move (but still be able to rotate). This is as opposed to setting disableAI "MOVE" which will also make a unit stick to one position but will remove their ability to rotate.
  24. Thanks for the patch. I've integrated this and some other improvements to create version 1.2. There is some randomization of formations type and combat mode now. I also tightened up the code attached to waypoints a lot so it should use the lowest possible resources.
  25. Yes, the functions module is required.
×