CSI2STAR Military Map Sectors

  1. 8 years ago

    I was trying to find something similar in the function viewer but I came up a bit short. Is there a way that I could so to speak query a sector of the map and see if an AI commander has units active in that area while they are virtualized? I don't need to know the exact positions or details of the units, just simply if they're active in a given sector.

  2. Open up the commander tablet. Select commander actions. Select Intel. Then either use the unit marking option or objective option. Both should paint you a picture for what's going on around the map without having to debug the virtual AI module.

    Make sure you have the Intel you want set to show under global Intel in the c2istar module.

  3. I meant if there was a scripting API available in SQF.

    I'm not using the commander tablet or showing the players where enemies are located, but in the mission I'm making players have to gather items. I don't want the items to spawn in sectors where there is an AI present. I can't use triggers though because virtualized AI won't set a trigger off.

  4. You're going to have to dig through some files, but yes it's possible.

    Here's an example I made for someone on getting sectors based which faction "controlled" them, that should be a decent point for learning about how to work with sectors.
    Relevent sectors component: https://github.com/ALiVEOS/ALiVE.OS/tree/master/addons/fnc_analysis

    You'll just need to loop through all profiles and find out if any are within the sector you are checking.

    Relevant profiles component: https://github.com/ALiVEOS/ALiVE.OS/tree/master/addons/sys_profile
    You'll want to look through fnc_profile.sqf and fnc_profileHandler.sqf

  5. Thanks! I'm browsing around the available functions. Is there also a wiki that could explain what a profile and such is in the program and how it's used?

    The two ways it looks like that I have to get a profile would be https://github.com/ALiVEOS/ALiVE.OS/blob/master/addons/sys_profile/fnc_profileEntity.sqf or https://github.com/ALiVEOS/ALiVE.OS/blob/master/addons/sys_profile/fnc_getNearProfiles.sqf .

    After that I guess I can just test the other functions in the debug console and see the result thats returned.

  6. getNearProfiles will probably be your best option if you are just checking a single point.

    Alivemod.com/wiki might help a bit with profiles, just look for the related section in the left-side bar for profile system or virtual AI.

    They are basically virtual groups that move, fight, and influence the battlefield without ducking resources for an actual, physically existing group.

  7. Edited 8 years ago by Bryan

    I'm running some local tests using getNearProfiles:

    EDIT: stumbled upon a snippet on the wiki: http://alivemod.com/wiki/index.php/Script_Snippets

    EDIT2: I tried using 'entity', or following the example as such:

    ((count ([getposATL thisTrigger, 50, ["WEST","entity"]] call ALIVE_fnc_getNearProfiles)) > 0);

    But it's only returning an empty array.

    -image-

    prs = [getPos player, 500, ["WEST","vehicle"]] call ALIVE_fnc_getNearProfiles; 
    diag_log prs;
    [
    	[
    		"#CBA_HASH#",
    		[
    			"debug",
    			"active",
    			"position",
    			"side",
    			"profileID",
    			"type",
    			"objectType",
    			"vehicleAssignments",
    			"entitiesInCommandOf",
    			"entitiesInCargoOf",
    			"vehicle",
    			"vehicleClass",
    			"direction",
    			"fuel",
    			"ammo",
    			"engineOn",
    			"damage",
    			"canMove",
    			"canFire",
    			"needReload",
    			"despawnPosition",
    			"hasSimulated",
    			"spawnType",
    			"faction",
    			"_rev",
    			"_id",
    			"busy",
    			"cargo",
    			"slingload",
    			"slung",
    			"debugMarkers",
    			"locked"
    		],
    		[
    			true,
    			true,
    			[3613.4,8560.11,0.0459595],
    			"WEST",
    			"BLU_F-vehicle_14",
    			"vehicle",
    			"Car",
    			[
    				"#CBA_HASH#",
    				["BLU_F-entity_8"],
    				[
    					[
    						"BLU_F-vehicle_14",
    						"BLU_F-entity_8",
    						[
    							[0],
    							[],
    							[],
    							[],
    							[1,2,3],
    							[]
    						]
    					]
    				],
    				any
    			],
    			["BLU_F-entity_8"],
    			[],
    			vehicle_17,
    			"B_MRAP_01_F",
    			0,
    			1,
    			[],
    			false,
    			[],
    			true,
    			true,
    			0,
    			[0,0],
    			false,
    			[],
    			"BLU_F",
    			"",
    			"",
    			false,
    			[],
    			[],
    			[],
    			["ALiVE_PROFILEVEHICLE_BLU_F-vehicle_14"],
    			true
    		],
    		any
    	]
    ]

    Is it listed anywhere though which categories I can use? I tried using just WEST alone but it returns nothing.

  8. Edited 8 years ago by incontinenetia

    I've used that snippet before in a trigger and it seems to work alright for me (with ["WEST", "entity"] too I think). In terms of categories, I wasn't sure on that either. But this is the example from the function:

    [getPos player, 500, ["WEST","vehicle","Car"]] call ALIVE_fnc_getNearProfiles;

    ...which I think gives a better clue on usage than the script snippet. The only reason I can think of that this won't return the correct array is if there is some locality issue going on.

    Edit: This is a horribly inefficient way of doing it I'm sure, but this code should come up with a safe position for you to spawn your item.

    private _safePos;
    
    _location = getPos player; //Location you want items to spawn around
    
    _radiusMin = 500; //Minimum distance from location to spawn item
    
    _radiusMax = 1500; // Max distance from location to spawn item
    
    _distanceFromNrstObj = 2; //Min distance from nearest object to spawn item
    
    _radius = 150; //Minimum distance from nearest ALiVE profile
    
    waitUntil {
    
        sleep 1;
    
        _safePos = [_location, _radiusMin, _radiusMax, _distanceFromNrstObj] call BIS_fnc_findSafePos;
    
        !((count ([ _safePos, _radius, ["WEST","entity"]] call ALIVE_fnc_getNearProfiles)) > 0);
    
    };
    
    _safePos
  9. Edited 8 years ago by Bryan

    @incontinenetia I've used that snippet before in a trigger and it seems to work alright for me (with ["WEST", "entity"] too I think). In terms of categories, I wasn't sure on that either. But this is the example from the function[/code]

    The counting example seemed to work fine, it was just I couldn't get the profile data. But actually, that's all more than enough. Since I can check in a range, I only have to know if any profile is present, I don't per se need specific details.

  10. Glad it works!

  11. Edited 8 years ago by Bryan

    Almost working, I'm not sure what I'm supposed to use to find out which indepedent profiles are in an area:

    _ents_i = (count ([getposatl _thistrigger, _r, ["INDEPENDENT","entity"]] call ALIVE_fnc_getNearProfiles));

    "INDEPENDENT" doesn't work.

    EDIT: It's "GUER"

 

or Sign Up to reply!