Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Last revision Both sides next revision
guides:simplecache [2019/01/12 18:10]
Skeet created
guides:simplecache [2019/01/12 18:21]
Skeet
Line 1: Line 1:
-#​cbb_simplecache 
- 
 Gives mission makers an easy and performance-friendly method of caching groups of AI. Gives mission makers an easy and performance-friendly method of caching groups of AI.
  
Line 6: Line 4:
  
 AI will only be "​uncached"​ - enableSimulationGlobal true, and hideObjectGlobal false - when: AI will only be "​uncached"​ - enableSimulationGlobal true, and hideObjectGlobal false - when:
-    ​1) a specified variable goes from `false` to `true`; +1) a specified variable goes from `false` to `true`; 
- or + 
- 2) players of a specified side (and optionally as/in a vehicle class that is/is a child of a specified class) enter the same region in which the AI were cached+**or** 
 + 
 +2) players of a specified side (and optionally as/in a vehicle class that is/is a child of a specified class) enter the same region in which the AI were cached
  
 Included is a sample mission showing a few different use cases and markers documenting them. Included is a sample mission showing a few different use cases and markers documenting them.
- The sample mission can be found in @CBB_Mods_A3\examples\cbb_simpleCache.VR+The sample mission can be found in @CBB_Mods_A3\examples\cbb_simpleCache.VR
  
 Below are the full documentation instructions also included in the cbb_simpleCache.sqf file. Below are the full documentation instructions also included in the cbb_simpleCache.sqf file.
  
  
- 
- 
-cbb_simpleCache 
  
 AUTHOR AUTHOR
     ​     ​
- Iron+**Iron**
  
 DESCRIPTION DESCRIPTION
Line 37: Line 34:
   
  This system is only designed to cache AI once and then uncache them once. It is not capable of repeated cycles or recaching AI should players leave and return to an area; a different caching system is required for scenarios where players are expected/​allowed to travel at random across a region and the AI be repeatedly uncached whenever the players are near.  This system is only designed to cache AI once and then uncache them once. It is not capable of repeated cycles or recaching AI should players leave and return to an area; a different caching system is required for scenarios where players are expected/​allowed to travel at random across a region and the AI be repeatedly uncached whenever the players are near.
 +
 +
 +
  
 ARGUMENTS ARGUMENTS
Line 108: Line 108:
  [ west , "​All"​ ] - Uncache when players on west enter the trigger area. Also looks at classes not normally considered as occupied by players - backpacks, buildings, etc. - and is untested and not recommended. But, it's there, if you really want it.  [ west , "​All"​ ] - Uncache when players on west enter the trigger area. Also looks at classes not normally considered as occupied by players - backpacks, buildings, etc. - and is untested and not recommended. But, it's there, if you really want it.
   
- ---------- ​         ---------- ​         ---------- ​         ---------- + 
-  + 
- OPTIONAL+OPTIONAL
   
  2: [ side(s) of AI to cache , optional classname(s) AI vehicles must inherit from to cache] (ARRAY)  2: [ side(s) of AI to cache , optional classname(s) AI vehicles must inherit from to cache] (ARRAY)
Line 158: Line 158:
  The trigger'​s onActivation will call cbb_simpleCache,​ and be constructed as described in the arguments above and full examples below.  The trigger'​s onActivation will call cbb_simpleCache,​ and be constructed as described in the arguments above and full examples below.
   
