Jump to content


  • Content Count

  • Joined

  • Last visited

  • Medals

  • Medals

Posts posted by Undeceived

  1. bad benson, yeah, that did the trick. Many thanks, man!





    To summarize the thread for mission designers that might have the same question:


    With this code you can create an array with items, magazines, weapons and backpacks that are laying on the ground in a trigger area:

    //Code by bad benson with elements of Schatten's function:
    _trigger = trigger_0; 
    _stuff = [[],[],[],[]];  
    _objs = (nearestObjects [_trigger, ["WeaponHolder", "WeaponHolderSimulated"], selectMax ((triggerArea _trigger) select [0, 2])]) select {_x inArea _trigger};  
    _objs inAreaArray _trigger apply  
     (_stuff select 0) append (weaponCargo _x); 
     (_stuff select 1) append (magazineCargo _x); 
     (_stuff select 2) append (itemCargo _x); 
     (_stuff select 3) append (backpackCargo _x); 


    To show the array:

    hint str (_stuff);


    @bad benson's code creates an array with classname strings for each individual item. E.g.:






    If you need an array that looks like this:




    then you can use @Schatten's function:

    SCH_fnc_getStuffInsideTrigger = { 
     private _allStuff = [ 
     params [ 
      ["_trigger", objNull, [objNull]] 
     if ((isNull _trigger) or {(typeOf _trigger) != "EmptyDetector"}) exitWith {_allStuff}; 
     private ["_className", "_classNames", "_index", "_quantities", "_quantity", "_stuff", "_stuffOfType", "_weaponHolder", "_weaponHolders"]; 
     _weaponHolders = (nearestObjects [_trigger, ["WeaponHolder", "WeaponHolderSimulated"], selectMax ((triggerArea _trigger) select [0, 2])]) select {_x inArea _trigger}; 
      _weaponHolder = _x; 
       _classNames = _x select 0; 
       _quantities = _x select 1; 
       _stuffOfType = _allStuff select _forEachIndex; 
        _className = _x; 
        _quantity = _quantities select _forEachIndex; 
        _index = _stuffOfType findIf {(_x select 0) == _className}; 
        if (_index >= 0) then { 
         _stuff = _stuffOfType select _index; 
         _stuff set [1, (_stuff select 1) + _quantity]; 
        } else { 
         _stuffOfType pushBack [_className, _quantity]; 
       } forEach _classNames; 
      } forEach [ 
       getWeaponCargo _weaponHolder, 
       getMagazineCargo _weaponHolder, 
       getItemCargo _weaponHolder, 
       getBackpackCargo _weaponHolder 
     } forEach _weaponHolders; 


    Show the result / call the function with:

    hint (str ([trigger_0] call SCH_fnc_getStuffInsideTrigger));



    Many thanks to you both, guys.

    • Like 1
    • Thanks 1

  2. @bad benson


    Cool, thanks for the addition / change.


    When using this, the code worked:


    _trigger = myCollectorTrigger;
    _stuff = [[],[],[],[]]; 
    _objs = (nearestObjects [_trigger, ["All"], selectMax ((triggerArea _trigger) select [0, 2])]) select {_x inArea _trigger}; //taken from Schatten's code
    _objs inAreaArray _trigger apply 
    	(_stuff select 0) append (weaponCargo _x);
    	(_stuff select 1) append (magazineCargo _x);
    	(_stuff select 2) append (itemCargo _x);
    	(_stuff select 3) append (backpackCargo _x);


    The only problem left now is that all stuff that the units in the trigger have (and also the stuff that is in vehicles) is also added to the arrays. :icon_biggrin: Is there a way to exclude everything so that only the stuff on the ground is collected?






    14 hours ago, bad benson said:

    but his function also gives you an amount for each item while mine just uses doubles (class string for each individual item) which you probably want. so depends on what you need really.


    Btw. this is what I need: One individual string for every item. :icon14:

  3. 3 hours ago, bad benson said:

    in the meantime you can try this


    _stuff = [[],[],[],[]]; 
    _objs = vehicles;
    _objs inAreaArray _trigger apply 
    	(_stuff select 0) append (weaponCargo _x);
    	(_stuff select 1) append (magazineCargo _x);
    	(_stuff select 2) append (itemCargo _x);
    	(_stuff select 2) append (backpackCargo _x);


    Thanks badbenson, I tried out this code but unfortunately the vehicles thing didn't work, so _stuff didn't have anything. As it seems to me, there are no vehicles in the trigger (I dropped an item, a mag and a rifle).


    Your explanations after this code were too much for my brain - couldn't understand it - sorry. :icon_biggrin:






    _objs = vehicles select {_x isKindOf "Car"};


    worked when I placed a quad. But searching for the weaponholders didn't work.

  4. Hi guys, I would like to "collect" the items, weapons, magazines and backpacks that the player has put on the ground inside a certain trigger and put then into a crate.

    Is there a way to detect this stuff and create an array out of it.


    The relatively new command inAreaArray looked promising at first but unfortunately it doesn't recognize items, weapons and magazines (I couldn't do it at least).


    Does anyone know more?

    Thanks a lot!




  5. Hello guys.


    The problem: I have an addAction on an object ("Take object"), which appears when the player looks at it (means when the center of the screen is on the object - I think it's the same as cursorObject or cursorTarget).

    This normally works fine but I noticed that in some cases it doesn't. The action appears when the player looks somewhere under or beside the object (I'm using a leaflet) but not when he looks right AT it. I think this is related to the fact that the leaflet is placed on the ground of a shed which I placed in the editor. On the ground itself (outside) it works ok.


    Because of this problem I fear that the player would look at the object but go on because the action doesn't appear. ThereforeI want to expand the area on which the player can look to activate the action. And what else could be better than a 3D trigger. :icon_biggrin:


    Now, is there a way to check if the player is looking into the dimensions of this trigger cube?




    Any input (other ideas too) is appreciated, thanks.

  6. 1 hour ago, tRiKy_ch said:

    btw with this method you have to create a script who collect all the data you need (e.g. unit/vehciles status and positions, objective status, destroyed building, and so...) and put it in the string to save, for loading you have to write a script who read this string and set all these data to the mission


    Ok, I'm starting right away to write these scripts then... :icon_biggrin: Hm, that sounds like an impossible task. :icon_confused:


    1 hour ago, AZCoder said:


    That must be some crazy mission.....

    Of course you can simply auto save it for the player before they run into the horde of enemy ... although autosave is something of a warning bell to alert players.



    Yeah, but this is not always predictable.


    And you're right - this was the way in OFP that you knew that something was gonna happen soon. :icon_biggrin:



    Anyway, thanks for your replies.

  7. Hi guys!


    Is there a way to (scriptwise) save the game in a way that multiple save-game slots are created, just like when the player saves manually via the ESC menu (there are 8 slots or so)?


    In many of my missions I offer the player unlimited saves via the radio menu 0-0-0, but here I use the saveGame command, which has only "one slot", which again means that the newest save-game overwrites the previous one. If the player then (we all know these situations :icon_biggrin:) gets in a bad situation (e.g. suddenly is overwelmed by 1000000 soldiers and 400 tanks just one second after using this save-game) AND if he didn't use the alternative "User Save" from the menu, which creates the save-game at another location, then... well, he's screwed and he will have to restart the whole mission, which is kinda frustrating.


    This is why I'm looking for another way to use the radio menu save-game. The saveGame command is ok, but absolutely fails in the situations mentioned above.



    So: Is there a way to scriptwise make a User Save? Or is there a way to create multiple slots for the saveGame command (two would already be ok).


    Looking forward to your ideas, thanks.

    • Like 1

  8. Good roadmap for the rest of this year. Looking forward to it and thanks, BI.


    The story of (Grumpy :icon_biggrin:) Old Man sounds exciting. And I really expect a continuation of Miller's story line. You heard it, BI! :icon_biggrin:


    Glad that the next Arma is still years away - this way we have some more time to finish one or another project.

    • Like 4

  9. 35 minutes ago, 7erra said:
    _cfgArray = getArray (configfile >> "CfgWeapons" >>  _yourWeapon >> "WeaponSlotsInfo" >> "MuzzleSlot" >> "compatibleItems"); 
    _supressor = [nil, selectRandom _cfgArray] select (count _cfgArray > 0);
    _unit addPrimaryWeaponItem _supressor;



    Thanks a lot, 7erra! Much appreciated.


    At first it didn't work, but then I checked the config and found what to change -> the part in the "WeaponSlotsInfo". In vanilla it is "MuzzleSlot", in CUP it's "CUP_EastMuzzleSlotAK". 


    This means that the code is not totally "universal", but in my case it's absolutely sufficient as there are no Western weapons in the corresponding mission.


    Thanks again!


    The code looks like this now:


    _cfgArray = getArray (configfile >> "CfgWeapons" >> (currentWeapon player) >> "WeaponSlotsInfo" >> "CUP_EastMuzzleSlotAK" >> "compatibleItems"); 
    _supressor = [nil, selectRandom _cfgArray] select (count _cfgArray > 0);
    player addPrimaryWeaponItem _supressor; 


    • Like 2

  10. Good day, a new version is up - just a small script fix after a change in the Max Life Pack mod.




    Start the run for your life now with

    v. 1.7 in the first post:icon5:








    Btw. as a small advertisement: :don11:

    I've recently got some pleasant feedback from a friend that had replayed it and realized that there is a whole alternative campaign end, depending how one of the missions is played. 


    In total there are three endings to be found out.



    Cheers to @Kalle M. :icon14:

    • Like 3
    • Thanks 2

  11. 4 hours ago, SlovakianLynx said:
    • I opose the whole dumb rating system. I have learned that a long time ago, when I was visiting a rail sim sight, where you could download objects for the game. Good quality stuff had bad ratings and the ones with lesser quality was top rated.Alsow one guy rated my ArmA 2 campaign 2/10 without a good reason. Therefore I preffer to write a comment, like was already said above. RATING SYSTEMS SHOULD NOT EXIST! They are only a good tool for cowards, who don't know what positive criticism is.


    I totally agree with you, but on the other hand exactly this is why positive ratings are important. Reality is that this bad SW rating systems is there and players look at the stars while searching for good missions. Comments are great and as I said earlier they are what motivates more and are useful and stuff but they are only seen if the player enters the mission web page. And that's what positive ratings are needed for.

    Therefore I can just encourage you to give it (and every mission/campaign/addon you like) a :icon14:.

    • Thanks 1