Jump to content
tpw

TPW MODS: enhanced realism and immersion for Arma 3 SP.

Recommended Posts

Hey tpw, can you please explain me how can i run your "tpw_fog_fnc_duststorm" function from a trigger? what exactly should i type on the activation and for the deactivation fields, and also if its possible how to set the wind to be a little bit more strong while its been triggered?

 

Thanks.

Share this post


Link to post
Share on other sites

Hey tpw, can you please explain me how can i run your "tpw_fog_fnc_duststorm" function from a trigger? what exactly should i type on the activation and for the deactivation fields, and also if its possible how to set the wind to be a little bit more strong while its been triggered?

 

Thanks.

Hi mate

 

I run my dust storm in a simple script when on desert maps:

 

while {true} do
{
if (tpw_fog_temp > 10 && {rain == 0} && {windstr > 0}) then
{
sleep (60 * (3 + random 10));
_timer = (5 + random 10);
_dust = [_timer ,0.3,0.3] spawn tpw_fog_fnc_duststorm;
sleep (60 * _timer);
tpw_fog_dustactive = 0;
sleep 60;
terminate _dust;
};
};

I guess if you wanted a dust storm of a random length from a trigger you could just put the following in its On Activation field:

_timer = (5 + random 10); // between 5 and 15 minutes
_dust = [_timer ,0.3,0.3] spawn tpw_fog_fnc_duststorm; // actually storm
setwindstr (0.2 + random 0.8); // random wind strength

Share this post


Link to post
Share on other sites

 

Hi mate

 

I run my dust storm in a simple script when on desert maps:

 

while {true} do
{
if (tpw_fog_temp > 10 && {rain == 0} && {windstr > 0}) then
{
sleep (60 * (3 + random 10));
_timer = (5 + random 10);
_dust = [_timer ,0.3,0.3] spawn tpw_fog_fnc_duststorm;
sleep (60 * _timer);
tpw_fog_dustactive = 0;
sleep 60;
terminate _dust;
};
};

I guess if you wanted a dust storm of a random length from a trigger you could just put the following in its On Activation field:

_timer = (5 + random 10); // between 5 and 15 minutes
_dust = [_timer ,0.3,0.3] spawn tpw_fog_fnc_duststorm; // actually storm
setwindstr (0.2 + random 0.8); // random wind strength

 

 

Thanks very much.

Share this post


Link to post
Share on other sites

TPW MODS 20160930: https://dl.dropboxusercontent.com/u/481663/TPW_MODS_20160930.zip

 

Changes:

  • [bLEEDOUT 1.28] Fixed bug where AI would self heal even if tpw_bleedout_selfheal was set to 0.
  • [HUD 1.59] Injured (damage > 0.25) squadmates will display red icons.
  • [sKIRMISH 1.33] Improved cleanup of dead units, and "orphaned" units from vehicles. Dynamic vehicle waypoints, recalculated every minute or so, to prevent vehicles loitering around an area.


I'm on holidays so have had a little more time to address a few bugs. The main feature of this release is the improvements to SKIRMISH cleanup code. Under certain circumstances it was possible to end up with large numbers of "orphaned" AI whose vehicles had been destroyed/removed. These are now more intelligently despawned to save you a few FPS - every little bit counts when there are combatant AI on a map. I've pushed SKIRMISH about as far as it can go (and many thanks to those who have contributed code and ideas) for the time being, I think it's time to turn my attention to ambient furniture. I have some preliminary code for this but basically it's going to be a complete bastard to implement!    

  • Like 3

Share this post


Link to post
Share on other sites

Hi guys. I just wanted to warn you that I've encountered an error message when running CUP Terrains Core and the TPW MODS: 'bin\config.bin/CfgModels.default' 

I've checked with several versions of TPW and even the latest (TPW MODS v20160930) but they all seem to disaply the same error message.

Any idea why and how to correct it?

Share this post


Link to post
Share on other sites

Error report:

 

The init.sqf in the mod has the wrong variables listed for the enemy and resistant CAS, CHS and Drone selection.

 

It should be as follows adding the word ENEMY and RESIST after TPW_SKIRMISH_ :

 

_skirmencasstring = getarray (configfile >> "TPW_MODS_Key_Setting" >> "tpw_skirmish_enemy_casstring");

_skirmenchsstring = getarray (configfile >> "TPW_MODS_Key_Setting" >> "tpw_skirmish_enemy_chsstring");
_skirmenuavstring = getarray (configfile >> "TPW_MODS_Key_Setting" >> "tpw_skirmish_enemy_uavstring");
_skirmrescasstring = getarray (configfile >> "TPW_MODS_Key_Setting" >> "tpw_skirmish_resist_casstring");
_skirmreschsstring = getarray (configfile >> "TPW_MODS_Key_Setting" >> "tpw_skirmish_resist_chsstring");
_skirmresuavstring = getarray (configfile >> "TPW_MODS_Key_Setting" >> "tpw_skirmish_resist_uavstring");

 

It currently uses the same variables for the FRIENDLY selection.

 

Bug or feature 2:

 

If you set FRIENDLY, ENEMY and RESIST to CUSTOM units (0), but do not actually add or name in any custom units into these strings:

 

tpw_skirmish_friendlyunitstring = ""; // Custom string to select friendly units from config
tpw_skirmish_friendlyvehiclestring = ""; // Custom string to select friendly vehicles from config
tpw_skirmish_enemyunitstring = ""; // Custom string to select enemy units from config
tpw_skirmish_enemyvehiclestring = ""; // Custom string to select enemy vehicles from config
tpw_skirmish_resistunitstring = ""; // Custom string to select resistance units from config
tpw_skirmish_resistvehiclestring = ""; // Custom string to select resistance vehicles from config
 
The mod would completely mix up all the team with units and civilians for all 3 teams. It was pretty funny to see basically a huge free for all with completely mixed units on all sides.
 
Eventually, the teams would form back with more of the "default" units as they are killed off or respawned. If I set the selection back any designated teams or add back the custom factions, then it would become normal again.
 
This did not happen 2 versions ago for example so not sure what changed in the skirmish code.

Share this post


Link to post
Share on other sites

Thanks for the bug reports guys, will look into them pronto. I use CUPS terrains all the time, have never encountered the error. Must have been a bollox up with the skirmish code, it was tip top 5 minutes before I packed the mod up.

 

EDIT: @Valken, thanks very much for finding these bugs, which have been tracked down and squashed with extreme prejudice. Update will be released shortly.

 

EDIT2: @domokun, still trying to track down CUP terrain issues, please bear with me.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for the bug reports guys, will look into them pronto. I use CUPS terrains all the time, have never encountered the error. Must have been a bollox up with the skirmish code, it was tip top 5 minutes before I packed the mod up.

 

EDIT: @Valken, thanks very much for finding these bugs, which have been tracked down and squashed with extreme prejudice. Update will be released shortly.

 

EDIT2: @domokun, still trying to track down CUP terrain issues, please bear with me.

I don't think that it's in the Skirmish code because I've disabled that. No worries, take all the time you need. BTW I really admire your FALL module. It's so satifying to see a target collapse and roll down a slope or fall downstairs. Its equally terrifying when they rise back up after a few moments. So much so that I'm wondering how to play MP without it.I had always imagine TPW MODS as SP only due to lack of support for Steam Workshop, configuration isn't available in-game (via manual editing of hpp in userconfig)

Share this post


Link to post
Share on other sites

TPW MODS 20161001: https://dl.dropboxusercontent.com/u/481663/TPW_MODS_20161001.zip

 

Changes:

  • [ALL] PBOs are now binarised, to prevent bin\config.bin/CfgModels.default errors with CUP Terrains. Thanks to Domokun for pointing this error out. 
  • [sKIRMISH 1.34] Fixed init and script errors which resulted in incorrect assignment of units under certain circumstances. Many thanks to Valken for picking these up.


Thanks for your patience.

  • Like 1

Share this post


Link to post
Share on other sites

Hi TPW,

 

Awesome. Will be testing in a couple of hours as I just returned home.

 

I have a feature REQUEST:

 

At night, I can still see the environmental leaves and butterflies. Love it during the day, but barely see it at night.

 

