Jump to content
johnnyboy

[Release] JBOY FFV: Fall From Vehicles script

Recommended Posts

Here's another script that is a byproduct of my Property of Mabunga mission.  If you've tried that mission, please rate and comment on Steam.  I'm hoping to get enough ratings to merit "stars" on steam before Apex/Tanoa is released (once Tanoa is released, Altis missions will get less attention).

 

This script adds a KilledEventHandler to units that will have them fall out of vehicles when killed.  It is intended to be used only on vehicles with positions that look vulnerable to falling:

  • Hummingbird bench seats
  • 2 guys in back of offroads without tailgates, and offroad passenger if door is missing.
  • 2 guys laying on sides of zodiacs

You get bonus points if you spot the Easter Egg in the video (its more noticeable in full-screen)! B)

 

If you are using this on Offroads, then put this code in the vehicle init to remove doors and tailgates (otherwise it would look dumb to fall out of vehicle with doors):

{this animate [_x,1] ;} foreach ["HideDoor1","HideDoor2","HideDoor3"] ;  //Remove driver door, passenger door, and tailgate

 To execute for all crew in a vehicle, put this in vehicle's init:

{dummy = [_x] execVM "Scripts\JBOY_addEHFallFromVehicle.sqf";} foreach crew vehicle this; 

Or put this in an individual unit's init:

[this] execVM "Scripts\JBOY_addEHFallFromVehicle.sqf";

Create a file called JBOY_addEHFallFromVehicle.sqf in your mission directory, and put the following code in it:

//////////////////////////////////////////////////////////
// JBOY_addEHFallFromVehicle.sqf 
// By: johnnyboy
// dummy = [dude] execVM "Scripts\JBOY_addEHFallFromVehicle.sqf";
// Put this in vehicle's init (if passengers all in the vehicle):
// {dummy = [_x] execVM "Scripts\JBOY_addEHFallFromVehicle.sqf";} foreach crew vehicle this;
// When killed, units in certain vehicle positions fall out.  Use for offroads, hummingbirds and zodiacs.
// This effect only occurs if helicopter is in air, and if offroads/zodiacs are moving.
//////////////////////////////////////////////////////////
_unit = _this select 0;
_unit addMPEventHandler ["MPKilled", 
{
    params ["_cvictim", "_ckiller"];
    [_cvictim] spawn 
    {
        _cvictim = _this select 0;
        _veh = vehicle _cvictim;
        // We only execute the FallFromVehicle code for certain positions in certain vehicles
        if ((typeof _veh in ["B_Heli_Light_01_F"] and (_veh getCargoIndex _cvictim in [2,3,4,5])) or  // In hummingbird, only guys on benches fall
             (_veh isKindOf "Offroad_01_base_F"  and ((_veh getCargoIndex _cvictim in [0,1,2]) or (driver _veh) == _cvictim) and speed _veh >5) or   // In Offroad, only driver, front passenger, and 2 rear guys near tailgate
             (_veh isKindOf "Rubber_duck_base_F" and (_veh getCargoIndex _cvictim in [1,0]) and speed _veh >5)  // On zodiac, only 2 guys on sides of boat fall out
            ) 
        then {
            _cargoIndex = _veh getCargoIndex _cvictim;
            _grp = createGroup CIVILIAN;
            _invisibleDude = objnull;
            _invisibleDude = _grp createUnit ["C_man_polo_2_F_afro",[100,0,0],[],0,"NONE"];
            hideObjectGlobal _invisibleDude;
            _invisibleDude allowDamage False;
            _invisibleDude setCaptive True;
            
            sleep .35; // allow time to see death animation in vehicle, then boot him out
            _invisibleDude moveInCargo [_veh, _cargoIndex];
            _pos = getpos _invisibleDude;
            deleteVehicle _invisibleDude;
            
            // say3d doesn't work on dead AI, so create an object to say3d from
            _obj = "Land_Screwdriver_V2_F" createVehicle _pos; 
            if (_pos select 2 > 13) then
            {
                // falling dude randomly screams.  Scream comes from falling screwdriver object since dead units don't work as say3d source.
                // NOTE:  Not sure when/if I'll publish JBOY_say3d function below, so you can comment out this code and replace with your
                // own say3D statements to add screams.
                _rand = floor(random 6);
                switch ( _rand )  do 
                {
                   case 0: { nul = [_obj,0,"scream","Arrrrgghhhh","sidechat","say3d" ] call JBOY_say3d; };
                   case 1: { nul = [_obj,0,"scream2","Arrrrgghhhh","sidechat","say3d" ] call JBOY_say3d; };
                   case 2: { nul = [_obj,0,"scream","Arrrrgghhhh","sidechat","say3d" ] call JBOY_say3d;  };
                   default {  };
                };
                nul=[_obj] spawn {_obj = _this select 0; sleep 4; deleteVehicle _obj;};
            } else {
               _pos2 = getpos _cvictim;
               // position falling dead dude close to original sitting position
               if (_veh isKindOf "Rubber_duck_base_F") then {
                  _cvictim setpos [_pos2 select 0, (_pos2 select 1)+1, (_pos2 select 2) + .5]; 
                  sleep .2;
                  // bullet to create splash effect when body hits water
                  _splashBullet = "B_408_Ball" createVehicle [10,10000,0];
                  _splashBullet enableCollisionWith _cvictim;
                  _splashBullet setmass 50;
                  _splashBullet setpos (_cvictim modelToWorld [0,.1,.2]);
                  _splashBullet setvelocity [0,0,-1000];
              };
               if (_veh isKindOf "Offroad_01_base_F") then {
                  _cvictim setpos [_pos2 select 0, (_pos2 select 1)-1, (_pos2 select 2) + .6]; 
                  sleep .2;
                  // bullet to create dust effect when body hits ground
                  _splashBullet = "B_408_Ball" createVehicle [10,10000,0];
                  _splashBullet enableCollisionWith _cvictim;
                  _splashBullet setmass 50;
                  _splashBullet setpos (_cvictim modelToWorld [0,.1,.2]);
                  _splashBullet setvelocity [0,0,-1000];
               };
            };
        };
    };
}];

