Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
bardcat

Falling rain with ACS

Recommended Posts

how would you go about doing this? Ed C. did it once, but it didn't fall at a continuous speed. i suppose to it would be possible to do it with a texture and just have it scroll down, but i'd really like to use to ACS approach, with dripping sounds and such.

Share this post


Link to post

Make a simple rain actor in decorate first. It would be a projectile with the nogravity flag removed. The death state would play the dripping sound. Then in the map, using ACS, you spawn it by either using mapspots at the height you want, or inside random coordinates.

You can also make rain cloud actors, which require only placing a rain actor wherever you want rain. They are a bit more complex, and more difficult to evenly cover an area with them, but they are more dynamic as they don't require specifc scripts.

Share this post


Link to post

I made rain using only decorate:

projectile Rain3
   {
       SpawnNum 255
       Sprite RAIN
       Frames "24:A"
       DeathSprite RAIN
       DeathFrames "A"
       Radius 1
       Height 2
       scale .75 
       ALPHA 0.4
       RenderStyle STYLE_Translucent
      // RENDERSTYLE ADD
       Speed 0
       Damage 0
       NoBlockmap
       ActivatePCross
       ActivateImpact
       NoTeleport
       SpawnSound ""
       DeathSound ""
       DamageType Ice
       DoNotHurtShooter
   }

actor Rain 6660
{
     Health 2
     Radius 1
     Height 1
     +SPAWNCEILING 
     +NOGRAVITY
     +RANDOMIZE 
     +CEILINGHUGGER 
     Speed 0
     Mass 5
     +NOGRAVITY
     +NOTARGET 
     +FloatBob
     PainChance 0
     SeeSound ""
     DeathSound ""
     States
     {
     Spawn:
      RAIN B 10  A_Look 
      Loop
     See: 
      RAIN B 0 A_Jump (64,10) //
      RAIN B 0 A_Jump (96,15) // Randomizes the pattern a little
      RAIN B 0 A_Jump (128,5) //
      RAIN B 9   A_CustomMissile("Rain3", -8, 4, 45,0) 
      RAIN B 3   A_CustomMissile("Rain3", -8, -4, 0,0)
      RAIN B 0   A_FaceTarget
      RAIN B 9   A_CustomMissile("Rain3", -8, 16, 180,0) 
      RAIN B 0   A_FaceTarget
      RAIN B 11  A_CustomMissile("Rain3", -8, 0, 30,0) 
      RAIN B 0   A_FaceTarget 
      RAIN B 15  A_CustomMissile("Rain3", -8, -24, -30,0) 
      RAIN B 13  A_CustomMissile("Rain3", -8, 10, 90,0) 
      RAIN B 17  A_CustomMissile("Rain3", -8, -8, 300,0) 
      RAIN B 1   A_CustomMissile("Rain3", -8, 20, 0,0) 
      RAIN B 6   A_CustomMissile("Rain3", -8, 12, 60,0) 
      RAIN B 12  A_CustomMissile("Rain3", -8, 0, -60,0)   
      RAIN B 13  A_CustomMissile("Rain3", -8, 20, 90,0) 
      RAIN B 12  A_CustomMissile("Rain3", -8, -20, 200,0) 
      RAIN B 8   A_CustomMissile("Rain3", -8, 28, -170,0) 
      RAIN B 6   A_CustomMissile("Rain3", -8, 32, 233,0) 
      RAIN B 13  A_CustomMissile("Rain3", -8, 28, 110,0) 
      RAIN B 9   A_CustomMissile("Rain3", -8, 14, 20,0) 
      RAIN B 3   A_CustomMissile("Rain3", -8, 32, 0,0)    
      RAIN B 9   A_CustomMissile("Rain3", -8, 20, 10,0) 
      RAIN B 11  A_CustomMissile("Rain3", -8, 0, 30,0)   
      RAIN B 15  A_CustomMissile("Rain3", -8, 24, 30,0) 
      RAIN B 13  A_CustomMissile("Rain3", -8, -10, -90,0) 
      RAIN B 17  A_CustomMissile("Rain3", -8, 8, -300,0) 
      RAIN B 1   A_CustomMissile("Rain3", -8, -20, 0,0) 
      RAIN B 6   A_CustomMissile("Rain3", -8, -12, -60,0) 
      RAIN B 12  A_CustomMissile("Rain3", -8, 19, 0,0)   
      RAIN B 13  A_CustomMissile("Rain3", -8, -20, -90,0) 
      RAIN B 12  A_CustomMissile("Rain3", -8, -20, -200,0) 
      RAIN B 8   A_CustomMissile("Rain3", -8, 28, -170,0) 
      RAIN B 6   A_CustomMissile("Rain3", -8, -32, 233,0) 
      RAIN B 13  A_CustomMissile("Rain3", -8, -32, -110,0) 
      RAIN B 2   
      Loop
   Pain: 
      RAIN B 4  A_Pain 
      Goto See + 10
   Death: 
      RAIN B 3  A_Scream 
      RAIN B 3  A_NoBlocking 
      Stop 
     }
}
This way you don't need a map spot for every drop of rain you want. Thats what all those "A_CustomMissiles" do. Only bad part is that all the rain drops line up on the same axis. I just put down a few decorate rain entities and make each facing a different direction. I used ambient sounds separately. Used some ACS to create lightning, if your interested I can post that too but zdoom already has that built in I think.