Can you change it so that at night, there is a chance for FIREFLIES? Basically small lit pixels that float and in out of the screen of the player. You can just light up and color a butterfly for example. Maybe 4 to 8 randomly per group. Spawn in, glow on, disappear as it flies off the screen. Can be primary colors like yellow, blue, red and green or pink or purple.

 

Example:

 

Photos-fireflies-17.jpg

 

The reason is that at night, the maps are still nearly completely dark and no visual ambiance except for towns and house lights. It would be amazing to walk in Tanoa and see random fireflies light up the forest.

 

I mainly want it for the Pandora map and Tanoa, but am sure it would be beautiful to look at in other maps. 

 

Can set it as a variable - on/off, how many fireflies, time for existence, and perhaps amount. 

Share this post


Link to post
Share on other sites

Hi TPW,

 

Awesome. Will be testing in a couple of hours as I just returned home.

 

I have a feature REQUEST:

 

At night, I can still see the environmental leaves and butterflies. Love it during the day, but barely see it at night.

 

Can you change it so that at night, there is a chance for FIREFLIES? Basically small lit pixels that float and in out of the screen of the player. You can just light up and color a butterfly for example. Maybe 4 to 8 randomly per group. Spawn in, glow on, disappear as it flies off the screen. Can be primary colors like yellow, blue, red and green or pink or purple.

 

Example:

 

Photos-fireflies-17.jpg

 

The reason is that at night, the maps are still nearly completely dark and no visual ambiance except for towns and house lights. It would be amazing to walk in Tanoa and see random fireflies light up the forest.

 

I mainly want it for the Pandora map and Tanoa, but am sure it would be beautiful to look at in other maps. 

 

Can set it as a variable - on/off, how many fireflies, time for existence, and perhaps amount. 

Interesting concept Valken. I'll see how I go attaching small lightpoints to ambient insects. I'm not sure how many insects are spawned at night, it might be that I have to manually animate the light points. Either way, I agree it would look cool at night.

  • Like 1

Share this post


Link to post
Share on other sites

tpw: I can confirm that your binarisation of PBOs seems to have fixed the bin\config.bin/CfgModels.default errors with CUP Terrain

thanks you so much for your diligence and reactivity.

Share this post


Link to post
Share on other sites

 

Can you change it so that at night, there is a chance for FIREFLIES?

 

 

Fricking brilliant !  :thumbsup:

Share this post


Link to post
Share on other sites

FIREFLY SCRIPT

 

For those who have expressed an interest in glowing fireflies, here's a script I've put together to test the concept out.

 

fireflies.jpg

 

 

/* TPW FIREFLIESAdds glowing/blinking lightpoints to ambient night insects in forested areas20161003*/ tpw_firefly_time = 5; // Seconds between scans for trees and firefliestpw_firefly_colour = [230,250,150]; // Firefly glow colour, default is green/yellowtpw_firefly_brightness = 0.35; // Brightness of flashtpw_firefly_blink = true; // Flashing enabled. // SPAWN BLINKING LIGHTPOINTtpw_firefly_fnc_light ={private ["_light","_pos","_sleep"];_pos = _this select 0; // Create lightpoint_light = "#lightpoint" createVehiclelocal _pos;   _light setLightColor tpw_firefly_colour ;  _light setLightIntensity tpw_firefly_brightness; _light setLightAttenuation [0,1,4,0,0.1,1];  _light setLightUseFlare true;_light setLightFlareSize 0.1; // Blinkingif (tpw_firefly_blink) then{[_light] spawn {private ["_light","_flash","_dark"]; _light = _this select 0;_flash = 0.2 + (random 0.1);_dark = 1 + (random 0.5);while {true} do{if (_light distance player < 50) then{_light setLightIntensity tpw_firefly_brightness;sleep _flash;_light setLightIntensity 0;sleep _dark;} else{_light setLightIntensity 0;sleep _dark;};}};}; _light}; // SCAN FOR BUGS TO ATTACH LIGHTS TO tpw_firefly_fnc_bugscan ={while {true} do{// Only bother if enough trees aroundif (count nearestTerrainObjects [player, ["tree","smalltree"], 50, false] > 25) then{tpw_firefly_bugarray = (player nearObjects 20) select {typeof _x in ["Mosquito","FireFly"]};tpw_firefly_bugcount = count tpw_firefly_bugarray - 1; tpw_firefly_pfeh = [tpw_firefly_fnc_movelight,0] call cba_fnc_addPerFrameHandler; // Add PFEH only if needed}; sleep tpw_firefly_time; // Remove PFEHif !(isnil "tpw_firefly_pfeh") then{[tpw_firefly_pfeh] call cba_fnc_removePerFrameHandler;};};};  // SMOOTHLY UPDATE LIGHTS ACCORDING TO BUG POSITIONS tpw_firefly_fnc_movelight = {private ["_ct","_bug","_light"];for "_ct" from 0 to tpw_firefly_bugcount do{_bug = tpw_firefly_bugarray select _ct;_light = tpw_firefly_lightarray select _ct;_light setposatl (visibleposition _bug);};}; // SET UP LIGHT POINT ARRAYtpw_firefly_lightarray = [];for "_i" from 0 to 20 do{tpw_firefly_lightarray pushback ([[0,0,0]] call tpw_firefly_fnc_light);sleep 0.01;};  // RUN IT 0 = [] spawn tpw_firefly_fnc_bugscan; 

 

