Sign in to follow this  
Followers 0
geekm0nkey

Spawn 90 Degrees

3 posts in this topic

Im using the code below with XM8 to spawn a quad, but its always facing forward, how would i change this so that it would be 90 degrees to the player? I have tried adding setDir -90 to it and it didn't work?

Spoiler

ExAd_DV_DESPAWN_IDLE_TIME = 600;

ExAd_XM8_DV_fnc_itemsInCargo = {
    params ["_container","_itemArray","_item","_amount","_response"];

    _item = toLower (_itemArray select 0);
    _amount = _itemArray select 1;

    _response = false;
    {
        if(_item == toLower _x)then{
            _amount = _amount - 1;
        };
        if(_amount <= 0)exitWith{_response = true}
    }forEach magazines player;

    _response    
};

ExAd_XM8_DV_fnc_itemsMissing = {
    params["_recipe","_recipeStr"];
    
    _recipeStr = "";
    {
        private["_amount","_configName","_displayName","_text"];
        _amount = if(count _x > 1)then{_x select 1}else{1};
        _text = [_x select 0] call ExAd_XM8_DV_fnc_getDisplayName;
        _recipeStr = _recipeStr + format["%1x : %2<br />",(if(_amount < 0)then{((-1) * _amount)}else{_amount}), _text];
    }forEach _recipe;
    
    _response = format["You need <br />%1",_recipeStr];

    _response
};

ExAd_XM8_DV_fnc_getDisplayName = {
    params["_class","_configName","_displayName"];
    _configName = _class call ExileClient_util_gear_getConfigNameByClassName;
    _displayName = getText(configFile >> _configName >> _class >> "displayName");
    _text = if(count _displayName > 0)then{_displayName}else{_class};

    _text
};

ExAd_XM8_DV_fnc_canPack = {
    ( ExileClientInteractionObject getVariable["ExAd_DV_Packable", false] )
};

ExAd_XM8_DV_fnc_pack = {
    [ExileClientInteractionObject] spawn {
        params["_obj"];
    
        disableUserInput true;
        player playActionNow "Medic";

        uiSleep 3;
        ["despawnDeployableVehicle", [netId _obj]] call ExAd_fnc_serverDispatch;
        uiSleep 1;

        ["SuccessTitleAndText", ["Vehicle Packed"]] call ExileClient_gui_toaster_addTemplateToast;
        disableUserInput false;
    };
};

ExAd_XM8_DV_fnc_spawnVehicle = {
    params["_slideClass","_bambiState","_delopyRecipe","_vehicleClass"];

    try
    {    
        
        if !(vehicle player == player) then { throw "You can't do this in a vehicle!"};
        
        _bambiState = if(isNumber(missionConfigFile >> "CfgXM8" >> _slideClass >> "bambiState")) then
        {
            if(getNumber(missionConfigFile >> "CfgXM8" >> _slideClass >> "bambiState") > 0)then{true}else{false}
        } else {true};

        if(_bambiState && !ExileClientPlayerIsBambi) then { throw "You can only spawn vehicles as a bambi!"};

        _delopyRecipe = getArray(missionConfigFile >> "CfgXM8" >> _slideClass >> "recipe");
        if(count _delopyRecipe > 0) then
        {
            {
                if(count _x > 1) then
                {
                    _amount = if(_x select 1 == -1)then{1}else{_x select 1};
                    if!([player, [_x select 0, _amount]] call ExAd_XM8_DV_fnc_itemsInCargo) then
                    {
                        throw ([_delopyRecipe] call ExAd_XM8_DV_fnc_itemsMissing);
                    };
                } else {
                    if!([player, _x select 0] call ExileClient_util_playerEquipment_contains) then
                    {
                        throw ([_delopyRecipe] call ExAd_XM8_DV_fnc_itemsMissing);
                    }
                }
            }forEach _delopyRecipe;

            {
                _count = if(count _x > 1)then{(_x select 1)}else{1};
                for "_i" from 1 to _count do {
                    [player, _x select 0] call ExileClient_util_playerCargo_remove
                }
            }forEach _delopyRecipe;
        };

        _vehicleClass = getText(missionConfigFile >> "CfgXM8" >> _slideClass >> "vehicleClass");
        if!(isClass(configFile >> "CfgVehicles" >> _vehicleClass ))then { throw "The vehicle class doesn't exist"};

        [_slideClass] spawn {
            params["_slideClass"];
            disableUserInput true;
            player playActionNow "Medic";

            uiSleep 3;
            ["spawnDeployableVehicle", [netId player, _slideClass]] call ExAd_fnc_serverDispatch;
            uiSleep 1;
            ["SuccessTitleAndText", ["Vehicle deployed"]] call ExileClient_gui_toaster_addTemplateToast;
            ExileClientXM8CurrentSlide = "extraApps";
            disableUserInput false;
        };    

        ["extraApps", 1] call ExileClient_gui_xm8_slide;
        closeDialog 0;


    }
    catch{
        [_exception] spawn {
            UISleep 0.5;
            ["ErrorTitleAndText", ["ExAd - Deploy Vehicle", _this select 0]] call ExileClient_gui_toaster_addTemplateToast;
            ["extraApps", 1] call ExileClient_gui_xm8_slide;
        };
    };
};

 

 

Edited by geekm0nkey

Share this post


Link to post
Share on other sites
10 hours ago, geekm0nkey said:

Im using the code below with XM8 to spawn a quad, but its always facing forward, how would i change this so that it would be 90 degrees to the player? I have tried adding setDir -90 to it and it didn't work?

  Reveal hidden contents

ExAd_DV_DESPAWN_IDLE_TIME = 600;

