Jump to content

serena

Member
  • Content Count

    335
  • Joined

  • Last visited

  • Medals

Posts posted by serena


  1. 1 minute ago, killzone_kid said:

    Yes "any". I can walk into the biggest marker, and it will be returned, then I can walk into the smallest marker, and it will be returned. Then, for the final test, I can close my eyes and walk in any random marker, and it will be returned. In my books this is called returning "any" marker.

     

    When you walk into area overlapped by three different markers my code returns smallest marker you're in


  2. 13 minutes ago, killzone_kid said:

    The code above will return the first marker unit is in, what is all business with getting the size and sorting???

     

    Yes, you're right. Code above will return the first marker unit is in, from markers array ordered by marker area, and this is exactly what he needs.

     

    // return marker name or empty string if unit outside of any marker
    SmallestMarkerUnitIsIn = {
    	{if (_this inArea _x) exitWith {_x}; ""} forEach allMapMarkersOrderedByArea};
    
    // Usage:
    private _marker = player call SmallestMarkerUnitIsIn;

     


  3. // in init.sqf
    waitUntil {time > 0};
    player linkItem "ItemGPS";
    
    sleep 0.75;
    hintC "Open your GPS";
    
    // marker area function
    MarkerArea = {
    	switch (markerShape _this) do {
    		case "RECTANGLE": {getMarkerSize _this params ["_msw", "_msh"]; _msw * _msh};
    		case "ELLIPSE":   {getMarkerSize _this params ["_msw", "_msh"]; _msw * _msh * 0.25 * pi};
    		default {0}
    	}
    };
    
    // create list of all markers ordered by area
    allMapMarkersOrderedByArea = [allMapMarkers,[],{_x call MarkerArea},"ASCEND"] call BIS_fnc_sortBy;
    
    
    // poll smallest marker with player and log in system chat
    while {true} do {
    	private _smallestMarker = {if (player inArea _x) exitWith {_x}; ""} forEach allMapMarkersOrderedByArea;
    	systemChat ("Player inside marker: " + _smallestMarker);
    	sleep 1;
    };

    Demo mission: link


  4. // disabe automatic target popup globally
    nopop = true;
    
    // popup target manualy (0 - up, 1 - down)
    _target animate["terc", 0];
    
    // check target popup state (0 - up, 1 - down)
    private _state = _target animationPhase "Terc";
    
    // target individual settings [DEV. VERSION ONLY!]
    _target setVariable ["nopop", true];
    _target setVariable ["popDelay", 10];
    
    // handle target hit event
    _target addEventHandler ["Hit", {
    	systemChat format ["Target %1 hit by unit %2", _this select 0, _this select 1]}];

     

    Did we not have the same thread just recently?


  5. * it is not working code but only the concept

    while {true} do {
    	sleep 1;
    	{
    		private _time = _vehicle getVariable "AbandonedAt";
    		if (VEHICLE_ABANDONED_CONDITION) then {
    			if (isNil "_time")
    				then {_vehicle setVariable ["AbandonedAt", time]}
    				else {
    					if (time - _time > ABANDONED_VHICLE_RESPAWN_DELAY) then {
    						_vehicle setVariable ["AbandonedAt", nil];
    						
    						// --------------------------
    						// put your respawn code here
    						// --------------------------
    					}
    				}
    		} else {
    			if (not isNil "_time") then {
    				_vehicle setVariable ["AbandonedAt", nil]}
    		}
    	} forEach allMyVehicles;
    };

     


  6. // init.sqf
    waitUntil {time > 0};
    
    player addAction ["Spawn BMP", {
    	private _veh = createVehicle ["O_APC_Wheeled_02_rcws_F",getMarkerPos "X1",[],0,"NONE"];
    	createVehicleCrew _veh;
    	
    	private _grp = group commander _veh;	
    	private _wpp = _grp addWaypoint [getMarkerPos "X1a", 0];
    	_wpp setWaypointType "MOVE";
    	_wpp setWaypointSpeed "LIMITED";
    	_wpp setWaypointBehaviour "SAFE";
    }];

    Sample mission: Link

     

    BIS_fnc_initVehicleCrew seems broken in my client.


  7. 10 minutes ago, rness said:

    2/ I want auto generate a multi array with addition (_1 _2 and _3) :
    --> _mutliarray = [["toto_1", "toto_2", "toto_3"],["titi_1", "titi_2", "titi_3"],["tata_1", "tata_2", "tata_3"]];

     

    // So
    private _multiarray = ["A", "B", "C"] apply {private _pre = _x; [1, 2, 3] apply {_pre + "_" + str _x}};
    // Or
    private _multiarray = ["A", "B", "C"] apply {private _pre = _x; [1, 2, 3] apply {format ["%1_%2", _pre, _x]}};
    // Result:
    // [["A_1","A_2","A_3"],["B_1","B_2","B_3"],["C_1","C_2","C_3"]]
    
    // Selecting
    private _chosen = _multiarray apply {selectRandom _x};
    // Result:
    // ["A_3","B_1","C_2"]

     

    • Like 1

  8. 13 minutes ago, celludriel said:

    If people would start to convert my missions to work with CUP or RHS would BIS_fnc_baseWeapon or BIS_fnc_weaponComponents still work ?  Is the base weapon an attribute of a complex template ?

    BIS_fnc_baseWeapon = {
    	private _class = _this param [0,"",[""]];
    	private _cfg = configFile >> "cfgWeapons" >> _class;
    	
    	if !(isClass _cfg) exitWith {
    		if (_class != "") then {["Class '%1' not found in CfgWeapons", _class] call BIS_fnc_error};
    		_class
    	};
    
    	private _base = getText (_cfg >> "baseWeapon");
    	if (isClass (configFile >> "cfgWeapons" >> _base)) exitWith {_base};
    
    	private _return = _class;
    	{	if (count (_x >> "linkeditems") == 0) exitwith {_return = configname _x;};
    	} foreach (_cfg call BIS_fnc_returnParents);
    	
    	_return;
    };

     

    • Like 1

  9. 5 minutes ago, mrcurry said:

    If you input the tropic MX class into BIS_fnc_baseWeapon it will return the basic weapon only. i.e. it strips out the camo and/or colour variants

     

    systemChat ("arifle_MX_khk_F" call Bis_fnc_BaseWeapon); 
    systemChat ("arifle_SPAR_01_GL_blk_F" call Bis_fnc_BaseWeapon); 
    
    // Output:
    // arifle_MX_khk_F
    // arifle_SPAR_01_GL_blk_F

    My function is working properly. Did I do something wrong?


  10. KeyFunctions = [//dik	//shift	//ctrl	//alt
    		[[23,	true,	false,	false], "YOURSCRIPT1"], // I + Shift
    		[[23, 	false,	true,	false], "YOURSCRIPT2"], // I + Ctrl
    		[[22, 	false,	false,	false], "YOURSCRIPT3"]];// U
    
    while {isNull(findDisplay 46)} do {sleep 0};
    (findDisplay 46) displayAddEventHandler ["KeyDown", {
    	private _kpd = _this select [1, 4];
    	{_x params ["_key", "_scr"]; if (_key isEqualTo _kpd) exitWith {execVM _scr; true}; false;
    	} forEach KeyFunctions;
    }];

     

    • Like 1

  11. KeyFunctions = [//dik	//shift	//ctrl	//alt
    		[[23,	true,	false,	false], "YOURSCRIPT1"], // I + Shift
    		[[23, 	false,	true,	false], "YOURSCRIPT2"], // I + Ctrl
    		[[22, 	false,	false,	false], "YOURSCRIPT3"]];// U
    
    while {isNull(findDisplay 46)} do {sleep 0};
    (findDisplay 46) displayAddEventHandler ["KeyDown", {
    	private _key = _this select [1, 4];
    	private _scr = {if (_x select 0 isEqualTo _key) exitWith {_x select 1}} forEach KeyFunctions;
    	if (isNil {_scr})
    		then {false}
    		else {execVM _scr; true}
    }];

     


  12. while {isNull(findDisplay 46)} do {sleep 0};
    (findDisplay 46) displaySetEventHandler ["KeyDown","call OnKeyDown"];
    
    KeyFunctions = [//dik	//shift	//ctrl	//alt
    		[[23,	true,	false,	false], "YOURSCRIPT1"], // I + Shift
    		[[23, 	false,	true,	false], "YOURSCRIPT2"], // I + Ctrl
    		[[22, 	false,	false,	false], "YOURSCRIPT3"]];// U
    
    OnKeyDown = {
    	private _key = _this select [1, 4];
    	private _scr = {if (_x select 0 isEqualTo _key) exitWith {_x select 1}} forEach KeyFunctions;
    	if (isNil {_scr})
    		then {false}
    		else {execVM _scr; true}
    };

     

×