This script basically scans for the presence of ambient fireflies and mosquitoes around the player, and smoothly displays a blinking lightpoint at the position of each insect. Lights will only spawn if you're near trees, so you shouldn't see fireflies inside or out in the open. You can adjust the colour, blinking, and brightness. Depending on the map's lighting config, fireflies will appear brighter or dimmer so may need to be adjusted.

 

In forested areas at night the effect is really something else. I've never seen fireflies in real life, but I looked at a few youtube clips and I think it's pretty close. Parasitising off the BIS ambient insect behaviours means I don't have to waste CPU doing it myself, so the whole system barely impacts FPS. 

 

Hopefully this script will be enough to get some of you started. I will be incorporating it into TPW ANIMALS in the next week.

  • Like 7

Share this post


Link to post
Share on other sites

@ TPW -  I just started testing the Fireflies script and its awesome... It just needs to up the firefly count a bit per swarm as they tend to dance with each other a lot. So there could 1, 2, 3 or up to a clump of them. Not sure if this would entail more cpu power but we can set a limit.

 

It looks something like this which is sometimes mistaken for a Will-O-Wisps:

 

Will-o-the-Wisp.jpg

 

We can tweak the colors a bit but it is very close already to real fireflies!

Share this post


Link to post
Share on other sites

Thanks for the feedback Valken. At present the number of glowing lights and their movement is dependent on the number/movement of the ambient fireflies and mosquitoes around the player. It maxes out around 10-12 insects. I can try to add more independent of this, but will have to investigate several options in increasing level of difficulty:

 

1 - Spawn  lights in little clumps to represent swarms. These won't actually dance around each other, but by randomly updating their positions they'll appear to.

 

2 - Spawn particle fx like a small low density tornado, and try to attach light points to each particle. Not sure I can do this.

 

3 -  Actually program my own glowing insect and FSM. I'm sure you're a nice guy, but I wouldn't (couldn't) even do that if my mother asked me to  :)

Share this post


Link to post
Share on other sites

@ TPW - I had an idea today... what if you tested the code to generate the flies around your streetlights and just lit those up? Those are technically swarms. Perhaps a random chance that N fireflies would group together then spawn the "swarm" for a few seconds, then break them back up again.

 

Or you can look at the code in JTD FLIES or Group Link 5 FX's Flies on dead body code for reference.

 

Just thinking out loud here.

  • Like 2

Share this post


Link to post
Share on other sites

FIREFLY SCRIPT v2

 

Here's a second iteration with a few optimisations and improvements. As per Valken's request, in addition to attaching lightpoints to existing ambient insects, randomly sized clusters of random moving lightpoints are spawned to simulate swarms of fireflies. I'm looking at some routines to smoothly animate the lightpoints using setvelocitytransformation to properly emulate swarming behaviour, but in the mean time this is pretty effective and does not hurt the CPU.

 

 
/* 
TPW FIREFLIES
Adds glowing/blinking lightpoints to ambient night insects in forested areas, and additional clusters of lightpoints to simulate swarms.
20161005
*/
 