ExAd_XM8_DV_fnc_itemsInCargo = {
    params ["_container","_itemArray","_item","_amount","_response"];

    _item = toLower (_itemArray select 0);
    _amount = _itemArray select 1;

    _response = false;
    {
        if(_item == toLower _x)then{
            _amount = _amount - 1;
        };
        if(_amount <= 0)exitWith{_response = true}
    }forEach magazines player;

    _response    
};

ExAd_XM8_DV_fnc_itemsMissing = {
    params["_recipe","_recipeStr"];
    
    _recipeStr = "";
    {
        private["_amount","_configName","_displayName","_text"];
        _amount = if(count _x > 1)then{_x select 1}else{1};
        _text = [_x select 0] call ExAd_XM8_DV_fnc_getDisplayName;
        _recipeStr = _recipeStr + format["%1x : %2<br />",(if(_amount < 0)then{((-1) * _amount)}else{_amount}), _text];
    }forEach _recipe;
    
    _response = format["You need <br />%1",_recipeStr];

    _response
};

ExAd_XM8_DV_fnc_getDisplayName = {
    params["_class","_configName","_displayName"];
    _configName = _class call ExileClient_util_gear_getConfigNameByClassName;
    _displayName = getText(configFile >> _configName >> _class >> "displayName");
    _text = if(count _displayName > 0)then{_displayName}else{_class};

    _text
};

ExAd_XM8_DV_fnc_canPack = {
    ( ExileClientInteractionObject getVariable["ExAd_DV_Packable", false] )
};

ExAd_XM8_DV_fnc_pack = {
    [ExileClientInteractionObject] spawn {
        params["_obj"];
    
        disableUserInput true;
        player playActionNow "Medic";

        uiSleep 3;
        ["despawnDeployableVehicle", [netId _obj]] call ExAd_fnc_serverDispatch;
        uiSleep 1;

        ["SuccessTitleAndText", ["Vehicle Packed"]] call ExileClient_gui_toaster_addTemplateToast;
        disableUserInput false;
    };
};

ExAd_XM8_DV_fnc_spawnVehicle = {
    params["_slideClass","_bambiState","_delopyRecipe","_vehicleClass"];

    try
    {    
        
        if !(vehicle player == player) then { throw "You can't do this in a vehicle!"};
        
        _bambiState = if(isNumber(missionConfigFile >> "CfgXM8" >> _slideClass >> "bambiState")) then
        {
            if(getNumber(missionConfigFile >> "CfgXM8" >> _slideClass >> "bambiState") > 0)then{true}else{false}
        } else {true};

        if(_bambiState && !ExileClientPlayerIsBambi) then { throw "You can only spawn vehicles as a bambi!"};

        _delopyRecipe = getArray(missionConfigFile >> "CfgXM8" >> _slideClass >> "recipe");
        if(count _delopyRecipe > 0) then
        {
            {
                if(count _x > 1) then
                {
                    _amount = if(_x select 1 == -1)then{1}else{_x select 1};
                    if!([player, [_x select 0, _amount]] call ExAd_XM8_DV_fnc_itemsInCargo) then
                    {
                        throw ([_delopyRecipe] call ExAd_XM8_DV_fnc_itemsMissing);
                    };
                } else {
                    if!([player, _x select 0] call ExileClient_util_playerEquipment_contains) then
                    {
                        throw ([_delopyRecipe] call ExAd_XM8_DV_fnc_itemsMissing);
                    }
                }
            }forEach _delopyRecipe;

            {
                _count = if(count _x > 1)then{(_x select 1)}else{1};
                for "_i" from 1 to _count do {
                    [player, _x select 0] call ExileClient_util_playerCargo_remove
                }
            }forEach _delopyRecipe;
        };

        _vehicleClass = getText(missionConfigFile >> "CfgXM8" >> _slideClass >> "vehicleClass");
        if!(isClass(configFile >> "CfgVehicles" >> _vehicleClass ))then { throw "The vehicle class doesn't exist"};

        [_slideClass] spawn {
            params["_slideClass"];
            disableUserInput true;
            player playActionNow "Medic";

            uiSleep 3;
            ["spawnDeployableVehicle", [netId player, _slideClass]] call ExAd_fnc_serverDispatch;
            uiSleep 1;
            ["SuccessTitleAndText", ["Vehicle deployed"]] call ExileClient_gui_toaster_addTemplateToast;
            ExileClientXM8CurrentSlide = "extraApps";
            disableUserInput false;
        };    

        ["extraApps", 1] call ExileClient_gui_xm8_slide;
        closeDialog 0;


    }
    catch{
        [_exception] spawn {
            UISleep 0.5;
            ["ErrorTitleAndText", ["ExAd - Deploy Vehicle", _this select 0]] call ExileClient_gui_toaster_addTemplateToast;
            ["extraApps", 1] call ExileClient_gui_xm8_slide;
        };
    };
};

 

 

You need to do that in the Exad_DV.pbo in server addons

 in fn_spawnDeployableVehicle.sqf

I haven't tested this but you should do something like this

right below 

Quote

_vehicleClass = getText(missionConfigFile >> "CfgXM8" >> _configClass >> "vehicleClass");

do this

Quote

if (_vehicleClass == "yourquadbikeclassname") then {

     _spawnPos = _player modelToWorld [0,5,0.1];

     _spawnDir = _spawnDir + 90; //not sure if this will work but it seems logical.

};

 

should be good then.

1 person likes this

Share this post


Link to post
Share on other sites

I see what needs to be done I think.. Thanks.

In the file fn_spawnDeployableVehicle.sqf I changed line 23,24 to...

_spawnPos = _player modelToWorld [0,3,0]; // changed 2 to 3 spawn a bit further away.
_spawnDir = (direction _player) - 90; // reorient item 90 degrees!

worked like a charm.

Edited by geekm0nkey
2 people like this

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.