I hope you find this useful.

 

Johnnyboy out

  • Like 4
  • Thanks 1

Share this post


Link to post
Share on other sites

Thanks davidoss, I enjoyed making it.

 

The key to it was noticing that when player enters a vehicle in a positiion where a dead unit it is, the dead unit is bumped out to the ground with his weapon.  So this script creates an invisible unit, moves the invisible unit into dead guys's position, thus bumping out the dead guy.  Invisible unit is then deleted.

Share this post


Link to post
Share on other sites

Yeah i read that from your script. Very clever solution

  • Like 1

Share this post


Link to post
Share on other sites

Very cool JB.....awesome script, would love to see this as a mod. 

 

......I see it must be the time of year for bird migration....... ;)

  • Like 1

Share this post


Link to post
Share on other sites

 

......I see it must be the time of year for bird migration....... ;)

And the bonus points winner is.....Evil Organ! :party:

  • Like 1

Share this post


Link to post
Share on other sites

And the bonus points winner is.....Evil Organ! :party:

 

Can I cash in bonus points for a script to mod conversion......this should be a standard feature in A3.

Share this post


Link to post
Share on other sites

 

Can I cash in bonus points for a script to mod conversion......this should be a standard feature in A3.

Sorry bro, doing mods ain't my thing.  I spend too much time on this hobby already, so I'm only gonna do the things I like doing.

 

However, I give full permission to anybody to take any of my scripts and use them anyway they want, including putting into a mod.  A credit mention is all I ask.

  • Like 1

Share this post


Link to post
Share on other sites

However, I give full permission to anybody to take any of my scripts and use them anyway they want, including putting into a mod.  A credit mention is all I ask.

 

Awesome!  ;)

