Download

Which timer should i use?

I am looking for a timer but im not sure which one i should use.

This is for my reload system, The timer needs to wait X seconds for the reload animation to finish. Once that has finished the timer will stop and allow the rest of the code to run.



	if (WeaponInstants.CurrentInAClip < 18 && EWeaponState::Weapon_Idle) {
		EWeaponState::Weapon_Reload;
		
                if(/*Timer needs to be here and stop the following code from running until the timer has been complete*/){
			

                        NeededAmmo = WeaponInstants.MaxInAClip - WeaponInstants.CurrentInAClip;
			if (NeededAmmo < WeaponInstants.TotalAmmo) {
				WeaponInstants.TotalAmmo = WeaponInstants.TotalAmmo - NeededAmmo;
				WeaponInstants.CurrentInAClip = WeaponInstants.MaxInAClip;
			} else {
				WeaponInstants.CurrentInAClip = WeaponInstants.CurrentInAClip + WeaponInstants.TotalAmmo;
				WeaponInstants.TotalAmmo = 0;
			}
		}
	}


hey idk if you are looking for timers but if you are, here a tutorial you use some C ++ Networking Replication Multiplayer Tutorial Unreal Engine 4 - YouTube

ShooterGame has a system for handling this. Have a look at it.