I am having an issue with my projectiles not appearing

I am having an issue with my game, the projectiles being very buggy only spawn in certain areas of the map and the issue is ONLY when I use this new PlayerControlller class. I am not sure what the issue is in this script. If anyone can help identify the issue I would appreciate it.

I added the functions in to act as a cheat code to spawn an actor when a string was typed by the player.

Here are the files.

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/PlayerController.h"
#include "FPSPlayerController.generated.h"

/**
 * 
 */
UCLASS()
class FPSGAME_API AFPSPlayerController : public APlayerController
{
	GENERATED_BODY()

public:
		UFUNCTION(BlueprintImplementableEvent,Category="PlayerController")
		void OnMissionCompleted(APawn* InstigatorPawn, bool bIsMissionSuccess);

		virtual bool InputKey(FKey Key, EInputEvent EventType, float AmountDepressed, bool bGamepad) override;
		

protected:
	FString CodeSequence;
	float TimeOfLastKeyPress;
	void ResetExpiredCodeSequence();
	void CheckCodeSequence();
};

And the CPP is below

// Fill out your copyright notice in the Description page of Project Settings.

#include "FPSPlayerController.h"
#include "FPSBlackHole.h"
#include "Engine/World.h"

bool AFPSPlayerController::InputKey(FKey Key, EInputEvent EventType, float AmountDepressed, bool bGamepad)
{
	Super::InputKey(Key, EventType, AmountDepressed, bGamepad);

	     // Only bother with presses (not releases) and don't worry about mouse button events
     if (EventType == EInputEvent::IE_Pressed && Key.IsMouseButton() == false)
     {
         // Clear the CodeSequence string if the last key press was more than 2 seconds ago
         ResetExpiredCodeSequence();  // in case it's not clear, this is another custom function
 
         // float TimeOfLastKeyPress is a float variable that you'll also set up in your Player Controller class
         TimeOfLastKeyPress = GetGameTimeSinceCreation();  // set the time (now) for the current key press; this is used by ResetExpiredCodeSequence(), above
 
         // Add the pressed key's "character" to the CodeSequence (by getting the key's string representation)
         CodeSequence += Key.ToString();
     
         // Call a custom function that compares the sequence to a list of your matching 'codes'
         CheckCodeSequence();
     }
     
     // Return a bool by calling the Super version of this function
     return Super::InputKey(Key, EventType, AmountDepressed, bGamepad);


 }
 
void AFPSPlayerController::ResetExpiredCodeSequence()
{
	// Find out how many seconds has passed since the last key press
	float TimeSinceLastKeyPress = GetGameTimeSinceCreation() - TimeOfLastKeyPress;

	bool bSequenceExpired = TimeSinceLastKeyPress > 2.0f;  // arbitrarily choosing 2 seconds for this example
	if (bSequenceExpired)
	{
		// If more than 2 seconds has passed since the last key press, reset the string; otherwise, don't do anything
		CodeSequence = "";    // reset the string back to a blank, empty string
	}
}


void AFPSPlayerController::CheckCodeSequence()
{
	if (CodeSequence == "E")
	{
		UE_LOG(LogTemp, Warning, TEXT("Wokrkinge"));
	}
	else if (CodeSequence == "EXAMPLE2")
	{
		// Just another example to show that you can handle more than one match possibility
	}
	// etc.
}

Yeah it was the super twice, didn’t realize that would cause an issue with the projectiles. Thanks man

There isn’t really anything in that which would cause the behaviour you described. The one error that I can see at a glance is that you call Super::InputKey twice. You probably only need this once.

Does this script run as you’d expect (i.e. does it print out Wokrkinge) when you press E?

One other thing to note (which might be intentional) is that if you start typing ‘EXAMPLE2’, you’ll first hit the ‘has E been typed’ condition. When it’s just priting to the log that’s fine, but if it’s performing something more complex you might end up trying to trigger one action on top of another.

Glad it helped. I converted this into an answer. Can you mark it as accepted to help others find their answers too.