So im looking to create a weapon on my ship that essentially can shoot up to X seconds then needs to cool down and you can begin shooting again, I am just having a hard time I guess “Conceptualizing” how I should go about doing this? Should I use timers? What should I be checking? I have done a bit of work but im not too sure if I am on the right path or not, some examples would be awesome if possible, it would really help me to understand the flow.
Don’t fire if (bIsCoolingDown)
When you do fire, increment Heat. If Heat is > 1.0 then bIsCoolingDown = true;
In your tick I’d decrement Heat like Heat -= CoolDownRate * DeltaSeconds;
then check if (Heat < 0.0) then bIsCoolingDown = false;
You could use a timer… I tend to do things manually in the Tick function. You could do something similar to the Heat variable but have it as Reload, so before firing you’d check !bIsCoolingDown and !bIsReloading fex.
Alright so I got my firing function now (Without overheating, that im doing later) but spawning my projectile is not working, is anyone seeing anything im doing wrong all the references I am going to is telling me to do it this way even the FPS templete in UE4
That’s your issue then. The SpawnActor function is expecting the first argument to be a pointer to a type of UClass, but you’re passing it a pointer to an object (not the class of the object)
I’d try changing your definition to be something like: