Download

Random projectile generator?

I’m using UE4.7 and making a FPS game. I have a turret created and am currently trying to make it so it shoots different colored projectiles. (Paintballs so it’s school appropriate), but I can’t seem to get it to shoot different projectiles. I’m using blueprints, I do not know C++ well enough to rely on it. Any suggestions? Thanks

Make material with color vector as variable.
Create instance material out of it

In projectile blueprint make dynamic material instance, make random color, apply it to that dyn material, aply it to projectile mesh

Or make particle effect with your projectile and add random color to it.

Watch tutorials.

Yeah you are going to want to just spawn a projectile and then pass across a random colour on the actual projectile, not the turret itself.

Well, just get a random int in range from like 1-5, and if number is 1, assign color one, ect… Does anyone know of a way to execute a random node? Like is there an ‘execute random’? If not, I know I can make a macro, but is there a way to make a global macro, kind of like a built in node?

Yep there is the random INT in range and random Float in range nodes that do that.

I tried doing this for you. FUp3eGW.png
To get this result
rIlA1n.gif

Edit : Ignore the conveyor belt.

Does the trick pretty easily, personally I would cast that off to a “SpawnProjectile” in the turret blueprint but im sure he can figure it out.

Also just as a side note since I play paintball pretty often. They normally just use 1 colour in a game anyway.

I’ve started to take more interest in this and I’m trying to figure out a way to spawn decals of the same color as the projectiles. I’ve no knowledge about materials in UE4, any hints?
Here’s how I’m trying to do it. It spawn the assigned decal, but I’m not sure how to change the color of the decal to the projectile color.
7351f58545a0b19f199b94afa26dd1e9c4713d4f.png

Okay so this is how I made my projectiles spawn with decals of different color. However I’m not able to get the same color on the decals as the projectiles. This graph here is where my projectiles spawn with a dynamic material.
StGKYlt.png

In this graph I make my projectiles do things when they hit something.
R9C58cY.png

In this graph I’ve set up a deferredDecal Material. I’m using an instance of this material to set create my dynamic instance material BCOVVyR.png
Here’s what it looks like in the editor
65TfJq.gif

P.S. My projectile life span is set to 1 sec, if that helps. :stuck_out_tongue:

In the turret blueprint, what did you make the variable types? I am having trouble with the Decal Color, it won’t set and have a target.
Thanks by the way, I really appreciate that you posted this and took the time to do so!

Decal color is of variable type Linear Color.

I set Decal Color as a linear color, but I still can’t set it and have the target option. It just says set and has pins for Decal Color, but no target.