1212PDMCDMPPM 200 Posted April 19, 2015 Sorry for the ultranoob question but how can I spawn RHS infantry ? I tried to modify the command from the very first tutorial to this: _enemyGroup = [_ObjectivePos, east, 0.2, [2, 4], "rhs_vehclass_infantry", "rhs_faction_vdv"] call Zen_SpawnInfantry; and it's not working, telling me no soldiers are found for the class/faction provided. What am I doing wrong ? Thx! Share this post Link to post Share on other sites
Zenophon 110 Posted April 19, 2015 Hey Zenophon I have a question for you. In your patrol scripts (for all units - Air, Vehicle, Infantry), if the units or vehicles are deleted rather than destroyed will your patrol scripts still terminate or will they "hang" with a null object error and not terminate?And as a separate request, can you set a parameter in Zen_OrderInfantryMove for the infantry to avoid combat or the engage the enemy while in the process of their move? Currently, Zen_OrderAircraftPatrol et al. don't account for null objects. I forget if (alive objNull) will cause an error, if not it should work. If you're cleaning up or caching units that are still alive, it's a good idea to terminate the patrol thread anyway. Next release, I'll add in code to filter null objects before every check cycle. I can easily add a parameter for setCombatMode to Zen_OrderInfantryMove; that'll be in the next release. Sorry for the ultranoob question but how can I spawn RHS infantry ?I tried to modify the command from the very first tutorial to this: _enemyGroup = [_ObjectivePos, east, 0.2, [2, 4], "rhs_vehclass_infantry", "rhs_faction_vdv"] call Zen_SpawnInfantry; and it's not working, telling me no soldiers are found for the class/faction provided. What am I doing wrong ? Thx! Are that class and faction copied exactly from the config files (I don't have RHS so I don't recognize them)? Also, the vehicle must be 'scope = 2' (placeable in editor), to prevent attempting to spawn abstract classes. To make sure it's not Zen_SpawnInfantry causing the problem, you can try Zen_ConfigGetVehicleClasses with similar parameters. If you're sure that everything is correct, Zen_ConfigGetVehicleClasses could still be be filtering them out for some reason. There's a few weird things even in the vanilla config files, so an addon's config file might be missing a value etc. Share this post Link to post Share on other sites
1212PDMCDMPPM 200 Posted April 20, 2015 Thx Zenophon ! I managed to make it work this way: _enemyGroup = [_ObjectivePos, east, 0.2, [2, 4], "rhs_vehclass_infantry_flora", "rhs_faction_vdv"] call Zen_SpawnInfantry; It seems that rhs_vehclass_infantry is empty. Share this post Link to post Share on other sites
Zenophon 110 Posted April 22, 2015 Introduction Greetings fellow scripters and Armaholics, in this latest installment, I will continue to discuss the development of the framework and, of course, shamelessly advertise the framework in any way possible. If this sounds boring, you can download the latest version from the original post. As always, the links to Google Drive for the .7z and .zip versions are already up to date. For those looking for older versions, go to file>revisions. The new version should be on Armaholic soon. Please bring any technical issues or mistakes to my attention, so e.g. people don't download the wrong version etc. Changelog This release deals mainly with fixing and improving things affected by the marksman DLC, as well as adding several user-requested features. This release also brings the total number of changes since the initial release to over 500. The new function, Zen_ArraySearch, is designed to improve managing large data structures. It is an advanced version of Zen_ArrayGetNestedIndex, which compares multiple elements to a range of values. Because of this range, you must provide hashing functions for each element. Zen_ArraySearch is the spotlit function this release and is explained in more detail there. Various loadout functions have been updated to account for marksman changes. Most importantly, Zen_GiveLoadoutCustom removes default attachments (especially bipods) from weapons; only the attachments specified in the loadout will appear. I have decided to keep the Zen_GiveLoadoutBlufor etc. presets DLC-free for now. Some players that haven't bought the DLC really don't like the DLC reminders, so I don't want to force it on them. Mission makers still have full control over custom loadouts and can annoy non-DLC players if they choose. By user request, various patrol functions now handle null objects that appear due to deleting them (Zen_OrderInfantryPatrol already did), and Zen_ArrayShuffle returns a reference to its argument (so you can give a literal array and get back its reference). Zen_OrderInfantryMove can now set the group's combat mode, affecting their general aggressiveness and ROE. Finally, Zen_ArraysAreEqual has been removed. All it did was use isEqualTo, which you can do yourself. 4/22/15 New Function: Zen_ArraySearch Fixed: Zen_FindValidDirection did not accept a single position as the second argument Fixed: Zen_GiveLoadoutIndfor did not give the correct magazine for the autorifleman Fixed: Zen_GiveLoadoutOpfor did not give the correct magazine for the marksman Added: Zen_OrderInfantryMove parameter for the group's combat mode Removed: Zen_ArraysAreEqual Improved: Zen_ArrayShuffle returns a reference to the array Improved: Zen_GetUnitLoadout now detects DLC designators and adds laser batteries Improved: Zen_GiveLoadoutBlufor 'sniper' kit now uses LRPS sight Improved: Zen_GiveLoadoutCustom now removes default attachments from weapons Improved: Zen_OrderAircraftPatrol, Zen_OrderBoatPatrol, Zen_OrderInfantryPatrolBuilding, Zen_OrderVehiclePatrol handle null objects Improved: Zen_OrderInfantryPatrolBuilding optimized Tweaked: Zen_SetAISkill differentiated 'militia' and 'infantry' presets accuracy more Documentation: Added for Zen_ArraySearch Documentation: Updated for Zen_ArrayShuffle, Zen_OrderInfantryMove Documentation: Removed for Zen_ArraysAreEqual Function Spotlight As users of my framework know, there is an enormous number of functions at your disposal. The amount of documentation that has to be sifted through can be extremely daunting. Each release I spotlight a function and talk about its usefulness. If you have found an obscure function (not in tutorials, barely seen in demonstrations or sample missions) that you think is useful, PM me and I can spotlight it. The function chosen for this release is: Zen_ArraySearch. This function generalizes a search function you might write for a data structure of nested arrays. The search requires that all its conditions be met for the returned nested array index. The index, range, and hash function for each element in each nested array are aligned in the arrays of arguments 2,3, and 4. Here is a simple example: _array = [[1,2,3], [1,2,4]]; player globalChat str ([_array, [2], [[4,5]], [{_this}]] call Zen_ArraySearch); That should print 1, as the second nested array has 4 at index 2. '{_this}' is the simplest hash function, returning the number it is given. Either code or the string name of a global function is allowed as a hashing function. For a more complex example, we need a example data structure to work with: // imagine you have an ambient spawning script that keeps zones populated with AI patrols // the data looks like: // [["marker name", [patrol groups], <patrol thread>], ...] // with one nested array for each zone Spawning_Zones_Data = [/*this is filled somehow*/]; // global hash function F_Hash_ArrGrpUnitCount = { _total = 0; { _total = _total + ({alive _x} count _x); } forEach _this; (_total) }; // you want to maintain at least 30 AI in each zone // but no more than 8 groups in each zone 0 = [] spawn { while {true} do { sleep 10; _zoneIndex = [spawning_Zones_Data, [1, 1], [[0, 29], [0, 7]], ["F_Hash_ArrGrpUnitCount", {count _this}]] call Zen_ArraySearch; if (_zoneIndex != -1) then { _zoneData = Spawning_Zones_Data select _zoneIndex; _marker = _zoneData select 0; _groupArr = _zoneData select 1; _thread = _zoneData select 2; _pos = [_marker] call Zen_FindGroundPosition; _newGroup = [_pos, east, "infantry", [6,8]] call Zen_SpawnInfantry; terminate _thread; _groupArr pushBack _newGroup; _thread = [_groupArr, _marker] spawn Zen_OrderInfantryPatrol; _zoneData set [2, _thread]; }; }; }; The range values are included, so you can give the same value twice to mimic an '=='. You might have noticed that I used [1,1] as indexes in the search; this works fine. You can impose multiple conditions on the same element. You can check any element any number of times, so long as the range and hash function align with the index. Beta As already stated, the framework is in the beta stage of development. I am making every effort to quality control releases, but there will be bugs. Both new features and old ones could have bugs, issues, and things people just don't like. There is no ETA or plan for a 'final' version. The framework is a work in progress, and it will continue to progress while there are improvements to be made (there always will be). Some of the bugs have been pointed out by users, and those fixes are included in the changelog. I want to thank everyone who has used and supported the framework. Share this post Link to post Share on other sites
Guest Posted April 23, 2015 Thanks for the headsup about the new releas :cool: Release frontpaged on the Armaholic homepage. Co-op Mission Framework and SQF Library 4/22/15 beta Share this post Link to post Share on other sites
cpthammerbeard 10 Posted April 23, 2015 Thanks for the hard work :) Share this post Link to post Share on other sites
Soul4Ever 10 Posted April 24, 2015 Thanks for the update Zen. A quick question about boat insertions, I get to where I want to go and select get out, and my character flies up into the air! Lol... maybe I should just stick to helo's for now. Not sure if this bug is framework related, scripting in general related, or just a plain ArmA 3 bug? Has anyone else encountered this? Share this post Link to post Share on other sites
cdn_biggdogg 29 Posted April 24, 2015 Thanks for the update Zen. A quick question about boat insertions, I get to where I want to go and select get out, and my character flies up into the air! Lol... maybe I should just stick to helo's for now. Not sure if this bug is framework related, scripting in general related, or just a plain ArmA 3 bug? Has anyone else encountered this? Is the boat beached when this occurs? The only time I see this is if you run the boat aground. I would think that this is an arma3 issue to do with the exit positions of the boats. Share this post Link to post Share on other sites
Soul4Ever 10 Posted April 25, 2015 Is the boat beached when this occurs? The only time I see this is if you run the boat aground. I would think that this is an arma3 issue to do with the exit positions of the boats. Yes the nose of the boat was touching the beach, and I am certain this inst related to Zen Framework because it happens with moveInDriver as well. Odd fact if you disembark into the water then drive the boat till its beached then disembark it doesn't shoot you into the air. Share this post Link to post Share on other sites
Zenophon 110 Posted May 6, 2015 Introduction Greetings fellow scripters and Armaholics, in this latest installment, I will continue to discuss the development of the framework and, of course, shamelessly advertise the framework in any way possible. If this sounds boring, you can download the latest version from the original post. As always, the links to Google Drive for the .7z and .zip versions are already up to date. For those looking for older versions, go to file>revisions. The new version should be on Armaholic soon. Please bring any technical issues or mistakes to my attention, so e.g. people don't download the wrong version etc. Changelog Although the changes are pitiably few in number, they comprise significant new content. The goal of this release is add as much new code as I could think of. I have looked through thousands of lines of code from missions that use the framework looking for patterns that can be generalized. The first new function, Zen_ArrayGetRandomSequence, attempts to streamline the process of iterating randomly over an array. It ensures that no elements are selected twice, and it can remove the elements selected from the given array. All of this is done by reference for maximum efficiency. Zen_FindCenterPosition is a function I have wanted to do for a while. The original premise of the function was to calculate a rendezvous point that would minimize the time it would take for any number of units anywhere to reach it. Instead of randomly guessing points or searching in a pattern, I finally found an analytic solution to this problem. The function will minimize the distance to the farthest point, so that, ideally, all points are the same distance away. Zen_FindCenterPosition is not just a weighted average; the function intends to make the distances the same even if this increases the sum of distances (minimizing the sum of the distances squared is an average). It uses a 2D orthogonal approach, meaning X and Y are considered independently; minimizing X and Y separately should minimize the distance itself. In fact, the function never actually computes the real distance. ZEN_FMW_Array_RemoveIndexes, ZEN_STD_Math_MarkerArea, ZEN_STD_OBJ_MakePOW, and ZEN_STD_OBJ_OrientAircraft exist so that you never have to waste 1-2 minutes typing their contents again (or finding where to copy-paste from). ZEN_FMW_Code_InsertionPatrol, ZEN_FMW_OBJ_DeleteDead, and ZEN_STD_OBJ_ParachuteInsertion are just useful snippets that might appear in a mission. ZEN_FMW_Code_InsertionPatrolis meant for AI, but ZEN_STD_OBJ_ParachuteInsertion will work with players as well. Since I'm always advising mission makers to keep their mission tidy, ZEN_FMW_OBJ_DeleteDead is a great way to do that in one line. 5/6/15 New Function: Zen_ArrayGetRandomSequence New Function: Zen_FindCenterPosition Added: Framework macros ZEN_FMW_Array_RemoveIndexes, ZEN_FMW_Code_InsertionPatrol, ZEN_FMW_OBJ_DeleteDead Added: Standard macros ZEN_STD_Math_MarkerArea, ZEN_STD_OBJ_MakePOW, ZEN_STD_OBJ_OrientAircraft, ZEN_STD_OBJ_ParachuteInsertion Documentation: Added for Zen_ArrayGetRandomSequence, Zen_FindCenterPosition, ZEN_FMW_Array_RemoveIndexes, ZEN_FMW_Code_InsertionPatrol, ZEN_FMW_OBJ_DeleteDead, ZEN_STD_Math_MarkerArea, ZEN_STD_OBJ_MakePOW, ZEN_STD_OBJ_OrientAircraft, ZEN_STD_OBJ_ParachuteInsertion Documentation: Updated Notepad++ SQF language and autocompletion file with ArmA 1.44 stable commands Roadmap As you may have noticed, I have just about run out of things to fix, add, and improve. I'm amazed how far the framework has come, and it's great to see how many people it has helped. However, as my to-do list is nearly empty and there are few user suggestions, I think the time has come to declare this a full release. Thus, I will extend the time between releases to about 1 month and remove all beta disclaimers and warnings. I am confident that the framework is now a truly complete and high-quality product; now have come its golden days. Allow me to be clear: this is not the end. I will continue to support the framework as actively as ever. To compensate for monthly releases, the release schedule will be more flexible; if you find a major bug, I will likely change the release date. However, the amount of new content will decrease significantly. I will be spending more time creating my own missions. I am also not ruling out any new, major additions to the framework. I have ideas for supporting new areas of mission making or different programming paradigms. I might also release some scripts or systems that require the framework but are not directly part of it; these will offer new features that I don't think completely fit the framework's style. Share this post Link to post Share on other sites
Guest Posted May 7, 2015 Thanks for the headsup about the new releas :cool: Release frontpaged on the Armaholic homepage. Co-op Mission Framework and SQF Library 5/6/15 beta Share this post Link to post Share on other sites
cpthammerbeard 10 Posted May 7, 2015 Nice Zen, Got some feedback/suggestions for you. We've been using your framework in our mission pack, I'll send you a copy. It's still a work in progress but here we go... Spawn Fortification occasionally gives an error when attempting to place a static weapon, I think it's due to the gradient of a random placement. BoatPatrols always end up stuck on the beach, but that's prob an Arma issue. Infantry Garrisons stay static, could they move about in house? ChopperMove - noticed if a chopper can't find a suitable space via BIS_fnc_findSafePos it defaults to the thin strip of land connecting the south island on Altis. Suggestion - CancelOrder, I recently had an extraction mission problem, if the hostage died after the chopper was enRoute, the chopper would complete extraction route before declaring hostage dead . Solution was to spawn the orderExtraction from a function and on hostage death use helicopterLand. Would be nice to have a cancel order. FireSupport is good, have you considered CAS? The built in CAS seems to hang about taking out as many targets as possible rather than single strike. Add Action - this has caused me no end of trouble, I understand it all now but if it was within your framework I bet it would have taken a lot of the pain away! Hint/PlaySound - again understanding BIS_fnc_MP was a challenge, I can now use it effectively, but for a new scriptwriter an easier Zen function would have been handy Thanks again for the effort. Share this post Link to post Share on other sites
thelegendarykhan 15 Posted May 10, 2015 Zenophon, can you please tell me how to incorporate your magazine repack script only? I am looking for a script or addon that initiates event after loading a mission in SP. Outlawled's Mag Repack doesnt resume its function after you have loaded a mission. Thanks. Share this post Link to post Share on other sites
Zenophon 110 Posted May 10, 2015 Spawn Fortification occasionally gives an error when attempting to place a static weapon, I think it's due to the gradient of a random placement. What is the error? The terrain should have no impact on spawning the objects. BoatPatrols always end up stuck on the beach, but that's prob an Arma issue. You mean the AI drives the boat there? It could be Zen_FindGroundPosition generating a point close to the beach, and the boat cannot stop in time. I can add a minimum depth when calculating the waypoint. Infantry Garrisons stay static, could they move about in house? Zen_OrderInfantryPatrolBuilding ChopperMove - noticed if a chopper can't find a suitable space via BIS_fnc_findSafePos it defaults to the thin strip of land connecting the south island on Altis. I don't know how BIS_fnc_findSafePos works; that might be the position it actually returns. Zen_OrderVehicleMove is giving a simple move order with some group combat mode, fire mode, etc. settings. Zen_OrderHelicopterLand puts down an invisible helipad at the exact point to guide the helicopter; however, it may choose to land at another nearby helipad. Suggestion - CancelOrder, I recently had an extraction mission problem, if the hostage died after the chopper was enRoute, the chopper would complete extraction route before declaring hostage dead . Solution was to spawn the orderExtraction from a function and on hostage death use helicopterLand.Would be nice to have a cancel order. Most orders functions use 'move', which is overridden by the next move command. You can then just terminate the orders thread. _h_extract = [...] call Zen_OrderExtraction; waitUntil { sleep 2; !(alive _hostage) }; terminate _h_extract; 0 = [...] call Zen_OrderHelicopterLand; This should work fine. The orders functions are not keeping track of which 'move' waypoints are active; there is no underlying data structure that can be accessed by a cancel function. FireSupport is good, have you considered CAS? The built in CAS seems to hang about taking out as many targets as possible rather than single strike. Fire support is entirely scripted and virtual; its purpose is to eliminate AI problems and give the mission maker certainty. Visible aircraft require micromanaging the AI; this is a very different system. You could just have a plane fly over the target as the fire support happens (timing that would be tricky). One of the first BIS campaign missions had a jet fly by and destroy a helicopter, so it is possible. As for getting an AI helicopter to perform realistic CAS (communicating with ground forces, avoiding enemy air defenses, etc.), if BIS can't do it.... I think this is a role that only real players can perform effectively. Add Action - this has caused me no end of trouble, I understand it all now but if it was within your framework I bet it would have taken a lot of the pain away! You can look at the actions in the framework as an example of what structure you could use in MP; there is also the Zen_MPRemoteAction demonstration. A system for actions could help, but how many actions are there in the average mission? It would just automate the technique used in Zen_AddRepackMagazines etc. There are still issues like respawn to deal with. Hint/PlaySound - again understanding BIS_fnc_MP was a challenge, I can now use it effectively, but for a new scriptwriter an easier Zen function would have been handy As with addAction, locality and remote execution are difficult at first. The framework handles it for you in the its own functions, but I cannot provide a specific MP implementation of every combination of commands. I do offer demonstrations on how to use my remote execution method, which is an alternative to BIS_fnc_MP. Zenophon, can you please tell me how to incorporate your magazine repack script only? I am looking for a script or addon that initiates event after loading a mission in SP. Outlawled's Mag Repack doesnt resume its function after you have loaded a mission. Thanks. My framework does not allow saving and loading missions because of issues like that. Running scripts, stored data, actions, etc. are removed by saving and loading in SP. The exact implementation of the repack or adding its action won't matter. Outlawled's addon uses CBA XEH, so if that doesn't work for saved games, there's nothing I can do differently. I'm not very knowledgeable about exactly how CBA XEH works, so I can't tell you if there's some way it can handle this. Have you contacted Outlawled about this? Share this post Link to post Share on other sites
thelegendarykhan 15 Posted May 15, 2015 (edited) My framework does not allow saving and loading missions because of issues like that. Running scripts, stored data, actions, etc. are removed by saving and loading in SP. The exact implementation of the repack or adding its action won't matter. Outlawled's addon uses CBA XEH, so if that doesn't work for saved games, there's nothing I can do differently. I'm not very knowledgeable about exactly how CBA XEH works, so I can't tell you if there's some way it can handle this. Have you contacted Outlawled about this? Thank you so much for the reply. I didnt contact him, but i tried his moduload addon. what that basicaly does is, on every load, it initiates "every script" twice. Which runs 2 instances of any script you are running with an init. I tried that it was very conflicting as far as I can remember. I run 78 mods simultaneously and some scripts also. Havent come across a similar problem yet. Thank you anyway.;) Edited May 22, 2015 by TheLegendaryKhan Share this post Link to post Share on other sites
Zenophon 110 Posted June 3, 2015 Introduction Greetings fellow scripters and Armaholics, in this latest installment, I will continue to discuss the development of the framework and, of course, shamelessly advertise the framework in any way possible. If this sounds boring, you can download the latest version from the original post. As always, the links to Google Drive for the .7z and .zip versions are already up to date. For those looking for older versions, go to file>revisions. The new version should be on Armaholic soon. Please bring any technical issues or mistakes to my attention, so e.g. people don't download the wrong version etc. Changelog The highlight of this release is an improvement to how Zen_AddFireSupportAction works. It now uses the action menu and tracks usages by support, not for each player separately. The arguments to the function are unchanged, but the effect and usage of Zen_AddFireSupportAction and Zen_RemoveFireSupportAction are different. Zen_AddFireSupportAction is the spotlit function this release; a longer explanation can be found below. The next big change is that Zen_ArrayGetNestedIndex and Zen_ArraySearch return an array of all indexes that match. It doesn't sound amazing at first, but it allows you to iterate over your search results as a list rather than a stack. That means you can search an array, then operate on every resulting element easily. Previously, they only returned the first element, so you had to loop them to search for all elements you wanted. ZEN_FMW_Math_TerrainGradientCart is the combination of Zen_FindTerrainGradient and Zen_FindTerrainSlope. Those functions are intended to be intuitive and useful for checking positions (a more physical result). They treat the terrain as a 2D scalar function of x and y (z = F(x,y)); they give you the change in z based upon x and y. ZEN_FMW_Math_TerrainGradientCart is the 3D mathematical gradient of the level set of terrain (0 = F(x,y) - z). This gives the 3D unit vector parallel to the terrain and in the direction of greatest increase. Finally, there is a new tutorial, MissionBriefingCoop. It is an expansion of the second tutorial featuring multiple groups and moving a respawn point. 6/3/15 Fixed: Zen_ArrayRemoveIndex caused an error if the array was empty Fixed: Zen_OrderVehicleMove delete vehicle at end parameter deleted the vehicle too far from its destination Fixed: Zen_RotateAsSet does not levitate objects Added: Framework macro ZEN_FMW_Math_TerrainGradientCart Improved: Zen_AddFireSupportAction now uses the action menu Improved: Zen_AddFireSupportAction counts uses by support template and works with playable AI Improved: Zen_AddFireSupportAction's action prompts the player for a target position Improved: Zen_ArrayGetNestedIndex and Zen_ArraySearch return all matching indexes Improved: Zen_OrderBoatPatrol now avoids shallow water Improved: Zen_RemoveFireSupportAction removes only the first action for that template for all clients Documentation: Added tutorial MissionBriefingCoop Documentation: Added for ZEN_FMW_Math_TerrainGradientCart Documentation: Updated for Zen_AddFireSupportAction, Zen_ArrayGetNestedIndex, Zen_ArraySearch, Zen_RemoveFireSupportAction Function Spotlight As users of my framework know, there is an enormous number of functions at your disposal. The amount of documentation that has to be sifted through can be extremely daunting. Each release I spotlight a function and talk about its usefulness. If you have found an obscure function (not in tutorials, barely seen in demonstrations or sample missions) that you think is useful, PM me and I can spotlight it. The function chosen for this release is: Zen_AddFireSupportAction. Due to the changes to this function, I will give an example of how it could be used. First we create a fire support to use: _fireSupport = ["r_80mm_he", 20, 1, 2, 5, 100, 0] call Zen_CreateFireSupport; I doesn't really matter what that is for now. Then simply give to the players: 0 = [_players, _fireSupport, "Artillery Strike A", 1] call Zen_AddFireSupportAction; Now the changes take effect. If there are several players, any player can use 'Artillery Strike A' at any time. This will count as one usage of this strike; that is tracked based upon the template name, _fireSupport. All players will have the support action removed after one use by any player. This is more realistic and encourages teamwork (or you can just use -1 for infinite). You can remove that action using: 0 = [ _fireSupport] call Zen_RemoveFireSupportAction; This will remove one action (in the order they were created) from all units ('_players' in this case). The next improvement is that the action works for all AI units regardless of their locality. Teamswitching and respawning as an AI will have no effect on the supports you have; this also applies to teamswitching in SP. Adding duplicate actions should have no issues. Currently, JIP players will receive a new, separate action applied to all the units that does not affect the current players' action. I'm working to add an update function for next release. This will solve the JIP issue and allow you to add and remove units from a fire support action at any time. It will also likely include the option to change the maximum number of usages. Finally, when selecting the action, the function will open the map and prompt the player to click on a position. This removes the ability to point to the position directly with your weapon. Aiming your rifle to call a fire support is unrealistic and unintuitive (a slight error can miss by 100m). You (and those who play your mission) must now spot for artillery in a more realistic manner, i.e. use a rangefinder, a compass, and trig. Share this post Link to post Share on other sites
Guest Posted June 4, 2015 Thanks for the headsup about the new releas :cool: Release frontpaged on the Armaholic homepage. Co-op Mission Framework and SQF Library 6/3/15 beta Share this post Link to post Share on other sites
cpthammerbeard 10 Posted June 4, 2015 Excellent stuff, I've just been getting to grips with the Artillery in the previous release. How would I go about adding the action to an SDV and calling in Guided Bombs using the gunners seat laser marker? I had it working in SP, code below, but in server side tests it wouldn't update to the position of the laser marker. Add an Action to the Gunners Seat BLUSHQ1 addEventHandler ["getIn", { if (_this select 1 == "gunner") then { //add statement below [[bLUSHQ1,["Call Guided Strike",{call HMB_fnc_fireSupports}]],"addAction",true,true,false] call BIS_fnc_MP; };}]; fn_fireSupports _target = _this select 0; _caller = _this select 1; _id = _this select 2; _arguments = _this select 3; _designatedPos = position laserTarget _target; guidedTemplate = ["Bo_GBU12_LGB",1,1,1,1,0.1,0.1,true] call Zen_createFireSupport; [_designatedPos,guidedTemplate,_target] call Zen_InvokeFireSupport; Cheers Sam Share this post Link to post Share on other sites
doman 21 Posted June 5, 2015 Hello again. I would like to request a feature. It would be nice, when soldiers will close doors behind them when they are patrolling or garrisoning buildings. Is this even possible? You may ask why? Because I know that enemies are in boulding because doors are opened... In 95% this is true. Thanks for continous development of this wonderful framework. Share this post Link to post Share on other sites
Zenophon 110 Posted June 5, 2015 Excellent stuff, I've just been getting to grips with the Artillery in the previous release.How would I go about adding the action to an SDV and calling in Guided Bombs using the gunners seat laser marker? I had it working in SP, code below, but in server side tests it wouldn't update to the position of the laser marker. Add an Action to the Gunners Seat BLUSHQ1 addEventHandler ["getIn", { if (_this select 1 == "gunner") then { //add statement below [[bLUSHQ1,["Call Guided Strike",{call HMB_fnc_fireSupports}]],"addAction",true,true,false] call BIS_fnc_MP; };}]; fn_fireSupports _target = _this select 0; _caller = _this select 1; _id = _this select 2; _arguments = _this select 3; _designatedPos = position laserTarget _target; guidedTemplate = ["Bo_GBU12_LGB",1,1,1,1,0.1,0.1,true] call Zen_createFireSupport; [_designatedPos,guidedTemplate,_target] call Zen_InvokeFireSupport; Cheers Sam The guidance function uses laserTarget to get a position. For a vehicle (I'm assuming) it requires that the vehicle be local to the player using the laser. Vehicles tend to be local to the driver. It works in SP because everything is local to you. You need Zen_InvokeFireSupport (and thus the guidance) to run where the vehicle is local. The action code has to be something like: ZEN_FMW_MP_REClient("HMB_fnc_fireSupports", _this, (_this select 0)) or what ever the BIS_fnc_MP equivalent is. The spawned artillery round and the laser's vehicle must be local to the same machine. Zen_createFireSupport should be done only once (for each different support) at the start of the mission (after sleep 1) to allow to be defined on all machines. Hello again.I would like to request a feature. It would be nice, when soldiers will close doors behind them when they are patrolling or garrisoning buildings. Is this even possible? You may ask why? Because I know that enemies are in boulding because doors are opened... In 95% this is true. Thanks for continous development of this wonderful framework. I have almost no control over micro-AI decision making (i.e. the exact path they follow). I don't want to say it's impossible, but I don't know of any way to make the AI do that dynamically. The other solution is closig the doors for them, which involves a check/EH on every door in a city... Try searching for a open/close building doors script to see what people have been able to do with animating doors. You could then try waiting for the door to animate, then animating it back. Again, there are so many doors that performance may be an issue. You might just auto-close the doors every X seconds; that might confuse the AI a little. Share this post Link to post Share on other sites
doman 21 Posted June 5, 2015 I searched a little bit, there is a script for doors closing here in this script pack: http://forums.bistudio.com/showthread.php?165089-AI-Spawn-Script-Pack As You suggested it is using doors animation. Here is code: [color="#FF8040"][color="#006400"][i]///////Door Close Script 0.11 - SPUn / LostVar[/i][/color] [color="#191970"][b]private[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"_unit"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_building"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_players"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_n"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_v"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_inUnits"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_sel"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_position"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_runningAlready"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_doorPositions"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_bdCfg"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_avoidDoors"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_goodToClose"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_doors"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_bDoors"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_unUnits"[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_unit[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_this[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_building[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_this[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//Keep track of AI's patrolling this building, store the data in building[/i][/color] [color="#1874CD"]_inUnits[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_building[/color] [color="#191970"][b]getVariable[/b][/color] [color="#7A7A7A"]"InUnits"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]isNil[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#7A7A7A"]"_inUnits"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color][color="#1874CD"]_inUnits[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]![/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_unit[/color] [color="#191970"][b]in[/b][/color] [color="#1874CD"]_inUnits[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#1874CD"]_inUnits[/color] [color="#191970"][b]set[/b][/color][color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]count[/b][/color] [color="#1874CD"]_inUnits[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b],[/b][/color][color="#1874CD"]_unit[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_building[/color] [color="#191970"][b]setVariable[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"InUnits"[/color][color="#8B3E2F"][b],[/b][/color] [color="#1874CD"]_inUnits[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]sleep[/b][/color] [color="#FF0000"]0.2[/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//check if script is running on this building already[/i][/color] [color="#1874CD"]_runningAlready[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_building[/color] [color="#191970"][b]getVariable[/b][/color] [color="#7A7A7A"]"RunningAlready"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]isNil[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#7A7A7A"]"_runningAlready"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color][color="#006400"][i]//and if not, then mark it up as started[/i][/color] [color="#1874CD"]_runningAlready[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]true[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_building[/color] [color="#191970"][b]setVariable[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"RunningAlready"[/color][color="#8B3E2F"][b],[/b][/color] [color="#1874CD"]_runningAlready[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//and save door positions[/i][/color] [color="#1874CD"]_doorPositions[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_bdCfg[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#191970"][b]configFile[/b][/color] [color="#8B3E2F"][b]>[/b][/color][color="#8B3E2F"][b]>[/b][/color] [color="#7A7A7A"]"cfgVehicles"[/color] [color="#8B3E2F"][b]>[/b][/color][color="#8B3E2F"][b]>[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#191970"][b]typeOf[/b][/color] [color="#1874CD"]_building[/color][color="#8B3E2F"][b])[/b][/color] [color="#8B3E2F"][b]>[/b][/color][color="#8B3E2F"][b]>[/b][/color] [color="#7A7A7A"]"UserActions"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//get config for doors[/i][/color] [color="#191970"][b]if[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]count[/b][/color] [color="#1874CD"]_bdCfg[/color][color="#8B3E2F"][b])[/b][/color] [color="#8B3E2F"][b]<[/b][/color][color="#8B3E2F"][b]=[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]exitWith[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//if none, exit[/i][/color] [color="#191970"][b]for[/b][/color] [color="#7A7A7A"]"_i"[/color] [color="#191970"][b]from[/b][/color] [color="#FF0000"]0[/color] [color="#191970"][b]to[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]count[/b][/color] [color="#1874CD"]_bdCfg[/color][color="#8B3E2F"][b])[/b][/color] [color="#8B3E2F"][b]-[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]step[/b][/color] [color="#FF0000"]3[/color] [color="#191970"][b]do[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]//gather doop positions from the config data:[/i][/color] [color="#191970"][b]if[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_i[/color] [color="#8B3E2F"][b]>[/b][/color][color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#191970"][b]count[/b][/color] [color="#1874CD"]_bdCfg[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]exitWith[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_sel[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#1874CD"]_bdCfg[/color] [color="#191970"][b]select[/b][/color] [color="#1874CD"]_i[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_position[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#191970"][b]getText[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_sel[/color] [color="#8B3E2F"][b]>[/b][/color][color="#8B3E2F"][b]>[/b][/color] [color="#7A7A7A"]"position"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//hint format["%1",_position];sleep 2;[/i][/color] [color="#1874CD"]_doorPositions[/color] [color="#191970"][b]set[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]count[/b][/color] [color="#1874CD"]_doorPositions[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b],[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_building[/color] [color="#191970"][b]modelToWorld[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_building[/color] [color="#191970"][b]selectionPosition[/b][/color] [color="#1874CD"]_position[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]sleep[/b][/color] [color="#FF0000"]0.2[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_building[/color] [color="#191970"][b]setVariable[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"DoorPositions"[/color][color="#8B3E2F"][b],[/b][/color] [color="#1874CD"]_doorPositions[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]sleep[/b][/color] [color="#FF0000"]0.3[/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]while[/b][/color][color="#8B3E2F"][b]{[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_unit[/color] [color="#191970"][b]in[/b][/color] [color="#1874CD"]_inUnits[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#191970"][b]do[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]//run as long as there's AI's inside (count _inUnits)>0[/i][/color] [color="#1874CD"]_doors[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_doorPositions[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_building[/color] [color="#191970"][b]getVariable[/b][/color] [color="#7A7A7A"]"DoorPositions"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]waitUntil[/b][/color][color="#8B3E2F"][b]{[/b][/color][color="#1874CD"]_doorPositions[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_building[/color] [color="#191970"][b]getVariable[/b][/color] [color="#7A7A7A"]"DoorPositions"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]![/b][/color][color="#191970"][b]isNil[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#7A7A7A"]"_doorPositions"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_avoidDoors[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_building[/color] [color="#191970"][b]getVariable[/b][/color] [color="#7A7A7A"]"AvoidDoors"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//door aims which player MAY HAVE caused, are stored in this[/i][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]isNil[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#7A7A7A"]"_avoidDoors"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color][color="#1874CD"]_avoidDoors[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]for[/b][/color] [color="#7A7A7A"]"_i"[/color] [color="#191970"][b]from[/b][/color] [color="#FF0000"]1[/color] [color="#191970"][b]to[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#191970"][b]count[/b][/color] [color="#1874CD"]_doorPositions[/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]step[/b][/color] [color="#FF0000"]1[/color] [color="#191970"][b]do[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]//save the anim numbers and phase values in data array +add positions along[/i][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_building[/color] [color="#191970"][b]animationPhase[/b][/color] [color="#7A7A7A"]"door_"[/color] [color="#8B3E2F"][b]+[/b][/color] [color="#191970"][b]str[/b][/color] [color="#1874CD"]_i[/color] [color="#8B3E2F"][b]+[/b][/color] [color="#7A7A7A"]"_rot"[/color] [color="#8B3E2F"][b]=[/b][/color][color="#8B3E2F"][b]=[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#1874CD"]_doors[/color] [color="#191970"][b]set[/b][/color][color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]count[/b][/color] [color="#1874CD"]_doors[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b],[/b][/color][color="#8B3E2F"][b][[/b][/color][color="#1874CD"]_i[/color][color="#8B3E2F"][b],[/b][/color][color="#FF0000"]1[/color][color="#8B3E2F"][b],[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_doorPositions[/color] [color="#191970"][b]select[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_i[/color] [color="#8B3E2F"][b]-[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#191970"][b]else[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#1874CD"]_doors[/color] [color="#191970"][b]set[/b][/color][color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]count[/b][/color] [color="#1874CD"]_doors[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b],[/b][/color][color="#8B3E2F"][b][[/b][/color][color="#1874CD"]_i[/color][color="#8B3E2F"][b],[/b][/color][color="#FF0000"]0[/color][color="#8B3E2F"][b],[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_doorPositions[/color] [color="#191970"][b]select[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_i[/color] [color="#8B3E2F"][b]-[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]sleep[/b][/color] [color="#FF0000"]0.2[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_bDoors[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_building[/color] [color="#191970"][b]getVariable[/b][/color] [color="#7A7A7A"]"Doors"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//hint format["%1",_bDoors];[/i][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]isNil[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#7A7A7A"]"_bDoors"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]//if animation phase values has not been saved already,[/i][/color] [color="#1874CD"]_building[/color] [color="#191970"][b]setVariable[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"Doors"[/color][color="#8B3E2F"][b],[/b][/color] [color="#1874CD"]_doors[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//save them in building so we can compare them on next loop[/i][/color] [color="#8B3E2F"][b]}[/b][/color][color="#191970"][b]else[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]//now we have the phase values and we can observe if they change:[/i][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]//go thru all animations stored in building[/i][/color] [color="#1874CD"]_n[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_x[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//door order num[/i][/color] [color="#1874CD"]_v[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_x[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//door anim value[/i][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_doors[/color] [color="#191970"][b]select[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_n[/color] [color="#8B3E2F"][b]-[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]select[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b])[/b][/color] [color="#8B3E2F"][b]![/b][/color][color="#8B3E2F"][b]=[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]//if current value is different than stored one _v[/i][/color] [color="#1874CD"]_players[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]isMultiplayer[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color][color="#1874CD"]_players[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#191970"][b]playableUnits[/b][/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#191970"][b]else[/b][/color][color="#8B3E2F"][b]{[/b][/color][color="#1874CD"]_players[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#000000"]player[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//get players[/i][/color] [color="#1874CD"]_goodToClose[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]true[/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]//check if player is <3m away from the opened door and if so, skip the door closing[/i][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]([/b][/color][color="#000000"]_x[/color] [color="#191970"][b]distance[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_doors[/color] [color="#191970"][b]select[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_n[/color] [color="#8B3E2F"][b]-[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]2[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b]<[/b][/color][color="#FF0000"]3[/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color][color="#1874CD"]_goodToClose[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#191970"][b]forEach[/b][/color] [color="#1874CD"]_players[/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//also skip if current unit is over 3m far from current door[/i][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_unit[/color] [color="#191970"][b]distance[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_doors[/color] [color="#191970"][b]select[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_n[/color] [color="#8B3E2F"][b]-[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]2[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b]>[/b][/color][color="#FF0000"]3[/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color][color="#1874CD"]_goodToClose[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_goodToClose[/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]//if door is still in avoid-array, but good to go, remove it from the array[/i][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_n[/color] [color="#191970"][b]in[/b][/color] [color="#1874CD"]_avoidDoors[/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#1874CD"]_avoidDoors[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#1874CD"]_avoidDoors[/color] [color="#8B3E2F"][b]-[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#1874CD"]_n[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_building[/color] [color="#191970"][b]setVariable[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"AvoidDoors"[/color][color="#8B3E2F"][b],[/b][/color] [color="#1874CD"]_avoidDoors[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_goodToClose[/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]![/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_n[/color] [color="#191970"][b]in[/b][/color] [color="#1874CD"]_avoidDoors[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]//if anim is not possibly player-caused -> invert animation:[/i][/color] [color="#8B3E2F"][b][[/b][/color][color="#1874CD"]_unit[/color][color="#8B3E2F"][b],[/b][/color][color="#1874CD"]_building[/color][color="#8B3E2F"][b],[/b][/color][color="#1874CD"]_doors[/color][color="#8B3E2F"][b],[/b][/color][color="#1874CD"]_n[/color][color="#8B3E2F"][b],[/b][/color][color="#1874CD"]_v[/color][color="#8B3E2F"][b]][/b][/color] [color="#191970"][b]spawn[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#191970"][b]private[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"_unit"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_building"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_doors"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_n"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_v"[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_unit[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_this[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_building[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_this[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_doors[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_this[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]2[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_n[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_this[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]3[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_v[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_this[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]4[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]waitUntil[/b][/color][color="#8B3E2F"][b]{[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_unit[/color] [color="#191970"][b]distance[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_doors[/color] [color="#191970"][b]select[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_n[/color] [color="#8B3E2F"][b]-[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]2[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b]>[/b][/color][color="#FF0000"]2[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//wait till AI has passed door[/i][/color] [color="#1874CD"]_building[/color] [color="#191970"][b]animate[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"door_"[/color] [color="#8B3E2F"][b]+[/b][/color] [color="#191970"][b]str[/b][/color] [color="#1874CD"]_n[/color] [color="#8B3E2F"][b]+[/b][/color] [color="#7A7A7A"]"_rot"[/color][color="#8B3E2F"][b],[/b][/color][color="#FF0000"]0[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//_v[/i][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#191970"][b]else[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]//if player was near:[/i][/color] [color="#1874CD"]_avoidDoors[/color] [color="#191970"][b]set[/b][/color][color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]count[/b][/color] [color="#1874CD"]_avoidDoors[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b],[/b][/color][color="#1874CD"]_n[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//store anim number and value[/i][/color] [color="#1874CD"]_building[/color] [color="#191970"][b]setVariable[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"AvoidDoors"[/color][color="#8B3E2F"][b],[/b][/color] [color="#1874CD"]_avoidDoors[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#1874CD"]_building[/color][color="#8B3E2F"][b],[/b][/color] [color="#1874CD"]_n[/color][color="#8B3E2F"][b],[/b][/color] [color="#1874CD"]_v[/color][color="#8B3E2F"][b],[/b][/color] [color="#1874CD"]_players[/color][color="#8B3E2F"][b]][/b][/color] [color="#191970"][b]spawn[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]//wait until player goes 100 further and invert the animation then:[/i][/color] [color="#191970"][b]private[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"_building"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_n"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_v"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_players"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_stillNear"[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_building[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_this[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_n[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_this[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_v[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_this[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]2[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_players[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_this[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]3[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_stillNear[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]true[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]while[/b][/color][color="#8B3E2F"][b]{[/b][/color][color="#1874CD"]_stillNear[/color][color="#8B3E2F"][b]}[/b][/color][color="#191970"][b]do[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#1874CD"]_stillNear[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]([/b][/color][color="#000000"]_x[/color] [color="#191970"][b]distance[/b][/color] [color="#1874CD"]_building[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b]<[/b][/color][color="#FF0000"]100[/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color][color="#1874CD"]_stillNear[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]true[/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#191970"][b]forEach[/b][/color] [color="#1874CD"]_players[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]sleep[/b][/color] [color="#FF0000"]2[/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_building[/color] [color="#191970"][b]animate[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"door_"[/color] [color="#8B3E2F"][b]+[/b][/color] [color="#191970"][b]str[/b][/color] [color="#1874CD"]_n[/color] [color="#8B3E2F"][b]+[/b][/color] [color="#7A7A7A"]"_rot"[/color][color="#8B3E2F"][b],[/b][/color][color="#1874CD"]_v[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#191970"][b]forEach[/b][/color] [color="#1874CD"]_bDoors[/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_inUnits[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_building[/color] [color="#191970"][b]getVariable[/b][/color] [color="#7A7A7A"]"InUnits"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//get the updated amount of units from building[/i][/color] [color="#1874CD"]_unitTarget[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#1874CD"]_unit[/color] [color="#191970"][b]getVariable[/b][/color] [color="#7A7A7A"]"TargetBuilding"[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]![/b][/color][color="#191970"][b]alive[/b][/color] [color="#1874CD"]_unit[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b]|[/b][/color][color="#8B3E2F"][b]|[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]isNil[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#7A7A7A"]"_unitTarget"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]//if current unit is dead or away, remove it from array[/i][/color] [color="#1874CD"]_inUnits[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#1874CD"]_inUnits[/color] [color="#8B3E2F"][b]-[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#1874CD"]_unit[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//save new amount[/i][/color] [color="#1874CD"]_building[/color] [color="#191970"][b]setVariable[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"InUnits"[/color][color="#8B3E2F"][b],[/b][/color] [color="#1874CD"]_inUnits[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//hint format["no target building, iu: %1",(count _inUnits)];[/i][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]sleep[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//reset stuff when there's no AI units inside this building anymore:[/i][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]count[/b][/color] [color="#1874CD"]_inUnits[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b]=[/b][/color][color="#8B3E2F"][b]=[/b][/color][color="#FF0000"]0[/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#1874CD"]_building[/color] [color="#191970"][b]setVariable[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"RunningAlready"[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]nil[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_building[/color] [color="#191970"][b]setVariable[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"AvoidDoors"[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]nil[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_building[/color] [color="#191970"][b]setVariable[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"Doors"[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]nil[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_building[/color] [color="#191970"][b]setVariable[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"InUnits"[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]nil[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color][/color] Made with KK's SQF to BBCode Converter Will it interfere with partol/garrison functions from Framework somehow? Share this post Link to post Share on other sites
Zenophon 110 Posted June 8, 2015 I searched a little bit, there is a script for doors closing here in this script pack:http://forums.bistudio.com/showthread.php?165089-AI-Spawn-Script-Pack As You suggested it is using doors animation. Here is code: [color="#FF8040"][color="#006400"][i]///////Door Close Script 0.11 - SPUn / LostVar[/i][/color] [color="#191970"][b]private[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"_unit"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_building"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_players"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_n"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_v"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_inUnits"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_sel"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_position"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_runningAlready"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_doorPositions"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_bdCfg"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_avoidDoors"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_goodToClose"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_doors"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_bDoors"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_unUnits"[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_unit[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_this[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_building[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_this[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//Keep track of AI's patrolling this building, store the data in building[/i][/color] [color="#1874CD"]_inUnits[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_building[/color] [color="#191970"][b]getVariable[/b][/color] [color="#7A7A7A"]"InUnits"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]isNil[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#7A7A7A"]"_inUnits"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color][color="#1874CD"]_inUnits[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]![/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_unit[/color] [color="#191970"][b]in[/b][/color] [color="#1874CD"]_inUnits[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#1874CD"]_inUnits[/color] [color="#191970"][b]set[/b][/color][color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]count[/b][/color] [color="#1874CD"]_inUnits[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b],[/b][/color][color="#1874CD"]_unit[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_building[/color] [color="#191970"][b]setVariable[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"InUnits"[/color][color="#8B3E2F"][b],[/b][/color] [color="#1874CD"]_inUnits[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]sleep[/b][/color] [color="#FF0000"]0.2[/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//check if script is running on this building already[/i][/color] [color="#1874CD"]_runningAlready[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_building[/color] [color="#191970"][b]getVariable[/b][/color] [color="#7A7A7A"]"RunningAlready"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]isNil[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#7A7A7A"]"_runningAlready"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color][color="#006400"][i]//and if not, then mark it up as started[/i][/color] [color="#1874CD"]_runningAlready[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]true[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_building[/color] [color="#191970"][b]setVariable[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"RunningAlready"[/color][color="#8B3E2F"][b],[/b][/color] [color="#1874CD"]_runningAlready[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//and save door positions[/i][/color] [color="#1874CD"]_doorPositions[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_bdCfg[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#191970"][b]configFile[/b][/color] [color="#8B3E2F"][b]>[/b][/color][color="#8B3E2F"][b]>[/b][/color] [color="#7A7A7A"]"cfgVehicles"[/color] [color="#8B3E2F"][b]>[/b][/color][color="#8B3E2F"][b]>[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#191970"][b]typeOf[/b][/color] [color="#1874CD"]_building[/color][color="#8B3E2F"][b])[/b][/color] [color="#8B3E2F"][b]>[/b][/color][color="#8B3E2F"][b]>[/b][/color] [color="#7A7A7A"]"UserActions"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//get config for doors[/i][/color] [color="#191970"][b]if[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]count[/b][/color] [color="#1874CD"]_bdCfg[/color][color="#8B3E2F"][b])[/b][/color] [color="#8B3E2F"][b]<[/b][/color][color="#8B3E2F"][b]=[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]exitWith[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//if none, exit[/i][/color] [color="#191970"][b]for[/b][/color] [color="#7A7A7A"]"_i"[/color] [color="#191970"][b]from[/b][/color] [color="#FF0000"]0[/color] [color="#191970"][b]to[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]count[/b][/color] [color="#1874CD"]_bdCfg[/color][color="#8B3E2F"][b])[/b][/color] [color="#8B3E2F"][b]-[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]step[/b][/color] [color="#FF0000"]3[/color] [color="#191970"][b]do[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]//gather doop positions from the config data:[/i][/color] [color="#191970"][b]if[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_i[/color] [color="#8B3E2F"][b]>[/b][/color][color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#191970"][b]count[/b][/color] [color="#1874CD"]_bdCfg[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]exitWith[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_sel[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#1874CD"]_bdCfg[/color] [color="#191970"][b]select[/b][/color] [color="#1874CD"]_i[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_position[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#191970"][b]getText[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_sel[/color] [color="#8B3E2F"][b]>[/b][/color][color="#8B3E2F"][b]>[/b][/color] [color="#7A7A7A"]"position"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//hint format["%1",_position];sleep 2;[/i][/color] [color="#1874CD"]_doorPositions[/color] [color="#191970"][b]set[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]count[/b][/color] [color="#1874CD"]_doorPositions[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b],[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_building[/color] [color="#191970"][b]modelToWorld[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_building[/color] [color="#191970"][b]selectionPosition[/b][/color] [color="#1874CD"]_position[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]sleep[/b][/color] [color="#FF0000"]0.2[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_building[/color] [color="#191970"][b]setVariable[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"DoorPositions"[/color][color="#8B3E2F"][b],[/b][/color] [color="#1874CD"]_doorPositions[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]sleep[/b][/color] [color="#FF0000"]0.3[/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]while[/b][/color][color="#8B3E2F"][b]{[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_unit[/color] [color="#191970"][b]in[/b][/color] [color="#1874CD"]_inUnits[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#191970"][b]do[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]//run as long as there's AI's inside (count _inUnits)>0[/i][/color] [color="#1874CD"]_doors[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_doorPositions[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_building[/color] [color="#191970"][b]getVariable[/b][/color] [color="#7A7A7A"]"DoorPositions"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]waitUntil[/b][/color][color="#8B3E2F"][b]{[/b][/color][color="#1874CD"]_doorPositions[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_building[/color] [color="#191970"][b]getVariable[/b][/color] [color="#7A7A7A"]"DoorPositions"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]![/b][/color][color="#191970"][b]isNil[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#7A7A7A"]"_doorPositions"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_avoidDoors[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_building[/color] [color="#191970"][b]getVariable[/b][/color] [color="#7A7A7A"]"AvoidDoors"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//door aims which player MAY HAVE caused, are stored in this[/i][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]isNil[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#7A7A7A"]"_avoidDoors"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color][color="#1874CD"]_avoidDoors[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]for[/b][/color] [color="#7A7A7A"]"_i"[/color] [color="#191970"][b]from[/b][/color] [color="#FF0000"]1[/color] [color="#191970"][b]to[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#191970"][b]count[/b][/color] [color="#1874CD"]_doorPositions[/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]step[/b][/color] [color="#FF0000"]1[/color] [color="#191970"][b]do[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]//save the anim numbers and phase values in data array +add positions along[/i][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_building[/color] [color="#191970"][b]animationPhase[/b][/color] [color="#7A7A7A"]"door_"[/color] [color="#8B3E2F"][b]+[/b][/color] [color="#191970"][b]str[/b][/color] [color="#1874CD"]_i[/color] [color="#8B3E2F"][b]+[/b][/color] [color="#7A7A7A"]"_rot"[/color] [color="#8B3E2F"][b]=[/b][/color][color="#8B3E2F"][b]=[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#1874CD"]_doors[/color] [color="#191970"][b]set[/b][/color][color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]count[/b][/color] [color="#1874CD"]_doors[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b],[/b][/color][color="#8B3E2F"][b][[/b][/color][color="#1874CD"]_i[/color][color="#8B3E2F"][b],[/b][/color][color="#FF0000"]1[/color][color="#8B3E2F"][b],[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_doorPositions[/color] [color="#191970"][b]select[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_i[/color] [color="#8B3E2F"][b]-[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#191970"][b]else[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#1874CD"]_doors[/color] [color="#191970"][b]set[/b][/color][color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]count[/b][/color] [color="#1874CD"]_doors[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b],[/b][/color][color="#8B3E2F"][b][[/b][/color][color="#1874CD"]_i[/color][color="#8B3E2F"][b],[/b][/color][color="#FF0000"]0[/color][color="#8B3E2F"][b],[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_doorPositions[/color] [color="#191970"][b]select[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_i[/color] [color="#8B3E2F"][b]-[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]sleep[/b][/color] [color="#FF0000"]0.2[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_bDoors[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_building[/color] [color="#191970"][b]getVariable[/b][/color] [color="#7A7A7A"]"Doors"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//hint format["%1",_bDoors];[/i][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]isNil[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#7A7A7A"]"_bDoors"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]//if animation phase values has not been saved already,[/i][/color] [color="#1874CD"]_building[/color] [color="#191970"][b]setVariable[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"Doors"[/color][color="#8B3E2F"][b],[/b][/color] [color="#1874CD"]_doors[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//save them in building so we can compare them on next loop[/i][/color] [color="#8B3E2F"][b]}[/b][/color][color="#191970"][b]else[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]//now we have the phase values and we can observe if they change:[/i][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]//go thru all animations stored in building[/i][/color] [color="#1874CD"]_n[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_x[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//door order num[/i][/color] [color="#1874CD"]_v[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_x[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//door anim value[/i][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_doors[/color] [color="#191970"][b]select[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_n[/color] [color="#8B3E2F"][b]-[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]select[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b])[/b][/color] [color="#8B3E2F"][b]![/b][/color][color="#8B3E2F"][b]=[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]//if current value is different than stored one _v[/i][/color] [color="#1874CD"]_players[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]isMultiplayer[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color][color="#1874CD"]_players[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#191970"][b]playableUnits[/b][/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#191970"][b]else[/b][/color][color="#8B3E2F"][b]{[/b][/color][color="#1874CD"]_players[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#000000"]player[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//get players[/i][/color] [color="#1874CD"]_goodToClose[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]true[/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]//check if player is <3m away from the opened door and if so, skip the door closing[/i][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]([/b][/color][color="#000000"]_x[/color] [color="#191970"][b]distance[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_doors[/color] [color="#191970"][b]select[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_n[/color] [color="#8B3E2F"][b]-[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]2[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b]<[/b][/color][color="#FF0000"]3[/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color][color="#1874CD"]_goodToClose[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#191970"][b]forEach[/b][/color] [color="#1874CD"]_players[/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//also skip if current unit is over 3m far from current door[/i][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_unit[/color] [color="#191970"][b]distance[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_doors[/color] [color="#191970"][b]select[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_n[/color] [color="#8B3E2F"][b]-[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]2[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b]>[/b][/color][color="#FF0000"]3[/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color][color="#1874CD"]_goodToClose[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_goodToClose[/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]//if door is still in avoid-array, but good to go, remove it from the array[/i][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_n[/color] [color="#191970"][b]in[/b][/color] [color="#1874CD"]_avoidDoors[/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#1874CD"]_avoidDoors[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#1874CD"]_avoidDoors[/color] [color="#8B3E2F"][b]-[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#1874CD"]_n[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_building[/color] [color="#191970"][b]setVariable[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"AvoidDoors"[/color][color="#8B3E2F"][b],[/b][/color] [color="#1874CD"]_avoidDoors[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_goodToClose[/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]![/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_n[/color] [color="#191970"][b]in[/b][/color] [color="#1874CD"]_avoidDoors[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]//if anim is not possibly player-caused -> invert animation:[/i][/color] [color="#8B3E2F"][b][[/b][/color][color="#1874CD"]_unit[/color][color="#8B3E2F"][b],[/b][/color][color="#1874CD"]_building[/color][color="#8B3E2F"][b],[/b][/color][color="#1874CD"]_doors[/color][color="#8B3E2F"][b],[/b][/color][color="#1874CD"]_n[/color][color="#8B3E2F"][b],[/b][/color][color="#1874CD"]_v[/color][color="#8B3E2F"][b]][/b][/color] [color="#191970"][b]spawn[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#191970"][b]private[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"_unit"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_building"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_doors"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_n"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_v"[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_unit[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_this[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_building[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_this[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_doors[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_this[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]2[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_n[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_this[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]3[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_v[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_this[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]4[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]waitUntil[/b][/color][color="#8B3E2F"][b]{[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_unit[/color] [color="#191970"][b]distance[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_doors[/color] [color="#191970"][b]select[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_n[/color] [color="#8B3E2F"][b]-[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]2[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b]>[/b][/color][color="#FF0000"]2[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//wait till AI has passed door[/i][/color] [color="#1874CD"]_building[/color] [color="#191970"][b]animate[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"door_"[/color] [color="#8B3E2F"][b]+[/b][/color] [color="#191970"][b]str[/b][/color] [color="#1874CD"]_n[/color] [color="#8B3E2F"][b]+[/b][/color] [color="#7A7A7A"]"_rot"[/color][color="#8B3E2F"][b],[/b][/color][color="#FF0000"]0[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//_v[/i][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#191970"][b]else[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]//if player was near:[/i][/color] [color="#1874CD"]_avoidDoors[/color] [color="#191970"][b]set[/b][/color][color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]count[/b][/color] [color="#1874CD"]_avoidDoors[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b],[/b][/color][color="#1874CD"]_n[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//store anim number and value[/i][/color] [color="#1874CD"]_building[/color] [color="#191970"][b]setVariable[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"AvoidDoors"[/color][color="#8B3E2F"][b],[/b][/color] [color="#1874CD"]_avoidDoors[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#1874CD"]_building[/color][color="#8B3E2F"][b],[/b][/color] [color="#1874CD"]_n[/color][color="#8B3E2F"][b],[/b][/color] [color="#1874CD"]_v[/color][color="#8B3E2F"][b],[/b][/color] [color="#1874CD"]_players[/color][color="#8B3E2F"][b]][/b][/color] [color="#191970"][b]spawn[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]//wait until player goes 100 further and invert the animation then:[/i][/color] [color="#191970"][b]private[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"_building"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_n"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_v"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_players"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_stillNear"[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_building[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_this[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_n[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_this[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_v[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_this[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]2[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_players[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_this[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]3[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_stillNear[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]true[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]while[/b][/color][color="#8B3E2F"][b]{[/b][/color][color="#1874CD"]_stillNear[/color][color="#8B3E2F"][b]}[/b][/color][color="#191970"][b]do[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#1874CD"]_stillNear[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]([/b][/color][color="#000000"]_x[/color] [color="#191970"][b]distance[/b][/color] [color="#1874CD"]_building[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b]<[/b][/color][color="#FF0000"]100[/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color][color="#1874CD"]_stillNear[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]true[/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#191970"][b]forEach[/b][/color] [color="#1874CD"]_players[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]sleep[/b][/color] [color="#FF0000"]2[/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_building[/color] [color="#191970"][b]animate[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"door_"[/color] [color="#8B3E2F"][b]+[/b][/color] [color="#191970"][b]str[/b][/color] [color="#1874CD"]_n[/color] [color="#8B3E2F"][b]+[/b][/color] [color="#7A7A7A"]"_rot"[/color][color="#8B3E2F"][b],[/b][/color][color="#1874CD"]_v[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#191970"][b]forEach[/b][/color] [color="#1874CD"]_bDoors[/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_inUnits[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_building[/color] [color="#191970"][b]getVariable[/b][/color] [color="#7A7A7A"]"InUnits"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//get the updated amount of units from building[/i][/color] [color="#1874CD"]_unitTarget[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#1874CD"]_unit[/color] [color="#191970"][b]getVariable[/b][/color] [color="#7A7A7A"]"TargetBuilding"[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]![/b][/color][color="#191970"][b]alive[/b][/color] [color="#1874CD"]_unit[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b]|[/b][/color][color="#8B3E2F"][b]|[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]isNil[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#7A7A7A"]"_unitTarget"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]//if current unit is dead or away, remove it from array[/i][/color] [color="#1874CD"]_inUnits[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#1874CD"]_inUnits[/color] [color="#8B3E2F"][b]-[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#1874CD"]_unit[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//save new amount[/i][/color] [color="#1874CD"]_building[/color] [color="#191970"][b]setVariable[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"InUnits"[/color][color="#8B3E2F"][b],[/b][/color] [color="#1874CD"]_inUnits[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//hint format["no target building, iu: %1",(count _inUnits)];[/i][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]sleep[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//reset stuff when there's no AI units inside this building anymore:[/i][/color] [color="#191970"][b]if[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]count[/b][/color] [color="#1874CD"]_inUnits[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b]=[/b][/color][color="#8B3E2F"][b]=[/b][/color][color="#FF0000"]0[/color][color="#8B3E2F"][b])[/b][/color][color="#191970"][b]then[/b][/color][color="#8B3E2F"][b]{[/b][/color] [color="#1874CD"]_building[/color] [color="#191970"][b]setVariable[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"RunningAlready"[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]nil[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_building[/color] [color="#191970"][b]setVariable[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"AvoidDoors"[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]nil[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_building[/color] [color="#191970"][b]setVariable[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"Doors"[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]nil[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_building[/color] [color="#191970"][b]setVariable[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"InUnits"[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]nil[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color][/color] Made with KK's SQF to BBCode Converter Will it interfere with partol/garrison functions from Framework somehow? The script doesn't give the AI orders, so it should be fully compatible with any patrol script. It just seems to rely on the unit remaining in the building; it makes passive checks on the unit and animates the building. If you change the building being patrolled (terminate then spawn new order thread), you'll need to run the script again. Share this post Link to post Share on other sites
doman 21 Posted June 12, 2015 Hello again. Next feature request. And maybe this time it can be done here ;) I made a mission, where a pilot must sling load metal box. WIth Zen_OrderSlingLoad this is not possible, because (_heli canSlingLoad _cargo) is for box almost always false. But boxes have not too big weight, so it can be transported with a little hack: [color="#FF8040"][color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color] [color="#191970"][b]spawn[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#191970"][b]waitUntil[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#191970"][b]if[/b][/color] [color="#8B3E2F"][b]([/b][/color]ZEN_FMW_Math_DistLess3D[color="#8B3E2F"][b]([/b][/color]heli[color="#8B3E2F"][b],[/b][/color]target[color="#8B3E2F"][b],[/b][/color][color="#FF0000"]10[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]exitWith[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#000000"]true[/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]sleep[/b][/color] [color="#FF0000"]3[/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] myRope [color="#8B3E2F"][b]=[/b][/color] [color="#191970"][b]ropeCreate[/b][/color] [color="#8B3E2F"][b][[/b][/color]heli[color="#8B3E2F"][b],[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#FF0000"]0[/color][color="#8B3E2F"][b],[/b][/color][color="#FF0000"]0[/color][color="#8B3E2F"][b],[/b][/color][color="#FF0000"]-2[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b],[/b][/color] target[color="#8B3E2F"][b],[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#FF0000"]0[/color][color="#8B3E2F"][b],[/b][/color][color="#FF0000"]0[/color][color="#8B3E2F"][b],[/b][/color][color="#FF0000"]0[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]15[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color][/color] Made with KK's SQF to BBCode Converter then it can be detached with command ropeDetach and destroyed with ropeDestroy. I think, that You can add something like "rope force" to Zen_OrderSlingLoad. It can be dangerous in many situations, but "force" option will be for guys who know what they are forcing ;) Share this post Link to post Share on other sites
Zenophon 110 Posted June 14, 2015 Hello again. Next feature request. And maybe this time it can be done here ;)I made a mission, where a pilot must sling load metal box. WIth Zen_OrderSlingLoad this is not possible, because (_heli canSlingLoad _cargo) is for box almost always false. But boxes have not too big weight, so it can be transported with a little hack: [color="#FF8040"][color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color] [color="#191970"][b]spawn[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#191970"][b]waitUntil[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#191970"][b]if[/b][/color] [color="#8B3E2F"][b]([/b][/color]ZEN_FMW_Math_DistLess3D[color="#8B3E2F"][b]([/b][/color]heli[color="#8B3E2F"][b],[/b][/color]target[color="#8B3E2F"][b],[/b][/color][color="#FF0000"]10[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]exitWith[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#000000"]true[/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]sleep[/b][/color] [color="#FF0000"]3[/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] myRope [color="#8B3E2F"][b]=[/b][/color] [color="#191970"][b]ropeCreate[/b][/color] [color="#8B3E2F"][b][[/b][/color]heli[color="#8B3E2F"][b],[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#FF0000"]0[/color][color="#8B3E2F"][b],[/b][/color][color="#FF0000"]0[/color][color="#8B3E2F"][b],[/b][/color][color="#FF0000"]-2[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b],[/b][/color] target[color="#8B3E2F"][b],[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#FF0000"]0[/color][color="#8B3E2F"][b],[/b][/color][color="#FF0000"]0[/color][color="#8B3E2F"][b],[/b][/color][color="#FF0000"]0[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]15[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color][/color] Made with KK's SQF to BBCode Converter then it can be detached with command ropeDetach and destroyed with ropeDestroy. I think, that You can add something like "rope force" to Zen_OrderSlingLoad. It can be dangerous in many situations, but "force" option will be for guys who know what they are forcing ;) Is the pilot a player? All orders functions are intended for the AI only. For a player, I would use setSlingLoad/ropeCreate directly (like you did) or through an action, as Zen_OrderSlingLoad uses setVelocity to force the AI pilot to do it. I think canSlingLoad and setSlingLoad is only intended for large physics vehicles (e.g. cars) and not all objects, so I will add the ropeCreate code as a backup to setSlingLoad. The function will default to setSlingLoad, then try ropeCreate if that fails (and check that for odd behavior). I can also add a T/F switch to make ropeCreate the default. Share this post Link to post Share on other sites
jgaz-uk 132 Posted June 14, 2015 On a dedicated server in the latest update of Black Ops missions (all 3 maps) only the squad leader is in the Helicopter, all other squad member are left behind on the ground? Was not the case in previous versions. Share this post Link to post Share on other sites