Scripts / Stop rain and snow when going inside

Author
Message
Pink Panther
14
Years of Service
User Offline
Joined: 1st Feb 2010
Location:
Posted: 29th Aug 2019 17:27
I love the weather particles available to us now and I have read Amen Moses "Particles, a GG tutorial series" over and over again as well as anything else on the forums regarding particles, but I can't figure out how to stop the rain/snow when going indoors or under cover.

I was watching Preben's video from 2018 "Particle rain/dust/splash/bullet holes and more" and he shows it can be done. I see there is a StopParticleEmitter(e) in the global but I have no idea how to write a script to use it. Any help would be great!
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 29th Aug 2019 18:10
Ok, so there are two simple ways of handling this.

1) Carefully design your level so that particles are only spawned in areas outside a building, that way when you enter a building and look out through the door or window you will still see the rain. This only works when the emitters are attached to stationary entities.

2) For particles attached to the player, detect when the player is inside and either delete the emitter or change the settings on the emitter to stop it emitting particles (IIRC setting the 'life' to 0 or maybe -1 might achieve this).

The second approach is not very realistic.

A 3rd more complicated method would be to attach the emitters to an object which follows the player around but stays outside a building.

Been there, done that, got all the T-Shirts!
PM
Pink Panther
14
Years of Service
User Offline
Joined: 1st Feb 2010
Location:
Posted: 29th Aug 2019 19:07
Amen Moses thank you for your fast reply!

Attempting method 1. Went to graphix_rain_particle and changed -1 to "entity" so it would not be player centric. Of course that didn't work so I guess I have to change many of the parameters? Or should I take something like the fountain emitter which already stays with an entity and change the settings to get it to look look like rain? I am an absolute beginner with this so I guess I need simple explanations!
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 29th Aug 2019 21:09
Yes you would have to change the parameters to suit a static emitter.

You will then need to place enough copies of the static emitter around the map to give the effect you need and add some logic so that only the nearest entities to the player are active (waste of time having particles way off in the distance).

You want the particles to spawn at about 150 units above the player and within a box around the entity, then let them fall with gravity long enough to fall to just before they would hit the ground.
Been there, done that, got all the T-Shirts!
PM
Pink Panther
14
Years of Service
User Offline
Joined: 1st Feb 2010
Location:
Posted: 29th Aug 2019 23:02
Okay, thanks for that explanation. I will give it a go!
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 29th Aug 2019 23:12
This might be a good starting point.

Basically the closer the player is to the emitter entity the denser the effect, if you reduce the overall range and fiddle with the variables a bit you should be able to carefully position enough entities around a map to get close to the effect you want.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
Pink Panther
14
Years of Service
User Offline
Joined: 1st Feb 2010
Location:
Posted: 30th Aug 2019 20:31
Thanks Amen Moses! Now I have something to work with!
PM
JC LEON
13
Years of Service
User Offline
Joined: 22nd Apr 2010
Location:
Posted: 19th Sep 2019 22:50
hi I resurrected this since i need same thing but i cannot manage to figure how to do... any hint ..example.. i tried the radiation lua script posted but sincerely cannot figured how it can help me..
PC Specs:
AMD QUADCORE 880K @4.5GHZ, 32GB RAM DDR3 1600, M/B ASUS A88XM-PLUS
SVGA NVDIA 1660GTX 6GB , SSD KINGSTON A400 1TB, 2X HHD SEAGATE BARRACUDA 4TB
PM
PCS
7
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 20th Sep 2019 21:10
I am no scripter but , i am thinking this raycast function we have,, AmenMoses cant you use the raycast function on the rain script to determine collision with an entity like a house and if there is collision then you stop the rain on the entity so that is does not go thru it,
just like it would have hit the ground and stopped.
Would it be possible or am i missing the point completely .
Sorry for intruding
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 20th Sep 2019 21:40
Lol, have every particle casting rays? No chance.

Either have the emitters placed outside any buildings and turn them on when the player approaches or have following the player around but only turn on those that don't have an object between them and the player.
Been there, done that, got all the T-Shirts!
PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 20th Sep 2019 22:17 Edited at: 21st Sep 2019 09:05
@ Pink Panther

