Jump to content
johnnyboy

[Release] JBOY Fish Jump Script

Recommended Posts

Here's a fun script I created to add ambience to Mabunga Swamp in my new mission Property of Mabunga.

To use this script, create a trigger activated by anybody present, and put this code in On Activation to call the script:

dmy = ["Random", thistrigger,-1] execvm "Scripts\JBOY_FishJump.sqf";

In your mission folder, create a folder called Scripts.  Then inside the Scripts folder, create a script file named JBOY_FishJump.sqf, and put this code in it:

//////////////////////////////////////////////////////////
// JBOY_FishJump.sqf 
// By: johnnyboy
// dmy = ["Random", thistrigger, distance] execvm "Scripts\JBOY_FishJump.sqf";
//////////////////////////////////////////////////////////
if (isServer) then
{
	_fishType = _this select 0;  // Specific Type of Fish, or "Random" will select randomly from a list of fish
    _observer = _this select 1;  // Point where fish originates
    _distance = _this select 2;  // Distance from origination point to spawn fish, or -1 for Random
    
    _pos = getpos _observer;
    _pos = [_pos select 0, _pos select 1, -2];
    
    //_distance = -1;
    _fishTypes = ["Salema_F","Ornate_random_F","Mackerel_F","Tuna_F","Mullet_F","CatShark_F"];
    if (_distance == -1) then
    {
        _distance = 0 + random 3;
    };
    if (_fishType == "Random") then
    {
        _fishType = (_fishTypes call BIS_fnc_arrayShuffle) select 0;
    };
    _fish = createAgent [_fishType, _pos, [], 0, "NONE"];
    _fish playmove "";	
    _fish setpos (_fish modeltoworld [0,_distance,-.2]);
    _fish enableSimulation true;
    _vel = velocity _fish;
    _dir = random (360);
    _fish setdir _dir;
    //_speed = 4 + (random 3);
    _speed = 2.5 ;
    //_zVel  = 5 +random 3;
    _zVel  = 8;
    _heading = [getPosASL _fish,_fish modelToWorld [0,10,0]] call BIS_fnc_vectorFromXToY; 
    _velocity = [_heading, _speed] call BIS_fnc_vectorMultiply; 
    _velocity = [_velocity select 0, _velocity select 1, _zVel];
    _fish setVectorDir _heading; 
 
    // create an object to attach fish to and setVelocity on
    _bullet = "Land_CanOpener_F" createVehicle [10,10000,0];
    _bullet disableCollisionWith _fish;
    _bullet setMass 10;
    _bullet setVelocity [0,0,0];
    _bullet setdir direction _fish;
    _bullet setVectorDir _heading;

    _bullet setpos getpos _fish;
    sleep .1;
    // attach fish to moving object
    _fish attachTo [_bullet, [0,0,0]];
    _bullet setVelocity _velocity; 
    //  wait until fish is above water, then falls back below water
    waituntil {sleep .01; getpos _bullet select 2 > 0};
    waituntil {sleep .01; getpos _bullet select 2 <= 0};
    // create bullet at final position to guarantee a splash effect
    _bullet2 = "B_556x45_dual" createVehicle [10,10000,0];
    _bullet2 setpos (_bullet modelToWorld [.1,0,-.2]);
    _bullet2 setvelocity [0,0,-2];
    sleep 1;
    deletevehicle _bullet2;
    waituntil {sleep 1; getpos _bullet select 2 <= 0};
    detach _fish;	
    deleteVehicle _bullet;
    sleep 1;
    // fish created via createAgent aren't being deleted by deleteVehicle for some reason, so setposing them away
    _fish setpos [110,110,0];
    _fish enableSimulation false;
   deletevehicle _fish;
};

That's all there is to it!  Have fun, and try my mission Property of Mabunga to see this in action.

  • Like 13

Share this post


Link to post
Share on other sites

Thanks Bad Benson, it was fun to make.  If you like this, you're gonna love my "bird of prey" script...coming soon!

  • Like 4

Share this post


Link to post
Share on other sites

Thanks for the feeback ineptaphid and sarogahtyp!.

 

This fish script inspired another script:  Bird of Prey

 

Here is a scene from Animal Planet's nature show called "Swamp Hawks of Mabunga":

 

 

These Swamp Hawks live and hunt in Mabunga Swamp, so keep an eye out for them.  Especially if you are an ornithologist.

 

Script release coming soon...

  • Like 3

Share this post


Link to post
Share on other sites

Wow. I love sandbox arma and the creativity of its community...

Share this post


Link to post
Share on other sites

Can those hawks attack players?....... :pray:

Share this post


Link to post
Share on other sites

 

Can those hawks attack players?....... :pray:

Mabunga Swamp is a dangerous place bro.  It picked up a big-ass tuna, I know that much!  :D

 

If there is a pterodactyl mod out there, I can make it work no problem.

  • Like 2

Share this post


Link to post
Share on other sites

Any chance for addon version? Your script should be already in game, this makes island be more realistic and beautyful to explore.

Share this post


Link to post
Share on other sites

Any chance for addon version? Your script should be already in game, this makes island be more realistic and beautyful to explore.

Thanks Vasily.  I have so much in my to-do queue that I'm unwilling to pursue addons at this time.  But I give full permission for anyone to transform any of my scripts into an addon, or be used and modified in any way.  As long as I'm credited somewhere.

Share this post


Link to post
Share on other sites

I updated original post to correct the instructions (i.e., added you need to create a folder called Scripts), and also modified the script to make the jumps look a little better.

 

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

×