Jump to content

.Marti

Member
  • Content Count

    21
  • Joined

  • Last visited

  • Medals

Posts posted by .Marti


  1. I reply my own thread cause i found the solution, and maybe can be helpful for someone in the future. 

     

    We had a machine with multiple servers, but only one profile for all of them. Seems that servers were rewriting the shared profile and information sometimes was lost randomly. 

     

    Solution: 1 profile for each server. (Seems obvious now, but... ).

     

    Cheers.


  2. Original title was: How to copyToClipboard in MP and alternatives. But i found the original problem

     

    Hi there,

     

    I built a persistance system to work in a Dedicated enviroment. It saves an array in the profileNamespace. 

    However, for some reason if server restarts, all the profile variables are deleted. 

    So, to prevent the loss of all information i was thinking about doing copyToClipboard to all clients so the playerbase can store a copy of the array (Just in case). 

     

    Ofc, copyToClipboard doesnt work in MP,  so I ask you: Which alternative i could use so everyone can store a copy of an array in a dedicated server?

     

    Cheers and thanks


  3. The problem probably is that you are not loading the addons/one of them correctly OR you have an addon missing server side.

     

    In our case, we had the route to one of the mods with a syntax error (So it was like the addon were missing). Even tho the mission hadn't that specific dependency, when introducing Zeus in the mission it will check for it (In our case, RHS, because we had it on Local but was not well enabled on server). 

     

    that's how far i can tell you, recheck you have all the mods well routed. Probably you can see in the RPT file what are the missing files. Check that out. Maybe someone can tell you something else, but i think without the RPT file is harder to find a solution. Cheers.


  4. Hello there, 

     

    Just today we had this issue in our community. The thing is (and i have no excessive idea about this) when you dont put any asset from one specific mod (e.g. RHS) nor Zeus, the server doesnt care about that mod beign corrupted/not well loaded. 

     

    When you use Zeus the server wants to make sure that addon is well loaded. 

     

    In our case it was simple enough, we had a syntax error when loading RHS and thus that mod was missing. 

     

    Btw, if you are from my comunity: it's solved! Crisis avoided! 😆


  5. On 8/23/2020 at 9:16 PM, 7erra said:

    maybe this function could be useful: https://community.bistudio.com/wiki/BIS_fnc_itemType

     

     thanks another time for the tip. Guidance is always helpful!

     

    On 8/23/2020 at 9:39 PM, Larrow said:

    Suppose it depends on if you want to store weapons and their current attachments, mags and ammo count and magazines with ammo count.

      Reveal hidden contents
    
    
    
    //_container = myBox; //Some container name given in editor
    _container = cursorObject;
    
    TAG_fnc_getContents = {
    	params[ "_container" ];
    	
    	private _cargo = [ 
    		weaponsItemsCargo _container call BIS_fnc_consolidateArray,
    		( itemCargo _container select{ !( toLowerANSI( _x call BIS_fnc_itemType select 1 ) in [ "backpack", "uniform", "vest" ] ) } ) call BIS_fnc_consolidateArray,
    		magazinesAmmoCargo _container call BIS_fnc_consolidateArray
    	];
    	
    	private _containerCargo = everyContainer _container;
    	{
    		_x params[ "_type", "_object" ];
    		
    		_containerCargo set[ _forEachIndex, [ _type, _object call TAG_fnc_getContents ] ];
    	}forEach _containerCargo;
    	
    	[ _cargo, _containerCargo ]
    };
    
    //Get the contents
    _containerContents = _container call TAG_fnc_getContents;
    
    //Clear out cargo
    clearItemCargoGlobal _container;
    clearWeaponCargoGlobal _container;
    clearBackpackCargoGlobal _container;
    clearMagazineCargoGlobal _container;
    
    TAG_fnc_setContents = {
    	params[ "_container", "_contents" ];
    	_contents params[ "_cargo", "_containers" ];
    	
    	{
    		_x params[ "_cont", "_contents" ];
    		
    		_every = everyContainer _container;
    		if ( _cont call BIS_fnc_itemType select 1 == "backpack" ) then {
    			_container addBackpackCargoGlobal[ _cont, 1 ];
    		}else{
    			_container addItemCargoGlobal[ _cont, 1 ];
    		};
    		_addedContainer = ( everyContainer _container - _every ) select 0 select 1;
    		
    		clearItemCargoGlobal _addedContainer;
    		clearWeaponCargoGlobal _addedContainer;
    		clearBackpackCargoGlobal _addedContainer;
    		clearMagazineCargoGlobal _addedContainer;
    		
    		[ _addedContainer, _contents ] call TAG_fnc_setContents;
    	}forEach _containers;
    	
    	_fnc_addContents = {
    		params[ "_index", "_details", "_count" ];
    		
    		switch ( _index ) do {
    			//weapons
    			case ( 0 ) : {
    				_container addWeaponWithAttachmentsCargoGlobal[ _details, _count ];
    			};
    			//items
    			case ( 1 ) : {
    				_container addItemCargoGlobal[ _details, _count ];
    			};
    			//magazines
    			case ( 2 ) : {
    				_details params[ "_mag", "_ammo" ];
    				
    				_container addMagazineAmmoCargo[ _mag, _count, _ammo ];
    			};
    		};
    	};
    	
    	{
    		private _index = _forEachIndex;
    		{
    			_x params[ "_item", "_count" ];
    
    			[ _index, _item, _count ] call _fnc_addContents;
    		}forEach _x;
    	}forEach _cargo;
    	
    };
    
    //Add cargo back in
    [ _container, _containerContents ] call TAG_fnc_setContents;

    Needs thoroughly testing.

     

     

    Thanks so much,  Larrow! Much appreciated, will test it out. 

     

    That kind of sensation when you spent whole days trying to do something and it's clearly worst done than your code there. At least i learned a lot hahah

     

     

    EDIT: Tested and working propperly.

     


  6. Hey there! 

     

    I need to separate an array of various items in weapons/magazines/backpacks/items to load them to a box with addWeaponCargo, addItemCargo, etc.

     

    Example of the array:

     

    Quote

    [["U_O_CombatUniform_ocamo",4],["U_O_CombatUniform_oucamo",4],["U_O_OfficerUniform_ocamo",4];

     

    I got them with getWeaponCargo, etc. Maybe the easiest solution would be to store them in different variables when i got them?

    I would be surprised if I can't classify them but i can't find nothing about it.

     

    Any idea how to proceed? Thanks!

     

    -------------------

     

    Edit: I'm not storing the arrays directly on different variables because they are suposed to be stored in the profileNamespace of a server, and i wanted to mantain a clean enviroment, but i will do it if I need to.


  7. 5 hours ago, sarogahtyp said:

    The solution could be a global variable wherein u store all groups.

    In your setTriggerStatements-part u can't use the _x of the outer scope in the strings because that _x is not known there on the time of execution.

    You have to use a global variable to get the desired groups there.

     

    Thanks for your response @sarogahtyp, I went a little bit further with scopes etc following your advice and found this post with various aportations:

    Subsequently I edited my initial code with the following:

     

    Spoiler
    Quote

    params ["_logic","_groupsConnected","_surrenderLimit"];
    // _groupsConnected = [grupo1];
    // _surrenderLimit = 100;

    {
        //Surrender calculations
        _surrenderPercentage = _surrenderLimit/100;
        _surrenderCapRaw = (count units _x) * _surrenderPercentage;
        _surrenderCap = round _surrenderCapRaw;
        if (_surrenderCap < 2) then {_surrenderCap = 2};
        
        //create trigger/s
        _surrenderTrigger = createTrigger ["EmptyDetector", getPos _logic, false];
        
        //pass variables
        _surrenderTrigger setVariable ["SurrenderCap",_surrenderCap];
        _surrenderTrigger setVariable ["GrupoActual",_x];
        
        //define trigger
        _surrenderTrigger setTriggerActivation ["NONE", "PRESENT", false];
        _surrenderTrigger setTriggerArea [0, 0, 0, true];
        _surrenderTrigger setTriggerStatements 
        [
            "({alive _x} count units (thisTrigger getVariable 'GrupoActual')) < (thisTrigger getVariable 'SurrenderCap')",  //condition: When there is only X units alive.
            "{
            _x setCaptive true; 
            _x action ['Surrender', _x];
            } forEach units (thisTrigger getVariable 'GrupoActual')",  //activation
            ""
        ];

    } forEach _groupsConnected;

    true

     

     

    It works now!!

     

    Thanks for the alternative solution aswell @pierremgi

    Btw, what i'm trying to do is a modules addon for my comunity and i'm learning A LOT with your MGI_Modules. Hope i'm not breaking any authors rights and you are confortable with a scripting newbie learning with it! 😛



     


  8. Hi guys, i'm trying to create a trigger for certain number of groups but i'm so lost. 

     

    First of all i have an array of groups called _groupsConnected, each of them has an undetermined amount of units inside. 

     

    I want to create a trigger for each of the groups. This is what i'm trying, i can figure that the problem is with the _x variables but i can not find a solution. 

     

    Quote

    {
        _surrenderTrigger = createTrigger ["EmptyDetector", getPos player, false];
        _surrenderTrigger setTriggerActivation ["NONE", "PRESENT", false];
        _surrenderTrigger setTriggerArea [0, 0, 0, true];
        _surrenderTrigger setTriggerStatements 
        [
            "( {alive _x} count units _x) < 2",  //condition: When there is only 1 unit alive. 
            "{_x setCaptive true; 
            _x action ["Surrender", _x];
            } forEach units _x",  //activation
            ""
        ];

    } forEach _groupsConnected;

     

    This is meant to be executed server side only. Maybe there is an easier way to do this instead of using triggers. 

     

    Any idea is very welcome. Thanks!

     


  9. Hi there, I created a very basic script to take control over other units. It's meant to be used on dedicated server. 

     

    I spawn the function with this, in a standard trigger (Blufor/present). 

     

    Quote

    _myFunction = [] spawn moveUnit;

     

    The function:

     

    Quote

    moveUnit = {

    if (!isDedicated && hasInterface) then {

        _antiguaUnidad = player;
        _grp = group player;
        _nuevaUnidad = _grp createUnit ["C_man_p_beggar_F", getMarkerPos "mrk1", [], 0, "FORM"];
        selectPlayer _nuevaUnidad;
        deleteVehicle _antiguaUnidad;
        };
    };

     

     

    The problem is: Sometimes works as intended (When any BLUFOR enters, the code is executed in every client). But sometimes, only executes for the player who entered the trigger. 

     

    I researched a little bit and you are supposed to use something like in thisList etc to execute something in a certain client. Am I missing something? Any ideas? Is the script wrong?

     

    Thanks, cheers. 

     


  10. Hey there, begginer editor here. I have a doubt regarding animationphase. I'm trying to adapt a script i saw on DayZmedic YT channel for dedicated enviroment. It's the one that allows you to tow a D-30 big gun from RHS. 
     

    The gun is foldable, and at some point the scripts runs a check for the animation phase of the gun. (== 0 when deployed, == 2.3 when folded). This will work in SP, however in dedicated the values are 0 when deployed, and 2.29921 when undeployed. (This, apart from the scripts, it brokes the fold functionality of the asset itself, because it does the same check). 

     

    This is something usual in dedicated enviroments? It's just the model i'm using?

     

    I guess i could modify the check to be something like:

     

    Quote

    if (_this animationPhase 'leftT' > 2.2) then {

     

    Instead of the original one:

     

    Quote

    if (_this animationPhase 'leftT' == 2.3) then {

     

    What i'm using to check the animationphase (via function on init.sqf):

     

    Quote

    animcheck = {

    _check = arti1 animationPhase "leftT";
    hint format ["Anim phase is %1", _check];

    };

     

    Any suggestions? Known errors? Ideas?

     

    Cheers. 


  11. Hi to everyone, new on the forums there! I am trying to make the following: 

     

    - I have a piece of intel, and I want it to be interactuable and to show up an image. (Very fancy)

    ["init", [this, "image.jpg", "Text message"]] call BIS_fnc_initLeaflet

    - Then, I want the mission to progress from there (to trigger, or sqf, I dont care). I don't know how to do it besides from placing a trigger near the intel, with blufor present and a little bit of delay timer. 

    Any suggestions? Maybe with eventhandlers (I never used them before, but i can't find the one that suits)?

     

    edit: for dedicated

×