Jump to content
m0nkey

MKY Sandstorm script

Recommended Posts

Do you plan to put settings in module and release it as mod?

  • Like 1

Share this post


Link to post
Share on other sites

It is a set of scripts that cause the client to create a "local vehicle" that emits particles that look like sand. The only thing that is used in an MP capacity is that the server (which can be the host) will produce and broadcast an array that tells the client(s) which direction the wind is coming from. So, it is fully capable of being used in SP or MP.

 

Not being an extensive mission designer (heck, I'm still cutting my teeth on arma) I suppose that the script version is what you would want from a servers perspective so that all clients are "forced" to have the sand effect (even if you can change it by video settings ?!? ).

 

Regarding the addon/module aspect, I would love to. I have looked more than once at creating an addon for SP, but every article/example makes it seem daunting. I know its not, it never is really, but I just get tired of spending needless energy trying to figure something out that is complicated but should not be... I must be getting old haha.

 

I would like to make this an addon though, because at some point I have to learn how regardless, and I am getting excited about how I can improve my snowstorm effect. And (I know this will be hard to believe) but I am thinking about an enhanced rain effect as well. Maybe not hurricane type stuff, but we have all seen a downpour and how it looks, and arma rain is nothing like that at all. IMO at least.

  • Like 2

Share this post


Link to post
Share on other sites

yeah thanks for the comprehensive answer m0nkey, I only use SP, so this as awesome as it looks, won't work for me by the sounds of it ?

Share this post


Link to post
Share on other sites

I am not sure. I suppose you could DePBO the mission and add it in. It works in SP, thats where I developed it, I just don't know how to do it as an addon yet.

  • Like 1

Share this post


Link to post
Share on other sites

As a mission maker, i like the addon/module aspect for personal preference, but for releasing missions.  Scripts work better since it doesn't make the addon required which is yet another download/addon you need to run to play it.  If you do go down this road, please just keep this in mind, and if possible i would love both versions  ;)

  • Like 2

Share this post


Link to post
Share on other sites

Great work m0nkey, can't wait to apply this to a mission I have planned but I have a query if you don't mind.

 

Is it possable to 'terminate' the storm mid-mission? I'd like to have the 'light' version running until a certain point in the mission, at which point it would switch to the 'heavy' version.

 

Keep up the good work.

 

Regards Hawk.

Share this post


Link to post
Share on other sites

As a mission maker, i like the addon/module aspect for personal preference, but for releasing missions.  Scripts work better since it doesn't make the addon required which is yet another download/addon you need to run to play it.  If you do go down this road, please just keep this in mind, and if possible i would love both versions  ;)

It is one thing I need to learn how to do, that addon thing that is. Whether it works into a module is another story. I know less about module creation than I do addon creation. Ideally it would be nice to sport all 3 ways: a script, a module that essentially emulates a script (with a dependency) and in this case a client side addon.

 

Great work m0nkey, can't wait to apply this to a mission I have planned but I have a query if you don't mind.

 

Is it possable to 'terminate' the storm mid-mission? I'd like to have the 'light' version running until a certain point in the mission, at which point it would switch to the 'heavy' version.

 

Keep up the good work.

 

Regards Hawk.

Termination is crude at this point. Right now the global variable varEnableSand is a boolean that is set to true by the server script (host). In my mission example, you can see that once the server script is executed, the client will "waitUntil" that variable is true/present. So, that boolean is what triggers the client script to actually begin in my example.

 

You can see in the client script that variable is used in multiple while loops. Some spawned threads also use it within while loops. If you set that variable to false (locally or server pushing it out to clients) then after each while loop finishes its respective cycle, it will terminate the effect. It will actually destroy it all. 

 

Its a bit sketchy really at this point. I have not finished what I want to do with the snow or sand scripts yet. They will both change, and the delivery/control method will change. What you want to happen will become part of the end result that I have in mind. 

 

I built this and everything I do with one end goal.. to allow me to play the game with enough randomness that I don't really know what will happen. This effect helps that end, as it changes things enough that I really don't know what I will see or how easy it will be to finish/kill the objective. And while a mission maker might want a heavier effect, I feel like any effect level should vary, realistically. I probably did not answer your question so much as rambled on about nothing ;)

Share this post


Link to post
Share on other sites

Yeah, I did not really answer the question, so try this

 

This is a portion from the client script

