Jump to content

Recommended Posts

Leaking liquid [script] - v1.0
 
 
Description:
Idea was to help fellow coders. Created liquid stream with particles effect. It can be used for leaking water, oil, blood, etc ... Included example mission with guy pissing and leaking oil truck. Enjoy.
 
Installation:
- place unit / truck in editor
- in init of unit enter
 
null = this execVM "pee.sqf"; //unit

or

null = this execVM "leek.sqf"; //truck
Features:
- leaking liquid
- pissing
- leaking fuel from truck untill fuel is empty
 
Planned:
- catch fire if leak is from oil
- refactor to function
- create leak hole in cistern upon fire
- create leak hole in barrel upon fire (leaking water)
- give option to choose color of stream (yellow, blue, black, ...)
- multiplayer/dedicated server testing
 
Changelog:
v1.0
- public release
 
License:
Use it for public, non monetized purposes only. If you have modifications, use pull request in git repo. Will revise/include them in script.
 
Disclaimer:
Do not incorporate this script or portions of it in monetized products or servers without asking for permission and obtaining approval from me!
 
Issues:
- please use issue tracker
- need more testing
 
Download:
 
Preview:

 

  • Like 17

Share this post


Link to post
Share on other sites

This is awesome man.  Lots of different uses for this.  Thanks for posting it!

  • Like 1

Share this post


Link to post
Share on other sites

the leaking fuel truck would be cool if it came out where a bullet hit the back of the truck. Then you can light the fuel trail and boom!!

 

Nice job.

Share this post


Link to post
Share on other sites

the leaking fuel truck would be cool if it came out where a bullet hit the back of the truck. Then you can light the fuel trail and boom!!

 

Nice job.

 
Read "planned" section. ;)

Share this post


Link to post
Share on other sites

I love your planned features Mike.  There's probably a better way, but here's how I thought about approaching it.

 

To know exactly where a bullet strikes an object, you may need to coordinate two eventhandlers:

  • "Fired" - to track a bullet to point it disappears or deflects (the impact point)
  • "Hit" - On the the particular objects you want to leak.  If the Hit Projectile parameter matches the Fired Ammo parameter in the same time frame, then we likely have the winning pair:  Hit Object + Impact Point for leak.

Fired event handler added to player and maybe other shooters:

// TODO:  Replace hardcoded ammo type with generalized bullet ammotype lookup, as we're interested in fired bullets only.
this addEventHandler ["fired",{if (_this select 4 == "B_556x45_dual") then {[nearestObject [_this select 0]] execvm "getImpactPos.sqf";}}]; 

In Arma 2, I used the code below to calculate impact point, I don't know if it still works in Arma 3:

 

getImpactPos.sqf (I took this snipped from a procedure, but it should be converted to a function to return impact pos):

// getImpactPos.sqf
// ***************************************************************************************
// * We calculate a bullet collision point by trapping when bullet getpos no longer
// * returns a position.  Last good pos was the collision point.
// ***************************************************************************************
_bullet = _this select 0;
while {(!_done )} do
{
   _pos = getpos _bullet;
   if (_pos select 0 > 0) 
   then 
   {
        _hitPos = _pos;
    }
    else
   {
        _done = true;
   };
};   

Here's a ARMA 3 snippet I have for also calculating impact position.  I wrote this more than a year ago, so I don't remember why I used this instead of above technique I used in Arma 2, but it might be because above no longer works.  I know the technique below worked on detecting impact pos for buildings, vehicles, and men objects, and detecting ground impact (so it probably works for any object).

_prevPos = [];
_pos = getpos _bullet;
_dir = getdir _bullet;
while { ( (_pos select 2) > .1) and (abs(_dir - _dirTo) < 2 )  } do 
{
   _prevPos = _pos;
   sleep .05;
   _pos = getpos _bullet;
   // if ricochet, then dir to previous pos will differ from original dir alot.
   _dirTo = [_prevpos, _pos] call BIS_fnc_dirTo; 
 };   

Then there's other issues to deal with:

  • Leaks should be limited to only tank section of vehicle.  You can eliminate hitParts of wheel, engine, etc., but still wouldn't know if remaining part hit was the tank (I think).  Might need a hardcoded relative box per vehicle that comprises the tank.  But if handleDamage.SelectionName has a "Tank" selection name for fuel trucks, then that would be awesome!  No time to verify that right now.

Good luck.  Let me know if there is a better way to calculate impact point...I can use that for other projects.

  • Like 1

Share this post


Link to post
Share on other sites

Hello,

has someone found a way to solve the MP Compatibility problem ? (particles not showing up for other players)

Share this post


Link to post
Share on other sites

Hello,

has someone found a way to solve the MP Compatibility problem ? (particles not showing up for other players)

 

Change the SQFs into functions and use remoteExec I guess?

Share this post


Link to post
Share on other sites

Hey is there anyway to get the pee.sqf to work with a scroll wheel action? ill reward anyone that can help me help.gif

Share this post


Link to post
Share on other sites

Hey is there anyway to get the pee.sqf to work with a scroll wheel action? ill reward anyone that can help me help.gif

 

So you mean player use action and start to pee?

  • Like 1

Share this post


Link to post
Share on other sites

I'd like to know how to be able to break the animation when for example you shoot an enemy in the middle of having a piss.

 

I know it works with using "[this,"STAND"] call BIS_fnc_ambientAnimCombat;" instead of "......_ambientAnim". So it must be possible!

Share this post


Link to post
Share on other sites

:D  cool, now to add a puddle, and for the oil stream and puddle when you get to it, make it black like the oil.

Share this post


Link to post
Share on other sites

Puddles would be cool too. Also, how would it work if the particles were closer together so they just looks like a line?

Share this post


Link to post
Share on other sites

So you mean player use action and start to pee?

Yeah mate like a key binding [shift + P] etc but really want it as a scroll wheel to use action. Like if you can make me an example mission that would be amazing ;) Ill reward you for your time :) 

Share this post


Link to post
Share on other sites

Yeah mate like a key binding [shift + P] etc but really want it as a scroll wheel to use action. Like if you can make me an example mission that would be amazing ;) Ill reward you for your time :)

 

I can do that in next update

  • Like 2

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

×