Share this post


Link to post

I also have a decorate 'rain cloud'. Mine is for a different purpose than just rain, but it can be used in the same way. It's for gzdoom though (lot's of randoms).

Shtbag's method will work just as well, but it's always nice to have a few different examples.

actor raindrop
{   
	renderstyle translucent
	alpha 0.8
	radius 1
	height 1
	speed 1 //to give missile angle a slight effect 	
	damage 1
	projectile 
	-nogravity
		
	states
 	{
 	spawn:      
   		WDRP AAAAAAAA 4 
   		goto death
   	Death:
   		WDRP A 0 a_jump(225, 2) //only the occasional drop will play a sound
   		WDRP A 0 a_playsound("rain") 
   		WDRP B 4 
   		WDRP CD 4 
  		Stop
}

actor raincloud 
{   
	radius 2
	height 2
	speed 0 
	+spawnceiling
	+nogravity
	   	  	
	states
	{
	spawn: 
		
		NULL A 4
		NULL A 0 A_jump(50, 2) //chance to delay
		NULL A 0 A_custommissile("raindrop", -16, random(-50, 50), random(-180, 180))
   		loop
   		NULL A 0 
   		loop 
	 
		NULL A 4 //add a jump to here for temporary rain
		stop
	}
}


I also have a thing which spawns a bunch of 'rain clouds' in an area, but didn't include that.

Share this post


Link to post

The biggest problem with effects like these is the potential for massive slowdown. Having enough actors active in a level to give a convincing rain effect can cause even quite beefy computers to slow to a crawl. There was an example posted recently (although I can't find it ATM) where ACS was used to get the player's position, and only the rain spots within a certain distance of the player were activated.

Graf also said he might look at some way of reducing the slowdown problems that were noticable with particle-like effects in my Heretic-Thief WAD.

Share this post


Link to post

I have never tried A_CheckSight out, but maybe it could be used for rain clouds that only create rain when the player is looking at them. Then again, that wouldn't help if it's a large area where the problem is too many in sight.

Now that I think about it, A_JumpIfCloser could be used to jump into the raining states if the player is nearby.

Edit: I just added the jumpifcloser to my 'rain' and it worked very well. The rain cloud itself needs the ISMONSTER flag and needs to see the player with a_look first.
If it wasn't for this thread, I would have left my rain as it was. It didn't slow down on my computer, but I imagine it would have on less powerful machines.

Share this post


Link to post
Enjay said:

The biggest problem with effects like these is the potential for massive slowdown.

That's exactly what I was wondering. When we first implemented rain into Millennium years back, I put some in 2 outdoor areas and coming in through a ceiling grate in a 3rd area. When I loaded the level, I thought the system froze. Rebooted, tried again, let it sit for a minute. The map had loaded, then I tried to move. 2 seconds later, the next frame drew. Edited out the rain :(

Share this post


Link to post

yeah. your decorate rain looks really nice. not to mention the map itself, heh. i'm assuming it's not finished. anyway, is that using mapspots or what?

Share this post


Link to post

It just uses decorate but the rain behaves like a monster in that it uses A_Look so the player has to walk in front of it or fire to activate it. Once activate it will work forever unless you remove the thing by ACS.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×