// use effect strength
if ((count _this) > 7) then {
 if (typeName (_this select 7) == "SCALAR") then {
  switch (_this select 7) do {
   case 0: {intEFX = 0;_arSands = [-0.02,-0.01,0,0.01,0.02,5];};
   case 1: {intEFX = -0.02;_arSands = [-0.01,5];_arColors resize 3;_arSandsVolume deleteAt 2};
   case 2: {intEFX = 0;_arSands = [-0.01,0,0.01,5];_arColors deleteAt 5;_arColors deleteAt 0;_arSandsVolume deleteAt 2};
   case 3: {intEFX = 0.01;_arSands = [0,0.01,0.02,5];_arColors deleteAt 5;_arColors deleteAt 4;};
   case 4: {intEFX = 4;};
   default {intEFX = -0.02;_arSands = [-0.01,5];_arColors resize 4;_arSandsVolume deleteAt 2};
  };
 };
};
if (intEFX == 4) exitWith {(true);};
// intEFX = 0; // TEMP FOR TESTING ***

So, here I use a parameter of 0 to 4 to dictate the level. The local variables are set/modified in the switch statement. The _arSands array holds the dropInterval deviations for the emitters. They would normally range from -.02 to .02. The function MKY_fnc_setDI basically uses one of these values to modify the dropInterval of each emitter. It is how it varies the effect, by both a slight change to the dropInterval and, as you can see, a change to the colors used. 

 

As a note _arSandsVolume are the different volume parameters I use to apply to each emitter. Its the volume/mass/weight ratio that determines if a particle sinks or floats. Probably best to leave that one alone unless you want to test to see. Even a slight change greatly affects things.

 

So, what could be done is to just stop the emitters by setting _arSands to [5]. The value 5 is so small that it never really emits anything. It is how I create pauses in the EFX, rather than deleting them or something. Anyway, that value just changes the dropInterval in a loop, so you could modify that as needed. 

 

You could mess with the values in MKY_fnc_setDI to modify things if you really wanted to. You could also just set the dropInterval manually or in a script for each emitter. There are 4 of them, objSand(N/S/E/W). 

 

Oh man, I am sorry, theres so many ways you could go about it. I am so used to looking at a given piece of code and following it and understanding it that I really don't know how to easily put on paper what floats around in my melon..

 

I will make it do what you want relatively soon. How's that haha!

 

EDIT: About half done with a significant change to how this is all implemented. It makes implementation much simpler. Might be able to give more control of start/stop and changing of EFX by tonight. Version 002 coming pretty quick :)

  • Like 1

Share this post


Link to post
Share on other sites

Hey don't worry m0nkey, I don't want to make extra work for you, or rush you into doing anything. I appreciate your answers above though and will look into it.

Thanks again.

 

Regards Hawk.

Share this post


Link to post
Share on other sites

Too late :)

 

Really though I was modifying (yet again) the excellent All Out Warfare mission by Cruoriss, and its something I was planning on doing anyway, so its mostly done now. Some tests tonight will see how well I did. Its much easier to implement it now, which is good anyway. I exposed the variables by making them global, so either the client can change them locally or a server could push them out. It would be up to the mission maker to decide how thats done of course.

  • Like 1

Share this post


Link to post
Share on other sites

Here is a good start on the effect that is now going to offer some easier methods for scripters to vary the effect. You might not be able to tell here, but I am varying it more than before. I need a little more testing and then will supply a new version with updated sample mission that shows/explains what is changing.

 

For your viewing pleasure, some of my forthcoming All Out Warfare by Cruoriss modifications. Well, lots of modifications actually...

 

  • Like 4

Share this post


Link to post
Share on other sites

Hey monkey, played around with your sand script and had a blast. It's gorgeous man, thank you. I'm having trouble getting the snow to work though. I took this code from the mission example and just replaced the sand directories with the snow directories. However, this doesn't seem to work for me. Can you confirm how the snow is enabled? Did I miss something?
 

Share this post


Link to post
Share on other sites

Yeah, that won't work. The sand is different... way different really. And easier. Sort of. Haha, none of it is I guess.

 

Anyway, if you want the snow to work, you would have to get my snow script sample mission, and check out how to start it. The files are the same I do believe, so its just a difference in how you execute the script or the parameters you pass to it. (that snow effect will get overhauled after a couple more small projects are out of the way)

 