// USER VARIABLES
tpw_firefly_active = 1; // Fireflies active. 0 = inactive
tpw_firefly_time = 5; // Seconds between scans for trees and fireflies
tpw_firefly_colour = [230,250,150]; // Firefly glow colour, default is green/yellow
tpw_firefly_brightness = 0.4; // Brightness of each firefly (0 - 1), default = 0.35
tpw_firefly_blink = 1; // Flashing enabled. 0 = no flashing
tpw_firefly_swarm = 50; // Maximum number of additional swarming fireflies. 0 = no swarms
 
// SPAWN LIGHTPOINT
tpw_firefly_fnc_light =
{
private ["_light","_pos","_sleep","_type"];
_pos = _this select 0;
_type = _this select 1; // 0 = unmoving, 1 = random movement around spawn position 
 
// Create lightpoint
_light = "#lightpoint" createVehiclelocal _pos;   
_light setLightColor tpw_firefly_colour;  
_light setLightIntensity tpw_firefly_brightness; 
_light setLightAttenuation [0,1,4,0,0.1,1];  
_light setLightUseFlare true;
_light setLightFlareSize 0.1;
 
// Spawn behaviour for each lightpoint
[_light,_pos,_type] spawn 
{
private ["_light","_pos","_type","_flash","_dark","_rndposarray","_rndpos"]; 
_light = _this select 0;
_pos = _this select 1;
_type = _this select 2;
_flash = 0.2 + (random 0.1);
_dark = 1 + (random 0.5);
 
// Array of random positions
if (_type == 1) then
{ 
_pos = [_pos,0.25] call cba_fnc_randpos;
_pos params ["_x","_y","_z"];
_pos = [_x,_y,(_z + 1 + random 0.25)];
_light setposatl _pos;
_rndposarray = [];
for "_i" from 0 to 19 do
{
_pos = [_pos,0.1] call cba_fnc_randpos;
_pos params ["_x","_y","_z"];
_rndposarray pushback [_x,_y,(_z - 0.1 + random 0.2)];
};
};
 
// Lightpoint loop
while {true} do
{
// Activate light 
if (tpw_firefly_active == 1 && {_light distance player < 50} && {rain < 0.2}) then
{
if (tpw_firefly_blink == 1) then
{
// Blink
_light setLightIntensity tpw_firefly_brightness - (random tpw_firefly_brightness / 2); 
sleep _flash;
_light setLightIntensity 0;
} else
{
// Steady
_light setLightIntensity tpw_firefly_brightness - (random tpw_firefly_brightness / 2); 
};
} else
{
_light setLightIntensity 0;
}; 
 
// Move to random position
if (_type == 1) then
{
_light setposatl (_rndposarray select (floor random 10));
};
 
sleep _dark; 
}
};
_light
};
 
 
// SCAN FOR BUGS / PLACES TO ATTACH LIGHTS TO 
tpw_firefly_fnc_bugscan =
{
while {true} do
{
// Only bother if enough trees around, not raining
if (tpw_firefly_active == 1 && {rain < 0.2} && {count nearestTerrainObjects [player, ["tree","smalltree"], 25, false] > 10}) then
{
// Array of nearby bugs
tpw_firefly_bugarray = (player nearObjects 20) select {typeof _x in ["Mosquito","FireFly"]};
tpw_firefly_bugcount = count tpw_firefly_bugarray - 1; 
tpw_firefly_pfeh = [tpw_firefly_fnc_movelight,0] call cba_fnc_addPerFrameHandler; // Add PFEH only if needed
 
// Swarm - not attached to bugs
if (tpw_firefly_swarm > 0 && {tpw_firefly_swarmpos distance player > 25}) then
{
tpw_firefly_swarmpos = [position player,10] call cba_fnc_randpos;
{deletevehicle _x} foreach tpw_firefly_swarmarray;
tpw_firefly_swarmarray = [];
for "_i" from 0 to (1 + random tpw_firefly_swarm) do
{
tpw_firefly_swarmarray pushback ([tpw_firefly_swarmpos,1] call tpw_firefly_fnc_light);
sleep 0.01;
};
};
}; 
 
sleep tpw_firefly_time;
 
// Remove PFEH
if !(isnil "tpw_firefly_pfeh") then
{
[tpw_firefly_pfeh] call cba_fnc_removePerFrameHandler;
};
};
}; 
 
