Rain Toggle Script

Had a really pleasant surprise this morning when the rain code that I thought would be very difficult was pretty easy! I’ve been learning about casting whist doing my lighting, and thought this would be the way to go with the rain, but you can’t cast to the level blueprint (one answerhub user described the level bp as the director and the other bps as actors). The new thing I looked at this morning was custom events, meaning I can do things the other way around – I can define a set of actions in a blueprint and then call the custom event I attached to them in the level bp.

code1

I set up a custom event, and the used emmiter enabling to set the emmiters on and off. It took me a while to realize that this needs to be done within the bp – turning off emitters in the particle effect itself will leave them off permanently. Once sorted, this worked nicely, however there was a second between the event and the emitters switching off.

code2

Luckly, when looking for prewarm options, I found an emitter enable toggle – this is what I needed! I redid the bp so it was even simpler with this.

code5

I called the overcast event as part of the lighting code, and then called the night event when the player touches the gate to go to the hub. Putting this in the lighting code means that the player will get rained on in the hub – not what I want!

code4

I then added and took away the ripple effect on the water, just using spawn emitter at location and then destroy actor.

code3

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s