Is not that difficult to do, I means thru script.
Just declare a flag, when the flag is equal to = 0 rain, otherwise stop.
So, put a trigger in both sides of the door, you can named it as "indoor" and "outdoor", in indoor trigguer flag value = 0, in indoor one the flag value = 1
So, when player step over triguers the value change, and the rain/snow too.
In the particles script you can work with those flag's values.

Edit: Sorry, wrong poster, fixed.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
PCS
7
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 21st Sep 2019 08:51 Edited at: 21st Sep 2019 08:52
i did this a while a go. maybe it can help.https://forum.game-guru.com/thread/220284#msg2609004
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
Pink Panther
14
Years of Service
User Offline
Joined: 1st Feb 2010
Location:
Posted: 21st Sep 2019 17:19 Edited at: 21st Sep 2019 17:26
Thank you AmenMoses, 3com, and PCS for the information. I had some slight success with AmenMoses's radiation script. I put in a rain decal (old, don't even know where it is from) and tweeked some of the values. If I put the indoor area at the proper distance it would not rain inside. I took the same rain , decal and placed it in front of the door and a window and it looked pretty good.

I would also like to try your idea 3com. I think might be easier to do but I have to figure out how. I am going to try using the PCS scripts to start. In general I get what you mean regarding the flags but I don' t know exactly how to put them in the above mentioned scripts.
PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 21st Sep 2019 20:39
This script produces rain through images, so you don't need decals or particles, just scripts.

The script called "rain.lua" was written by smallg as well as the images. The script contains some modification to achieve the intended purpose. Thanks smallg.

Put the folder called "weather" inside the folder: scriptbank> images.

The scripts in the "scripbank" folder.

If instead you prefer to use particles, you have to adapt the AM's script to achieve your goal.
these script will give you an idea of how to get it with particles.
Just dare to do it and publish what you have here, I'm sure someone will help you, even if my limited knowledge can help you with something.



Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

Attachments

Login to view attachments
PM
Pink Panther
14
Years of Service
User Offline
Joined: 1st Feb 2010
Location:
Posted: 22nd Sep 2019 16:40
Thanks 3com. I am going to work on this!
PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 22nd Sep 2019 21:37
@ Pink Panther
you are welcome.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 23rd Sep 2019 17:37
Hey guys.if you don't want the rain stop forever , so the script named "stop_rain.lua" should looks like :



hth
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 23rd Sep 2019 19:36
@ bluemeenie195
I did all as I've posted above and it works ok, you get out , wander around as much time as you want to, and the rain remain, there should be something you are doing bad. It can sound as foolishness, but sometimes you has to reboot GG to get the script to take effect.
As you can see on the vid the trigger is out.


Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
bluemeenie195
5
Years of Service
Recently Online
Joined: 28th Oct 2018
Location:
Posted: 23rd Sep 2019 19:59
Its weird why it's not working. I followed the video to the T.

I'm at work right now, but I will try as soon as I get home.

Thanks
PM
bluemeenie195
5
Years of Service
Recently Online
Joined: 28th Oct 2018
Location:
Posted: 24th Sep 2019 13:06
Hi 3com,
Just to confirm, I deleted and re-downloaded the scripts and updated the no rain script and it worked.

Thanks to smallg, and you for the cool scripts. Now I need to find some realistic snow PNG pics.
PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 24th Sep 2019 14:34
Glad to know you got sorted.
About pics, does you has any Devcore's snow decals?
Even particles has some nice Graphix's snow pics.
Or you can look for some free snow gif file, as starting point.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
bluemeenie195
5
Years of Service
Recently Online
Joined: 28th Oct 2018
Location:
Posted: 24th Sep 2019 15:58
Great, thanks for the advice.
PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 24th Sep 2019 17:32
Does you have Gimp?
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
bluemeenie195
5
Years of Service
Recently Online
Joined: 28th Oct 2018
Location:
Posted: 24th Sep 2019 19:04
I don't have Gimp, but I do have PhotoShop
PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 24th Sep 2019 20:16
I work with Gimp, I'm not very familiar with ps, but I guess it has a plugin that makes things easier for you, if you want to do it yourself, otherwise on the Internet you can also find it.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 6th Oct 2019 16:49
I'm actually still having troubles finding a way to enable and disable an emitter.