// SMOOTHLY UPDATE LIGHTS ACCORDING TO BUG POSITIONS 
tpw_firefly_fnc_movelight = 
{
private ["_ct","_bug","_light"];
for "_ct" from 0 to tpw_firefly_bugcount do
{
_bug = tpw_firefly_bugarray select _ct;
_light = tpw_firefly_lightarray select _ct;
_light setposatl (visibleposition _bug);
};
};
 
// SET UP LIGHT POINT ARRAY FOR ATTACHMENT TO BUGS
tpw_firefly_lightarray = [];
for "_i" from 0 to 20 do
{
tpw_firefly_lightarray pushback ([[0,0,0],0] call tpw_firefly_fnc_light);
sleep 0.01;
}; 
 
// RUN IT 
tpw_firefly_swarmpos = [0,0,0]; // position of last firefly swarm
tpw_firefly_swarmarray = []; // array of lightpoints for swarm
0 = [] spawn tpw_firefly_fnc_bugscan;

 

  • Like 4

Share this post


Link to post
Share on other sites

hey its that guy that cant make his own mod but love to suggest to others.... :) if i may however, suggest :) .. i lived on a few acres as a kid... most of the yard was tall grass and small bushes...  i saw fire flys alot ,fireflys dont need trees ... just saying... fireflys should spawn anywhere there's vegetation... maybe use 

 

= selectbestplaces [[((getpos _trigger) select 0),((getpos _trigger) select 1),0], 300, "(forest) + (trees) + (hills) + (meadow) - (houses) - (2*rain) - (3*windy) - (4*night) - (10*sea)",10,2];

 

two more things... tpw if you didnt see this, recently in the BIs code optimization page they posted that declairing Private variables in a group is slower then declairing them seperate... so something you may want to look at. ill post the section below

 

private ["_var"] vs private _var

 

private ["_a", "_b", "_c", "_d"]; _a = 1; _b = 2; _c = 3; _d = 4; // 0.0040 ms

is slower than the new "private _var = value" syntax (Arma 3 v1.53+):

private _a = 1; private _b = 2; private _c = 3; private _d = 4; // 0.0023 ms

 

and lastly. maybe if you have the time See if a DEV can tell you where to look to find how the game spawns the default bugs and just spam them in one spot and boom a Much more natural looking swarm... 

  • Like 2

Share this post


Link to post
Share on other sites

hey its that guy that cant make his own mod but love to suggest to others.... :) if i may however, suggest :) .. i lived on a few acres as a kid... most of the yard was tall grass and small bushes...  i saw fire flys alot ,fireflys dont need trees ... just saying... fireflys should spawn anywhere there's vegetation... maybe use 

 

= selectbestplaces [[((getpos _trigger) select 0),((getpos _trigger) select 1),0], 300, "(forest) + (trees) + (hills) + (meadow) - (houses) - (2*rain) - (3*windy) - (4*night) - (10*sea)",10,2];

 

two more things... tpw if you didnt see this, recently in the BIs code optimization page they posted that declairing Private variables in a group is slower then declairing them seperate... so something you may want to look at. ill post the section below

 

private ["_var"] vs private _var

 

private ["_a", "_b", "_c", "_d"]; _a = 1; _b = 2; _c = 3; _d = 4; // 0.0040 ms

is slower than the new "private _var = value" syntax (Arma 3 v1.53+):

private _a = 1; private _b = 2; private _c = 3; private _d = 4; // 0.0023 ms

 

and lastly. maybe if you have the time See if a DEV can tell you where to look to find how the game spawns the default bugs and just spam them in one spot and boom a Much more natural looking swarm... 

Thanks very much for all that LP, you're a legend. I like to learn something new every day, in the case of your post I learnt 4! Your name will be up in lights (get it? lights?!??) when I finally release this totally game changing firefly mod.

 

Thanks again mate, I really appreciate it.

 

TPW

 

PS I've solved all my problems and written a little script to record the movements of some mosquitos into an array, which I can then use to set the position of lightpoints. 

  • 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

×