johnnyboy 3797 Posted May 15, 2017 I need to script underwater bubbles, and underwater blood. For a marine salvage mission, I want player to attach simulated inflatable objects to a sunken wreck, and inflate them to raise the wreck. This inflation should generate a lot of bubble effects. I also want to create blood underwater on demand. This would be the same blood you see when you shoot a unit under water. Any help is appreciated! Share this post Link to post Share on other sites
HallyG 239 Posted May 16, 2017 I've been using these for some own stuff of mine. Here you go: TAG_fnc_BUBBLES Spoiler /* Function: TAG_fnc_BUBBLES Author: BIS Bubble module, HallyG SPAWNS BLOOMIN BUBBBBBBBBBBLES Arguments(s): 0: Emitter Position <OBJECT, POSITION> 1: Bubble size (default: 1) <NUMBER> 2: Bubble drop interval (rate at which particles are emitted, smaller = MORE BUBBLES) (default: 1) <NUMBER> 2: Bubble velocity (from source) [X speed, Y speed, Z speed] (default: [0,0,1]) <ARRAY> 3: Bubble lifetime (default: 5) <NUMBER> Return Value: Emitter <OBJECT> Example: [ getPos player, 1, 0.01, [0,0,-1], 10 ] call TAG_fnc_BUBBLES; __________________________________________________________________*/ params [ ["_position", [0,0,0], [[]]], ["_size", 1, [0]], ["_dropInterval", 0.1, [0]], ["_speed", [0, 0, 1], [[]], [3]], ["_lifeTime", 5, [0]] ]; _speed params ["_speedX", "_speedY", "_speedZ"]; _position = _position call { if (_this isEqualType objNull) exitWith {getPosATL _this}; _this }; if ((_position select 2 > -0.01) && (surfaceIsWater _position)) then { _position = _position vectorAdd [0,0,-0.1]; }; _source = "#particlesource" createVehicleLocal _position; _source setParticleParams [ ["\A3\data_f\ParticleEffects\Universal\Universal",16,13,7,0], "", "Billboard", 1, 50, [0, 0, 0], [_speedX, _speedY, _speedZ], 0, 1, 1, 15, [0.05 * _size], [[1,1,1,-2]], [1000], 0.12, 0.045, "", "", "" ]; // CHANGE THESE TO IMPROVE YOUR BUBBLES // Sets randomization of particle source parameters _source setParticleRandom [ 20, // lifeTimeVar [0,0,0], // positionVar [2,2,0], // moveVelocityVar --> BIS module default ([0.02,0.02,0]) 0, // rotationVelocityVar (0.005 * _size), // sizeVar [0,0,0,1], // colorVar 0.003, // randomDirectionPeriodVar --> BIS module default (0) 0 // randomDirectionIntensityVar --> BIS module default (0) ]; _source setDropInterval _dropInterval; _source TAG_fnc_BLOOD Spoiler /* Function: TAG_fnc_BLOOD Author: BIS, HallyG SPAWNS BLOODY BLOOD Arguments(s): 0: Emitter Position <OBJECT, POSITION> 1: Damage, 0 -1. Large numbers produce lots of particles (default: 0.2) <NUMBER> 2: Bullet speed (default: 10) <NUMBER> 2: Surface Normal (default: [0,0,0]) <ARRAY> 3: Bullet Direction (default: [0,0,5]) <ARRAY> Return Value: Emitter <OBJECT> Example: [ player, 0.1, 10, [0,0,0], [0,0,10] ] call TAG_fnc_BLOOD __________________________________________________________________*/ params [ ["_position", [0,0,0], [[], objNull]], ["_damage", 0.2, [0]], ["_bulletSpeed", 10, [0]], ["_surfaceNormal", [0,0,0], [[]], [3]], ["_bulletDirection", [0,0,5], [[]], [3]] ]; _bulletDirection params ["_bulletDirectionX", "_bulletDirectionY", "_bulletDirectionZ"]; _surfaceNormal params ["_surfaceNormalX", "_surfaceNormalY", "_surfaceNormalZ"]; _position = _position call { if (_this isEqualType objNull) exitWith {getPosATL _this}; _this }; _damage = (_damage min 1) max 0; _source = "#particlesource" createVehicleLocal _position; _source setPosATL _position; _source setParticleParams [ [ "\A3\data_f\ParticleEffects\Universal\Universal", 16, 13, 1, 0 ], "", "Billboard", 1, 3, [0,0,0], [ (- (_bulletDirectionX * 2 - _surfaceNormalX / 4) * _bulletSpeed / 200) * (_damage + 0.2), (- (_bulletDirectionY * 2 - _surfaceNormalY / 4) * _bulletSpeed / 200) * (_damage + 0.2), (- (_bulletDirectionZ * 2 - _surfaceNormalZ / 4) * _bulletSpeed / 200) * (_damage + 0.2) ], 1, 1.275, 1, 10, [0.02 + (0.06 * _damage),0.17 + (0.51 * _damage),0.23 + (0.69 * _damage), 0.27 + (0.8 * _damage),0.31 + (0.93 * _damage),0.34 + (1.01 * _damage)], [[1,0.8,0.8,0.5],[1,0.8,0.8,0.4],[1,0.8,0.8,0.3],[1,0.8,0.8,0.22],[1,0.8,0.8,0.16],[1,0.8,0.8,0.08],[1,0.8,0.8,0.01]], [0.1], 0, 0, "", "", "", 0 ]; _source setParticleRandom [ 4, [0.01, 0.01, 0.01], [0.5 * _damage, 0.5 * _damage, 0.5 * _damage], 1, 0.02, [0,0,0,0.2], 0, 0, 360 ]; _source setDropInterval (0.09 * (1.1 - _damage)); _source TAG_fnc_BLOOD uses an ATL position. So if you use: (getPosATL player) vectorAdd [0,0, HEIGHT ABOVE SEA FLOOR] As the first argument it should be fine 3 Share this post Link to post Share on other sites
johnnyboy 3797 Posted May 16, 2017 Wow, perfect. Thanks much for the bloomin' bubbles and bloody blood! I owe you a couple pints mate. Maybe you could educate me a bit on this...When I read the two scripts, I don't see a parameter saying "bubbles" or "blood". How does Universal translate into these entirely different looking particles? How did you find these...experimentation? 1 Share this post Link to post Share on other sites
EO 11277 Posted May 16, 2017 Butterflies!....underwater bubbles!....underwater blood!.....wtf are you up to dude! 2 Share this post Link to post Share on other sites
johnnyboy 3797 Posted May 16, 2017 Just now, Evil Organ said: Butterflies!....underwater bubbles!....underwater blood!.....wtf are you up to dude! Connect the dots my friend... All will be revealed in good time! 3 Share this post Link to post Share on other sites
HallyG 239 Posted May 16, 2017 cfgCloudlets in the config viewer. It displays the particle parameters for most of the particles used in the game. Some of the parameters can have a formula (similar to the one in TAG_fnc_BLOOD) which alter some of the parameters passed upon the arguments provided. Added to that it involves some experiment in the editor by changing their random velocities, rotation and stuff. I think it creates a generic particle and just changes its colour (including transparency), velocity and more. So for example a 'blood' particle is darker, more opaque and heavier than a 'bubble' particle. I'd post links to the wiki pages but I'm not at my computer right now. Haha, I can't say but it's fairly out there (I feel like constant studying for my finals has added to its absurdity..) 3 Share this post Link to post Share on other sites
Midnighters 152 Posted May 16, 2017 4 hours ago, johnnyboy said: Connect the dots my friend... All will be revealed in good time! Is this what the whole exploding butterflies were all about the other day? *shakes head* , how in gods name is this going to make sense. Share this post Link to post Share on other sites
C.Ritter 16 Posted October 25, 2021 On 5/16/2017 at 4:07 AM, HallyG said: TAG_fnc_BLOOD Reveal hidden contents /* Function: TAG_fnc_BLOOD Author: BIS, HallyG SPAWNS BLOODY BLOOD Arguments(s): 0: Emitter Position <OBJECT, POSITION> 1: Damage, 0 -1. Large numbers produce lots of particles (default: 0.2) <NUMBER> 2: Bullet speed (default: 10) <NUMBER> 2: Surface Normal (default: [0,0,0]) <ARRAY> 3: Bullet Direction (default: [0,0,5]) <ARRAY> Return Value: Emitter <OBJECT> Example: [ player, 0.1, 10, [0,0,0], [0,0,10] ] call TAG_fnc_BLOOD __________________________________________________________________*/ params [ ["_position", [0,0,0], [[], objNull]], ["_damage", 0.2, [0]], ["_bulletSpeed", 10, [0]], ["_surfaceNormal", [0,0,0], [[]], [3]], ["_bulletDirection", [0,0,5], [[]], [3]] ]; _bulletDirection params ["_bulletDirectionX", "_bulletDirectionY", "_bulletDirectionZ"]; _surfaceNormal params ["_surfaceNormalX", "_surfaceNormalY", "_surfaceNormalZ"]; _position = _position call { if (_this isEqualType objNull) exitWith {getPosATL _this}; _this }; _damage = (_damage min 1) max 0; _source = "#particlesource" createVehicleLocal _position; _source setPosATL _position; _source setParticleParams [ [ "\A3\data_f\ParticleEffects\Universal\Universal", 16, 13, 1, 0 ], "", "Billboard", 1, 3, [0,0,0], [ (- (_bulletDirectionX * 2 - _surfaceNormalX / 4) * _bulletSpeed / 200) * (_damage + 0.2), (- (_bulletDirectionY * 2 - _surfaceNormalY / 4) * _bulletSpeed / 200) * (_damage + 0.2), (- (_bulletDirectionZ * 2 - _surfaceNormalZ / 4) * _bulletSpeed / 200) * (_damage + 0.2) ], 1, 1.275, 1, 10, [0.02 + (0.06 * _damage),0.17 + (0.51 * _damage),0.23 + (0.69 * _damage), 0.27 + (0.8 * _damage),0.31 + (0.93 * _damage),0.34 + (1.01 * _damage)], [[1,0.8,0.8,0.5],[1,0.8,0.8,0.4],[1,0.8,0.8,0.3],[1,0.8,0.8,0.22],[1,0.8,0.8,0.16],[1,0.8,0.8,0.08],[1,0.8,0.8,0.01]], [0.1], 0, 0, "", "", "", 0 ]; _source setParticleRandom [ 4, [0.01, 0.01, 0.01], [0.5 * _damage, 0.5 * _damage, 0.5 * _damage], 1, 0.02, [0,0,0,0.2], 0, 0, 360 ]; _source setDropInterval (0.09 * (1.1 - _damage)); _source TAG_fnc_BLOOD uses an ATL position. So if you use: (getPosATL player) vectorAdd [0,0, HEIGHT ABOVE SEA FLOOR] As the first argument it should be fine Hey, i am fairly new to scripting, where would I put these sections in? init.sqf ? And "(getPosATL player) vectorAdd [0,0, HEIGHT ABOVE SEA FLOOR]" on the player? (Assuming this still works after 4 years) Share this post Link to post Share on other sites