Or if you hang tight till the weekend I should be done integrating about 1000 different "men" into All Out Warfare and can finish my rewrite of the sand and snow. The rewrite is about 80% done I guess, not much left to finish it. It works already, I just have to test a couple more exposed variables to make sure it works like I planned it when I coded it... should this weekend sometime.

Share this post


Link to post
Share on other sites

Would it be possible to add a feature to, call and adjust the script on the fly?

 

Currently i have commented out the script call in the init.sqf, then using the admin console i can set the sandstorm going mid-mission. What would be very helpful, is if we could adjust the script once its running, so for example you can build up the sandstorm to level 3, then back down again.

 

Not sure if thats within the scope of what you want to do with this, but as alot mission making for coop group events is heading the way of using zeus and on the fly mission making, it would allow alot more flexibility.

 

Brilliant work on this though, really does add a nice dynamic to missions.  Bravo sir....

Share this post


Link to post
Share on other sites

Yeah, it does that already, just use 0 for the final parameter, or omit it. That makes the effect random. You could modify the script for timing as well. Right now the times are based on what I observed when testing it over and over and over, but that does not mean you are locked into that value. I will add more comments than I already have as well so scripters can more easily tear it apart :)

 

The rework I am doing does expose global variables for more control. None of this has ever reached my "final" state. Its just a way to get others feedback so that new and better ideas than my own can be brought to light. Not everything will be pertinent of course, but I love to build better mousetraps ;)

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for the quick reply!

 

And good luck with your tests dude, nothing ever works correctly the first time with arma lol

Share this post


Link to post
Share on other sites

Version 002 of the script now available. Exposed variables so scripters can change most of the effect as they want. It is complicated, and will require you to test it over and over to get the effect "just right", but its only 4 variables I think, and really only one is needed.

 

I finally got the steam workshop thing to work, so its published here

 

http://steamcommunity.com/sharedfiles/filedetails/?id=603092945

 

and I put it here as well if you just want the zip version

https://app.box.com/s/vs48hz6mkmw4vtiiwuq5mll0oee7fy2a

 

Its a simple mission that has a few triggers so you can see how you might go about tweaking things. If you look at the structure of the code you will see the changes. Its not hard. Just look at the init.sqf to see how I called it. And then look at the MKY_Sand_Client.sqf file for all the details. There are two comment blockes in there. The first is the standard input parameters, and the second is a fairly detailed wall of text about the variables I exposed. It sounds harder than it is :)

 

Here is a quick video of the sample mission (at 4x speed)

 

  • Like 1

Share this post


Link to post
Share on other sites

Hi !

Is this line's not needed anymore in the init.sqf ?

// define which worlds may use sand EFX
// *** Altis added for testing, its not always a great sand/dust map ***
varSandWorlds = ["mountains_acr","shapur_baf","takistan","zargabad","bmfayshkhabur","clafghan","fata","mcn_aliabad","mske","smd_sahrani_a3","pja306","TUP_Qom","queshkibrul","Razani","altis"];
 

EDIT : Ok, this is in the MKY_fnc_getInfoWorld.sqf, sorry !

Share this post


Link to post
Share on other sites

I was trying to make it more simplistic to implement. Mission makers will of course need to modify different aspects, like which worlds they want different effect on, or maybe they don't want to use that aspect.

Share this post


Link to post
Share on other sites

Yeah, cause, More params there is, More morons we are. :rolleyes:
I think it could be cool one day to make a clear Documentation file, that fully explain all of this, and give some tweak's intel, as in the first comment section of the "MKY_Sand_Client", where a lot of people probably never think to go searching :D

I can't have this V2 working... Description.ext seems ok. Folders in place.
Am i doing somethings wrong in the init ?
( i have other script running beside, maybe conflict, i will edit the entire init if you think this part is okay...)

EDIT : SOLVED. The problem was coming from manually adding Altis in the varSandWorlds Array, in the MKY_fnc_getInfoWorld file. I wrote " Altis " but needed "altis". No majuscule or the script can't be run on the manually added map.

----------------------------------------------------------------------------------------------------------
// Disable save/load that breaks scripts
enableSaving [false, false];


if (someVariable != 4) then {
    // define the global sand and snow parameter arrays
    MKY_arSandEFX = [0,"",true,false,true,true,true,1];
    MKY_arSnowEFX = [[0.23,0.047,15],0.8,true];
    // init the EFX scripts
    nul = [] execVM "MKY\MKY_Sand_Snow_Init.sqf";
};


