Trigger on hostility level?

  1. ‹ Older
  2. 8 years ago

    Just gave the average function a try -- getting a generic error on line 17: foreach _allClusters;

  3. Edited 8 years ago by Bad Quaker

    Hi @SpyderBlack723 ,

    Still haven't figured this out, but I've been poking around in the functions available via Alive and Arma 3. Can ALIVE_fnc_clustersInsideMarker look for clusters inside a vanilla area defined in the A3 mission editor? Ultimately, that's what would work for me best.

    I feel like I could almost figure this out, but figuring out how to dig through multi-dimensional arrays in Arma is still confusing me. I'm wishing I had something akin to Krumo or var_dump in php to help me better understand the data structure.

  4. Edited 8 years ago by SpyderBlack723

    My apologies, forgot about this one! I'll take another look tonight.

    For figuring arrays out better, try running them through ALiVE_fnc_inspectArray

    _array call ALiVE_fnc_inspectArray;

    It scans the array and outputs some neat debug lines to the RPT showing the array in a more user-friendly format

    Edit: Didn't have much time tonight, will set a reminder to continue my quest tomorrow.

  5. Ok here they are fixed
    --

    "WEST" call ALiVE_fnc_getAverageClusterHostilityBySide;
    "EAST" call ALiVE_fnc_getAverageClusterHostilityBySide;
    "GUER" call ALiVE_fnc_getAverageClusterHostilityBySide;
    ALiVE_fnc_getAverageClusterHostilityBySide = {
           	 private ["_side","_averageHostility","_clusterCount","_allClusters","_clusterHostility","_clusterHostilityToSide"];
    	_side = _this;
    
    	_averageHostility = 0;
    	_clusterCount = 0;
    
    	_allClusters = [ALiVE_clusterHandler,"clusters"] call ALiVE_fnc_hashGet;
    
    	{
    		_cluster = _x;
    		_clusterHostility = [_cluster, "hostility"] call ALIVE_fnc_hashGet;
    		_clusterHostilityToSide = [_clusterHostility,_side, 0] call ALIVE_fnc_hashGet;
    
    		_averageHostility = _averageHostility + _clusterHostilityToSide;
    		_clusterCount = _clusterCount + 1;
    	} foreach (_allClusters select 2);
    
    	_averageHostility / _clusterCount
    };

    --

    [getPos player, "WEST"] call ALiVE_fnc_getNearestClusterHostilityBySide;
    [getPos player, "EAST"] call ALiVE_fnc_getNearestClusterHostilityBySide;
    [getPos player, "GUER"] call ALiVE_fnc_getNearestClusterHostilityBySide;
    ALiVE_fnc_getNearestClusterHostilityBySide = {
    	private ["_allClusters","_sectorsByDistance","_nearestSector","_clusterHostility","_clusterHostilityToSide"];
    	params ["_pos","_side"];
    
    	_allClusters = ([ALiVE_clusterHandler,"clusters"] call ALiVE_fnc_hashGet) select 2;
    	_sectorsByDistance = [_allClusters,[_pos],{_input0 distance ([_x,"position"] call ALiVE_fnc_hashGet)},"ASCEND"] call ALiVE_fnc_SortBy;
    	_nearestSector = _sectorsByDistance select 0;
    
    	_clusterHostility = [_nearestSector, "hostility"] call ALIVE_fnc_hashGet;
    	_clusterHostilityToSide = [_clusterHostility,_side, 0] call ALIVE_fnc_hashGet;
    
    	_clusterHostilityToSide
    };
  6. OK, great -- will test out soon. Thanks for taking a second crack at it, and for the tip about ALiVE_fnc_inspectArray -- sounds like what I was hoping to find.

  7. So if I set these functions up in init.sqf, is there a way to have a trigger monitor the level and have it activated when below a certain amount?

    I understand I could have a trigger use "WEST" call ALiVE_fnc_getAverageClusterHostilityBySide;, but how would I set it up that the trigger activates if below a certain amount, for example 100? Also, what's a good number to place here? Don't know what relativity is here, is 100 high or is 1000 high?

  8. Scale is from [-100,100]

    in condition field

    ("WEST" call ALiVE_fnc_getAverageClusterHostilityBySide) > X
  9. inArea and ... areas?
    I apologize for this not being strictly specific to ALiVE, but BI's forums have not yet deemed me worthy/contributory enough to create a new topic for general script troubleshooting, and this issue is related to the original thread I opened here.

    I've been trying to run with Spyder's code and modify it to my mission specifics, but I'm really confused by the relationship between the vanilla inArea command (which is utilized by ALiVE_fnc_inArea) and map area markers. Is inArea not compatible with Area markers? (If so, that feels rather paradoxical). Here's what I'm running into:

    • I set up a map area called testArea in the editor.
    • I also set up a trigger area called testTrigger with essentially the same center point and dimensions
    • I put the player in the dead center of both.
    • I do a test of if (player inArea testArea) then {action} and the action does not trigger.
    • I do a test of if (player inArea testTrigger) then {action} and the action triggers.
    • hint format["%1", (player inArea testArea)]; returns "any"
    • hint format["%1", (player inArea testTrigger)]; returns "true."

    Does inArea seriously not work with with Area markers? Given that these what's used to establish the ALiVE TAoRS, that sucks (on BI, not you guys).

  10. Edited 8 years ago by SpyderBlack723

    I just gave it a whirl and I find the same result. ALiVE TAOR's still work fine however.

    No clue..

  11. Another hostility question I've been trying to figure out -- what's the relationship between the cluster hostility we're using here and the sector hostility discussed here?

    It seems like the hostility system is complex enough to where there should possibly be a page on the wiki dedicated to it. If/when I wrap my head around it sufficiently, I could take a first crack.

    Also, Spyder, I just wanted to thank you again for answering my many questions (I've got plenty more on the way, I'm sure!) and for being such an all-around good guy. You've inspired me to donate to the ALiVE project when my next check comes in.

  12. If you donate enough he won't have to go back to school in the fall and we can keep him locked in the basement working on @alive ;)

  13. Edited 8 years ago by SpyderBlack723

    It's.. It's dark in here

    Maybe I'll just go full steam towards that basketball scholarship. Fast-track it to the NBA. Profit $$
    Buy myself out of this basement.

    joking side: all donations appreciated, thanks!

  14. ALIVE_fnc_updateSectorHostility grabs all clusters in a map-grid and changes their hostility. Just an easier way to grabbing a "region" of towns and keeping them all in similar hostility situations

  15. Edited 8 years ago by Bad Quaker

    Will I get a picture to stick on my refrigerator of the starving developer I'm supporting?

    (If that reference flew over your head, click here.)

    And thanks @SpyderBlack723. Very clear explanation.

  16. Oh god Sally Struthers? You're dating yourself there Bad Quacker ;)

  17. Edited 8 years ago by SpyderBlack723

    That video brought me back to that african child donation craze of 06-09 or whenever the hell that was

    Those commercials were everywhere!

  18. Friznit

    19 Jul 2016 Administrator

    @Bad Quaker It seems like the hostility system is complex enough to where there should possibly be a page on the wiki dedicated to it. If/when I wrap my head around it sufficiently, I could take a first crack.

    There's a lot of stuff that goes on under the hood that is not on the wiki because it's deliberately focused on the player experience rather than developers or scripting. We've been tossing around ideas of how to bring some of the background simulation in ALiVE to the surface in a credibly realistic way: https://github.com/ALiVEOS/ALiVE.OS/issues/40

  19. Is the hostility level persistent?

  20. Yes

  21. Awesome, good to know.

 

or Sign Up to reply!