I have set up a simple test map consisting of a slab of BSP, a
skylight, a playerstart, a skydome, and a directional light.
I will only be using default editor assets which can be found
in the EditorMeshes and EditorMaterials
packages.
Randomizing Effects can be very simple, or very comlpicated,
or anything in between - it all depends on what you are trying
to accomplish. We'll start with a simple system and then complicate
it.
1) What are we making? We'll make an area that triggers a random
emitter and sound every 10 seconds while the player is in the
area.
2) Gather the ingredients:
Emitters
Trigger
Random Switch
Action
Trigger Touch Event
Toggle Actions
PlaySound
Actions
Delay
3) Put It Together:
First, I'll position the trigger in the middle of the area and
expand its radius. Since the area is square, I'd probably use
a trigger volume instead, but we'll just stick with the trigger.
Then I'll create the trigger event, a bunch of toggles, matching
play sounds, and finally the random switch.
|
|
On the Kismet side of things, I'll hook the Trigger Touch into
the random switch. Then I'll pair each toggle with a play sound
and emitter. Next, I'll hook the random Switch into each particle
system. Finally I'll add the delay at the end and loop it back
into the random switch turn pick a new one after the delay.
I've set the max trigger count to 1 for now as we don't have
a way to turn it off when the player exits the area yet.
*Note: I am using 'burst' emitters than 'turn off' by themselves. If you have use a 'constant' emitter, you'll have to add in systems to shut them 'off' after x amount of time.
|
|
4) Test it. Go in game and test it out. It worked fine for me..
5) Refine it. First, think about the collison and lighting and
get those fixed. Since we're dealing with emitters right now,
it doesn't matter, but if they weren't emitters, it would be
a good question to ask. Then consider any potential issues.
What happens when the player leaves? Nothing - the system keeps
firing. We need to add a system to shut things 'off' when the
player is no longer around. In this 'shut off' control, I'll
add a system to only turn on on the first touch, but not on
the others, and to shut down the whole system on the last untouch.
|
|
The Touch Event is set to a MaxTriggerCount of 0. Whenever a
player enters, the int counter will go up, but the gate closes
after the first entrance. The other int counters counts down
when players leave the area and will only re-open the gate once
all the players have left. It will also shut down the delay
so it doesn't keep looping when no players are there.
6) Adjust it for Single/Multiplayer. As you may have read in
the SinglePlayer/Co-op/MultiPlayer
section, there are many considerations to take into account
for whichever system you're setting this up for. The system
as it stands might be ok for single-player and multiplayer both.
But you should still ask yourself some questions if you're working
with additional assets like interpactors, or anything with geometry.
What happens when players get in the way? Do you want this to
only react to the player or to AI/bots as well? The questions
will vary depending on the circumstances of use.
|