Addaction near object problems

boyd

New Member
Hey

The problem i have is very weird, the thing that happens to me is when i get near the building object i don't get the option unless i get on top of the building and look down to it.

Code:
if((typeOf cursorTarget == "Krepost") and (player distance cursorTarget < 30)) then {

This Krepost is the fort from Origins, the cursortarget i increased and decreased and nothing changed.
I used getPosATL to and no success in getting the option to show unless i was at that spot on top of the building, maybe there is some kind of other check that hinders it from showing i don't no.

If anyone can help me out find any way to fix it, i would be very grateful.
 
I did not know that but it is spawned in by the database, i gues this count to as local??

Would this not work then?
Code:
_playerPos = getPosATL player;
//counts Houses within 4m of the player and checks if the number is greater than zero
_buildingfort = count nearestObjects [_playerPos, ["Krepost"], 30] > 0;
    if(_buildingfort) then {
 
This code still don't work only when i am at that spot but i don't have to look down, the funny thing is it show me a option of the player debug box. :D

Here is the whole code from self actions
Code:
_playerPos = getPosATL player;
//counts Houses within 4m of the player and checks if the number is greater than zero
_buildingfort = count nearestObjects [_playerPos, ["Krepost"], 30] > 0;

    if(_buildingfort) then {
        if (s_unlock_fort < 0) then {
                if(cursorTarget getVariable ["CharacterID","0"] == dayz_combination or cursorTarget getVariable ["CharacterID","0"] == dayz_playerUID) then {
                    _wiOeE = player addAction [format[ "Open %1",getText (configFile >> "CfgVehicles" >> typeOf cursorTarget >> "displayName")], "custom\ori_lock\ori_open.sqf",cursorTarget, 0, false, true, "",""];
                    _wiOeE = player addAction [format[ "Close %1",_text], "custom\ori_lock\ori_close.sqf",_cursorTarget, 0, false, true, "",""];
                    _wiOeE = player addAction [format[ "Open all doors inside",_text], "custom\ori_lock\ori_openall.sqf",_cursorTarget, 0, false, true, "",""];
                    _wiOeE = player addAction [format[ "Close all doors inside",_text], "custom\ori_lock\ori_closeall.sqf",_cursorTarget, 0, false, true, "",""];
                    _wiOeE = player addAction [format[ "Lock %1",_text], "custom\ori_lock\ori_lock.sqf",_cursorTarget, 0, false, true, "",""];
                    s_player_forti set [count s_player_forti,_wiOeE];
                } else {
                    _wiOeE = player addAction [format["Unlock %1",getText (configFile >> "CfgVehicles" >> typeOf cursorTarget >> "displayName")], "custom\ori_lock\bunker_combination_1.sqf",cursorTarget, 0, false, true, "",""];
                    s_player_forti set [count s_player_forti,_wiOeE];
                };
                s_unlock_fort = 1;
        };
    } else {
        //{player removeAction _x} forEach s_player_forti;s_player_forti = [];
        player removeAction s_unlock_fort;
        s_unlock_fort = -1;
    };
 
Back
Top