Share this post


Link to post
Share on other sites

Looks like you're using a JBOY_say3d function for the screams but that code isn't included in the script above.

Share this post


Link to post
Share on other sites

loving everything you put out so far. you set the bar really high. will be really hard to keep raising it lol.

 

seriously though. all of these are such cool little additions. inspiring stuff.

  • Like 1

Share this post


Link to post
Share on other sites

Hi Kylania.  Yeah, the JBOY_say3d function isn't there.  I haven't published those because they're not as clean as I would like.  It uses old PublicVariable method for saying sound files on multiple clients, and requires code in your init file.  As you probablly know, the new cleaner way (and alot less code) would be to use remoteExec.  But I don't know when I will get around to cleaning that up.

 

So folks can comment out my calls to JBOY_say3d for now, and add in their own say3D lines.

Share this post


Link to post
Share on other sites

concerning mod - couldn't you use ejectDeadGunner=1 param for that?

  • Like 1

Share this post


Link to post
Share on other sites

 

concerning mod - couldn't you use ejectDeadGunner=1 param for that?

Interesting option reyhard...I never heard  of this before.  So I googled it and see cfgVehicles has these in it:

ejectDeadGunner = false;
ejectDeadCargo = false;
ejectDeadDriver = false;
ejectDeadCommander = false;

So that is an excellent head start if someone wants to create a mod.  Thanks.  That would appear to remove the need for my script for a mod solution.

 

However, I think my scripted solution will look better, because the vanilla Arma eject effect teleports the guy immediately to the ground (or water) for offroads and zodiacs.  My script improved on this vanilla effect by:

  1. Setting position of dead guy closer to original vehicle position so he looks like he "falls" out (rather than teleporting to ground immediately).
  2. I spawned a bullet below falling body to give dust or splash effect for body impact.
  3. If falling from chopper, falling guy screams.

Share this post


Link to post
Share on other sites

Basically if you cant hold your self  on-board you are dead or unconscious. In that case you shouldn't be able to scream as well.

The fall in water or on the ground effect are very immerse and most welcome.

Share this post


Link to post
Share on other sites

Basically if you cant hold your self  on-board you are dead or unconscious. In that case you shouldn't be able to scream as well..

 

I like to suspend my disbelief for a while...... :D

Share this post


Link to post
Share on other sites

Sorry bro, doing mods ain't my thing.  I spend too much time on this hobby already, so I'm only gonna do the things I like doing.

 

However, I give full permission to anybody to take any of my scripts and use them anyway they want, including putting into a mod.  A credit mention is all I ask.

Here is the addon version, I haven't gone in and tested it so let me know if there are any issues.

 

Added a function for removing offroad doors, added respawn functionality for the standard function.

 

Removing offroad doors:

[my_offroad] call JBOY_ffv_fnc_hideOffroadDoors;

Add FFV function to a unit:

[my_unit] call JBOY_ffv_fnc_addFFV;

Download

  • Like 3

Share this post


Link to post
Share on other sites

 

Basically if you cant hold your self  on-board you are dead or unconscious. In that case you shouldn't be able to scream as well.

The fall in water or on the ground effect are very immerse and most welcome.

True.  As arma scripters we know the guy is technically dead, but for a player in a firefight, why can't his bullets wound the guy and sever his seat belt?  That's why its better to watch movies, than to know how they're made! :)

 

And anyone who uses this script any way they choose (with screams, no screams, screams only occur X% of the time).

Share this post


Link to post
Share on other sites

 

Here is the addon version, I haven't gone in and tested it so let me know if there are any issues.

Wow, Jshock, you the man!  That was amazingly fast.  I'll download it later and take it for a spin.  Thanks alot!

Share this post


Link to post
Share on other sites

Wow, Jshock, you the man!  That was amazingly fast.  I'll download it later and take it for a spin.  Thanks alot!

Yep, no problem, it's relatively simple, hardest thing to do is the reformat into the function library :p.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×