Monday, February 20, 2017

Creating A Targeted Lightning Particle and Weapon







  The Majority of my assets for this semester's Spinout project revolve around my car, the Tesla Model S.  This includes the particles I will need to use for my explosive barrel, my weapon particle, my boosters, and my Unique Selling Point (USP).  Because of this, I need to come up with a system that will target actors that will work on a weapon and other objects.  For my research into a particle, I'm looking into particle behaviors and controlling them to do so.  I'd like to make them perform a little something like this:





This script changes weapon firemode and targeting.


 In order to achieve what I'm setting out to do, like in the video above, the first thing I need to do is change the default FPS character blueprint.  Instead of a single projectile on a trigger pull, it now loops the firing so you can just hold the trigger to fire.  I also had to begin scripting the targeting systems for the behavior of the particle hitting random sectors, while polling for pawns to lock on to.  When a pawn is found the intended behavior is to stay locked and deal damage while locked.  This mechanic is important for my weapon and USP, as the lightning is to deal damage, and is important to my booster because the lightning needs to lock on to give the speed buff in my level.

This is the script for hit/miss
This script controls the behavior of the particle once hits and misses are registered.  In theory this should control the erratic behavior of the lightning, and the spawn of locked particles when in range. Once I can get the weapon behaving properly, I can begin to look at moving it to the USP and Boosters.



In programming my USP I wanted to have the large Tesla coil activate by a lever on the opposite side of the map.  This would potentially let someone behind or ahead trigger the coil and roast the competition.  In order to do this, I had to create a Boolean for a lever being pulled, but to keep it balanced, I decided to add delays to effectively give the activation a "cooldown." 






Once I got the weapon working in a single player environment I transferred it into the Spinout project and began to set it up to work on my vehicles weapon and USP (unique selling point).  The weapon version was an easy transfer as I just had to create new bones and sphere collisions for my particle to generate from.

The Giant Tesla USP was a bit trickier.  Once I got the lever scripted to activate the coil, the map was almost too dormant.  TO fix this I broke off the erratic behavior of the particle, threw a random delay on it, and set it to activate permanently.  This gives the level a nice ambient random lightning discharge.



No comments:

Post a Comment