aussie battler

[SOLVED] Vehicle Flip is a self destruct button

16 posts in this topic

Posted (edited)

UPDATE: This code works. Use it if you want to put vehicles briefly in godmode when flipping.

I noticed that the vehicle flip button (especially on tanks) sets the vehicle off to explode. Probably because bohemia messed with hit points to wheels / tracks a few updates ago.
 

I tried to add vehicle godmode to "flip", but it didnt kick in, I can shoot the wheels out straight after the flip....

I just added 3 lines of code

_vehicle allowDamage false;  // START of GODMODE

sleep 7;      //End of GODMODE in 7 sconds
_vehicle allowDamage true; //End of GODMODE



ExileClient_object_vehicle_flip.sqf

Spoiler

/**
 * ExileClient_object_vehicle_flip
 *
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_vehicle","_pos"];
_vehicle = _this select 0;
if (!(typeOf _vehicle in ["Exile_Bike_MountainBike","Exile_Bike_OldBike"]) && (isEngineOn _vehicle)) exitWith {false};
if ((locked _vehicle) isEqualTo 2) exitWith {false};
if (local _vehicle) then
{
    systemchat "Vehicle Flip Started";      

   _vehicle allowDamage false;  // START of GODMODE
    _pos = getPosATL _vehicle;
    _pos set [2,(_pos select 2) + 1];
    _vehicle setPosATL _pos;
    _vehicle setVectorUp [0, 0, 1];
    sleep 7;      //End of GODMODE in 7 sconds
    _vehicle allowDamage true; //End of GODMODE

    systemchat "Vehicle Flip Ended";   
    }
else
{
    ["flipVehRequest",[netId _vehicle]] call ExileClient_system_network_send;
};
true

Can anyone see what I am doing wrong?
 

Edited by aussie battler

Share this post


Link to post
Share on other sites

Hello @aussie battler,

While I am not a scripting expert, it looks like it SHOULD work.

What I would suggest is for you to include 'test statements' in the above code to make sure this is even being run.

 

Example:

 _vehicle allowDamage false;  // START of GODMODE
    _pos = getPosATL _vehicle;
    _pos set [2,(_pos select 2) + 1];
    _vehicle setPosATL _pos;
    _vehicle setVectorUp [0, 0, 1];
    sleep 7;      //End of GODMODE in 7 sconds
    _vehicle allowDamage true; //End of GODMODE

 

To:

 _vehicle allowDamage false;  // START of GODMODE

systemchat "God Mode Started";
    _pos = getPosATL _vehicle;
    _pos set [2,(_pos select 2) + 1];
    _vehicle setPosATL _pos;
    _vehicle setVectorUp [0, 0, 1];
    sleep 7;      //End of GODMODE in 7 sconds
    _vehicle allowDamage true; //End of GODMODE

systemchat "God Mode Finished";

 

This will let you know that the script is at least running.  I suspect that it is not and/or there is another script that is running instead of this one.

Using the 'debug text' will help you with this!

:)

 

2 people like this

Share this post


Link to post
Share on other sites
Advertisement

Posted (edited)

@Z80CPU It turned out the code works. Fox survival vehicles have weird hitpoints on the wheels when you shoot them.

Thanks for your help.

Edited by aussie battler

Share this post


Link to post
Share on other sites

Posted (edited)

I change the system chat to read, "Vehicle Flip Started";   (instead of "vehicle Godmode enabled").

Dont want players exploiting the flip Godmode & using the vehicle as cover.

Edited by aussie battler
1 person likes this

Share this post


Link to post
Share on other sites

Posted (edited)

@aussie battler I have a related issue, any idea how we can make it so that vehicle owners can flip a vehicle should it still be running? I have a few problem children who keep getting ejected from striders but can't flip them due to they are still running.

This is what I think might work?
 

Spoiler

/**
 * ExileClient_object_vehicle_flip
 *
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_vehicle","_pos","_playerUID","_OwnerUID"];
_vehicle = _this select 0;
_playerUID = player getPlayerUID player;
_OwnerUID = _vehicle getVariable ['ExileOwnerUID', ''];
if (!(typeOf _vehicle in ["Exile_Bike_MountainBike","Exile_Bike_OldBike"]) && ((isEngineOn _vehicle) && !(_playerUID isEqualTo _OwnerUID))) exitWith {false};
if ((locked _vehicle) isEqualTo 2) exitWith {false};
if (local _vehicle) then
{
    systemchat "Vehicle Flip Started";      

   _vehicle allowDamage false;  // START of GODMODE
    _pos = getPosATL _vehicle;
    _pos set [2,(_pos select 2) + 1];
    _vehicle setPosATL _pos;
    _vehicle setVectorUp [0, 0, 1];
    sleep 5;      //End of GODMODE in 7 seconds
    _vehicle allowDamage true; //End of GODMODE

    systemchat "Vehicle Flip Ended";   
    }
else
{
    ["flipVehRequest",[netId _vehicle]] call ExileClient_system_network_send;
};
true

 

 

Edited by geekm0nkey

Share this post


Link to post
Share on other sites

Posted (edited)

@geekm0nkey I just tell players to grab another vehicle & tow the upside down vehicle. It flips it back up.

If you really wanted to code a car flipping with the engine on you would have to change ExileClient_object_vehicle_interaction_show.

I am not sure if your way will bring up the flip menu if the vehicle engine is running.
It first checks "ExileClient_object_vehicle_interaction_show.sqf" which says only appear if the vehicle is unlocked & engine off.

Spoiler

            class CfgInteractionMenus
{   
    #include "EBM\menus.hpp"  
    class Car
    {

            // Flips a vehicle so the player doesnt have to call an admin
            // Check if vector up is fucked
            class Flip: ExileAbstractAction
            {
                title = "Flip";
                condition = "call ExileClient_object_vehicle_interaction_show";
                action = "_this call ExileClient_object_vehicle_flip";
            };

You could try changing it to this:
ExileClient_object_vehicle_interaction_show.sqf
In class CfgExileCustomCode add

ExileClient_object_vehicle_interaction_show.sqf = "ExileClient_object_vehicle_interaction_show.sqf"

Drop this file ExileClient_object_vehicle_interaction_show.sqf in your mission folder:

Spoiler

/**
 * ExileClient_object_vehicle_interaction_show
 *
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
// !(isEngineOn ExileClientInteractionObject) &&

!(locked ExileClientInteractionObject isEqualTo 2)

It will also mean that players can drain fuel & refuel with the engine running.

You would need to add this by @MGTDB to stop trolls flipping vehicles in the safefzone.

 

Edited by aussie battler
1 person likes this

Share this post


Link to post
Share on other sites

Posted (edited)

12 hours ago, aussie battler said:

@geekm0nkey I just tell players to grab another vehicle & tow the upside down vehicle. It flips it back up.

If you really wanted to code a car flipping with the engine on you would have to change ExileClient_object_vehicle_interaction_show.

I am not sure if your way will bring up the flip menu if the vehicle engine is running.
It first checks "ExileClient_object_vehicle_interaction_show.sqf" which says only appear if the vehicle is unlocked & engine off.

  Hide contents

            class CfgInteractionMenus
{   
    #include "EBM\menus.hpp"  
    class Car
    {

            // Flips a vehicle so the player doesnt have to call an admin
            // Check if vector up is fucked
            class Flip: ExileAbstractAction
            {
                title = "Flip";
                condition = "call ExileClient_object_vehicle_interaction_show";
                action = "_this call ExileClient_object_vehicle_flip";
            };

You could try changing it to this:
ExileClient_object_vehicle_interaction_show.sqf
In class CfgExileCustomCode add

ExileClient_object_vehicle_interaction_show.sqf = "ExileClient_object_vehicle_interaction_show.sqf"

Drop this file ExileClient_object_vehicle_interaction_show.sqf in your mission folder:

  Hide contents

/**
 * ExileClient_object_vehicle_interaction_show
 *
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
// !(isEngineOn ExileClientInteractionObject) &&

!(locked ExileClientInteractionObject isEqualTo 2)

It will also mean that players can drain fuel & refuel with the engine running.

You would need to add this by @MGTDB to stop trolls flipping vehicles in the safefzone.

 

Ill look into those suggestions, didn't know about the towing trick, ill let them know that as well. but i also want to try the following to see if it will work, basically check to see if it's the vehicle owner and just shuts the engine off just prior to the flip. Haven't tested yet, as I'm at work, but will ask a player.. My last attempt i think made the if statement too complex, so making the suggestion @Z80CPU offered and just turning off the engine first may help.

Spoiler

/**
 * ExileClient_object_vehicle_flip
 *
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_vehicle","_pos","_OwnerUID"];
_vehicle = _this select 0;
_OwnerUID = _vehicle getVariable ["ExileOwnerUID", "unknown"];
if((getPlayerUID player) isEqualTo _OwnerUID) then { _vehicle engineOn false; };
if (!(typeOf _vehicle in ["Exile_Bike_MountainBike","Exile_Bike_OldBike"]) && (isEngineOn _vehicle)) exitWith {false};
if ((locked _vehicle) isEqualTo 2) exitWith {false};
if (local _vehicle) then
{
    // systemchat "Vehicle Flip Started";      

    _vehicle allowDamage false;  // START of GODMODE
    _pos = getPosATL _vehicle;
    _pos set [2,(_pos select 2) + 1];
    _vehicle setPosATL _pos;
    _vehicle setVectorUp [0, 0, 1];
    sleep 5;
    _vehicle allowDamage true;  // END of GODMODE

    // systemchat "Vehicle Flip Ended";   
    }
else
{
    ["flipVehRequest",[netId _vehicle]] call ExileClient_system_network_send;
};
true

 

 

Edited by geekm0nkey

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

  • Recently Browsing   0 members

    No registered users viewing this page.