- ---------- ​         ---------- ​         ---------- ​         ---------- 
-  
- Using a separate variable to decide when to uncache units. This is the highest performance method. The ""​ around the variable name are required. The named uncache variable must be uninitialized or be a boolean false, or cbb_simpleCache will abort. 
-  
- 0 = [ thisTrigger , "​uncacheVariableName"​ ] call cbb_fnc_simpleCache;​ 
- Will only be uncached when the variable ​ uncacheVariableName ​ is true. 
- Caches all AI in the trigger area. 
- This is probably the highest-performance,​ easiest-to-use,​ and most common implementation of cbb_simpleCache. 
-  
- 0 = [ thisTrigger , "​uncacheVariableName"​ , [ east ] ] call cbb_fnc_simpleCache;​ 
- Same uncache parameter as above. 
- Caches all AI of side EAST in the trigger area. 
-  
- 0 = [ thisTrigger , "​uncacheVariableName"​ , [ "​man"​ ] ] call cbb_fnc_simpleCache;​ 
- Same uncache parameter as above. 
- Caches all AI of type "​man"​ in the trigger area. 
-  
- 0 = [ thisTrigger , "​uncacheVariableName"​ , [ east , "​landvehicle"​ ] ] call cbb_fnc_simpleCache;​ 
- Same uncache parameter as above. 
- Caches all AI in the trigger area that are side EAST and type "​landvehicle"​. 
-  
- 0 = [ thisTrigger , "​uncacheVariableName"​ , [ east , resistance , "​man"​ , "​tank"​ ] ] call cbb_fnc_simpleCache;​ 
- Same uncache parameter as above. 
- Caches all AI in the trigger on side EAST or RESISTANCE, that are of type "​man"​ or "​tank"​. Cars and aircraft, for example, will not be cached. 
-  
- 0 = [ thisTrigger , "​uncacheVariableName"​ , [ "​man"​ , resistance , "​tank"​ , east ] ] call cbb_fnc_simpleCache;​ 
- Same uncache parameter as above. 
- Same caching as the previous example. This demonstrates that for ease-of-use the order of elements in the sub-array does not matter. 
-  
- 0 = [ thisTrigger , "​uncacheVariableName"​ , [ east , resistance , "​Air"​] ] call cbb_fnc_simpleCache;​ 
- Same uncache parameter as above. 
- Caches all AI in the trigger area that are on side EAST or RESISTANCE, and of vehicle type "​air"​. Ground units will not be cached. 
-  
- ---------- ​         ---------- ​         ---------- ​         ---------- 
-  
- Using the trigger-area defined by the caching trigger in the map editor to decide when to uncache units. This will automatically uncache AI when players matching a required side and optionally in a vehicle inheriting from a given classname enter the trigger area. This method is not quite as high-performance,​ but it is very easy to configure. 
-  
- The following examples will include versions of the above 2nd optional parameter as well. 
-  
- 0 = [ thisTrigger , [ west ] ] call cbb_fnc_simpleCache;​ 
- Uncache when players on WEST, in a vehicle of type "​land"​ (remember the default "​land"​ is used when none is given, and that infantry are vehicles of type "​land"​) enter the trigger area. 
- Caches all AI in the trigger area. 
- If using a trigger area instead of an uncache variable, this is probably the highest-performance,​ easiest-to-use,​ and most common implementation of cbb_simpleCache. 
-  
- 0 = [ thisTrigger , [ west , "​man"​ ] , [ east ] ] call cbb_fnc_simpleCache;​ 
- Uncache when players on WEST, in a vehicle of type "​man"​ (meaning infantry only; players inside another vehicle will not count), enter the trigger area. 
- Caches all AI of side EAST in the trigger area. 
-  
- 0 = [ thisTrigger , [ "​man"​ , west ] , [ "​man"​ ] ] call cbb_fnc_simpleCache;​ 
- Same uncaching as the previous example, demonstrating that for ease-of-use the order of elements in the sub-array does not matter. 
- Caches all AI of type "​man"​ in the trigger area. 
-  
- Special cases for the uncache parameters that exist but should only be used with careful consideration. 
- Note: the cache parameters here are merely a continution of the above examples, are perfectly fine to use, and not part of any special case. It is only the uncache parameters, the first array, that is noteworthy. 
-  
- 0 = [ thisTrigger , [ west , "​AllVehicles"​ ] , [ east , "​landvehicle"​ ] ] call cbb_fnc_simpleCache;​ 
- Uncache when players on WEST enter the trigger area. This includes when aircraft fly through it, even if they are many thousand meters above the ground. This is *usually* not the intended outcome of the mission maker, and should not be used without consideration. 
- Caches all AI in the trigger area that are side EAST and type "​landvehicle"​. 
-  
- 0 = [ thisTrigger , [ west , "​All"​ ] , [ east , resistance , "​man"​ , "​tank"​ ] ] call cbb_fnc_simpleCache;​ 
- Uncache when players on WEST enter the trigger area. Also looks at classes not normally considered as occupied by players - backpacks, buildings, etc. - and is untested and not recommended. But, it's there, if you really want it. 
- Caches all AI in the trigger on side EAST or RESISTANCE, that are of type "​man"​ or "​tank"​. Cars and aircraft, for example, will not be cached. 
- 
  
  • Last modified: 5 years ago
  • by Skeet