if (isNil "arInfoWorld_MKY") then {
    nul = [] execVM "MKY\fnc\MKY_fnc_getInfoWorld.sqf";
    waitUntil {sleep 0.1; !(isNil "arInfoWorld_MKY")};
};


if (!isServer && isNull player) then {
    waitUntil {sleep 1;!(isNull player)};
    JIP_varSnowData = [player];
    publicVariableServer "JIP_varSnowData";
    JIP_varSandData = [player];
    publicVariableServer "JIP_varSandData";
};

if (isServer) then {
    if ((arInfoWorld_MKY select 0) == "sand") exitWith {nul = [] execVM "MKY\sand\MKY_Sand_Server.sqf";};
};

if (hasInterface) then {
    0 = [] spawn {
        if ((arInfoWorld_MKY select 0) == "sand") exitWith {
            waitUntil {sleep 5;!(isNil "varEnableSand")};
            if (isNil "MKY_arSandEFX") exitWith {true;};
            0 = MKY_arSandEFX execVM "MKY\sand\MKY_Sand_Client.sqf";
        };
    };
};

----------------------------------------------------------------------------------------------------------

Share this post


Link to post
Share on other sites

For some more clarity, a new init.sqf for the sample mission. This will be included in the next version, with more documentation.


// test MKY sand EFX v002

// examples

/*
	1 - create global array
	MKY_arSandEFX = [];

	2 - initialize the script
	nul = [] execVM "MKY\MKY_Sand_Snow_Init.sqf";

	RESULT - effect runs with default parameters (random strength)
*/

/*
	1. create global array and populate with some options
	MKY_arSandEFX = [0,"",true,false,true,true,true,1];

	2 - initialize the script
	nul = [] execVM "MKY\MKY_Sand_Snow_Init.sqf";

	RESULT - effect runs with user defined parameters
*/

/*
	1 - create a mechanism that, through code, sets array parameters
	2 - initialize the script

	This example will use a parameter array with 5 values.
	Values will be 0/1/2/3/4.
	Their meaning will be "random/light/medium/heavy/disabled".

	This if statement will first determine if the params array is equal to 4.
	To do this it must first know which index of the params array has the value to examine.
	In this simple example, there is only one option in the parameter array, so its index is 0.

	If the value of index 0 is equal to 4, that means "disabled" so there is nothing to do.
	We do not call the sand script into action and nothing happens. Life goes on as normal.

	if ((paramsArray select 0) != 4) then {
		// use the script
	};

	If the value is not 4, we must determine which value it is and pass the proper data to the script.

	It could be as simple as passing 0/1/2/3 to the script, which will work. Like this:

	if ((paramsArray select 0) != 4) then {
		MKY_arSandEFX = [0,"",true,false,true,true,true,(paramsArray select 0)];
		nul = [] execVM "MKY\MKY_Sand_Snow_Init.sqf";
	};

	Or, if the mission maker wants something else, it might look like this:
	if ((paramsArray select 0) != 4) then {
		MKY_arSandEFX = []; // set as default
		switch (paramsArray select 0) do {
			case 0: {MKY_arSandEFX = [0,.8,true,true];};
			case 1: {MKY_arSandEFX = [0,"",true,false,true,true,true,1];};
			case 2: {MKY_arSandEFX = [0,.3,true,false,true,true,false,2];};
			case 3: {MKY_arSandEFX = [[0.23,0.021,100],"",true,false,true,true,true,3];};
		};
		nul = [] execVM "MKY\MKY_Sand_Snow_Init.sqf";
	};

	In the final example, you can see that depending on what the params array value was, options can be set as needed
	to achieve whatever effect you want, within the confines of what the options allow of course.
*/

// this simple example will work in single player and will create a "light" effect.
// if the mission is loaded as multiplayer coop, the option would be available at mission start.
// whatever value was chosen would be used.

if ((paramsArray select 0) != 4) then {
	// define the global sand parameter array
	//[fog,overcast,use ppEfx,allow rain,force wind,vary fog,use wind audio,EFX strength]
	MKY_arSandEFX = [0,"",true,false,true,true,true,(paramsArray select 0)];
	// init the EFX scripts
	nul = [] execVM "MKY\MKY_Sand_Snow_Init.sqf";
};



sleep 0.5;

Share this post


Link to post
Share on other sites

Hey nice script. 

Im just running the standard description and init from the armaholic download and it wont work on a dedicated server. Am i missing something?

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

×