I've tried the following with no results:

--TESTING REMOVAL METHOD
if snowing == 0 then
ParticlesDeleteEmitter(emitter)
StopParticleEmitter(e)
ParticlesSetWindVector( 0, 0 )
ParticlesSetLife( emitter, 0, 0, 0, numParticles , 0 )
end
--TESTING REMOVAL METHOD

Store Assets - Store Link

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 6th Oct 2019 19:52
@ Teabone
Does not work for me either, I've tried graphix_snow_particle plus :



Without any success.
Maybe AM know something about.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 6th Oct 2019 20:46 Edited at: 6th Oct 2019 20:49
Quote: "I'm actually still having troubles finding a way to enable and disable an emitter."

ParticlesDeleteEmitter()
works fine for me, i don't think there's a way to get if an emitter exists or not so just make sure you're storing the emitter ID correctly when you create the emitter
ParticlesAddEmitterEx( emitter ) <- emitter is the ID here
if you create multiple emitters with the same ID it will only be able to delete 1 so store the IDs in an array or something if you want multiple then you can loop through them
i.e.
--in your script set up
local emitterID = {}
local tempID = 0

-- in the part you create the emitter(s)
local emitter = ParticlesGetFreeEmitter() --this checks the engine for a free emitter slot
tempID = tempID + 1
ParticlesAddEmitterEx( emitter ) --we use the value returned by the engine as the ID
emitterID[tempID] = emitter --we're just storing the value returned by the engine in an array for later use

--when it's time to clear the emitters away we can now cycle the emitterID array
for a,b in pairs (emitterID) do
ParticlesDeleteEmitter(b)
end
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 6th Oct 2019 22:57 Edited at: 6th Oct 2019 22:58
I am unable to get the snow particle effect that is in the weather scriptbank to disable. Trying everything here. Though I may be misunderstanding the way it all works.

Will get some rest and try out a fresh start tomorrow.
Store Assets - Store Link

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 6th Oct 2019 23:24
using just 1 emitter.
graphix_snow_particle.lua script
adding :



And does nothing.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 6th Oct 2019 23:38
There you go.

Attach the control_snow script to a zone, enter the zone to turn off snow, leave to turn it on.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 7th Oct 2019 02:37
Ok now it works, thanks mr AmenMoses.
I've added a bit of snow storm.

Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
bluemeenie195
5
Years of Service
Recently Online
Joined: 28th Oct 2018
Location:
Posted: 7th Oct 2019 13:07
Hi guys,
The snow control script works great, but does anyone else notice that when you run with the graphix_snow_particle, all the snow seems to go behind you.

Is there a way to adjust the snow box in the script, so the snow box is more in front of you ?

Thanks
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 7th Oct 2019 14:53
yes change the offsets to be larger (mainly the x and z)
lines 9 and 19
-- x1 y1 z1 x2 y2 z2
offset = { -380, 80, -380, 380, 100, 380 },
etc
just be aware that making the box bigger will make the effect look less dense
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
bluemeenie195
5
Years of Service
Recently Online
Joined: 28th Oct 2018
Location:
Posted: 7th Oct 2019 15:00
Great, thanks for your help
PM
Pink Panther
14
Years of Service
User Offline
Joined: 1st Feb 2010
Location:
Posted: 10th Oct 2019 16:35
Thank you Amen Moses and smallg!
PM
bluemeenie195
5
Years of Service
Recently Online
Joined: 28th Oct 2018
Location:
Posted: 14th Oct 2019 14:30
I've added the GraPhiX mist particle into the GraPhiX snow particle script to see if it would work with AmenMoses snow control script.

The snow particle script worked fine, but would only stop emitting the snow, so the mist was still there.

Is there a way to get the control script to stop the mist too ?

Thanks



Attachments

Login to view attachments
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 14th Oct 2019 19:53
Try that.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
bluemeenie195
5
Years of Service
Recently Online
Joined: 28th Oct 2018
Location:
Posted: 14th Oct 2019 20:26
Yes !
worked like a charm. Your the best Amen.

Thank you
PM

Login to post a reply

Server time is: 2024-04-19 16:48:08
Your offset time is: 2024-04-19 16:48:08