TwinStick strange errors, no input after respawn

After my death sequence, I respawn the character and possess, but I can only use my mouse rotation.

WASD and LEFT Mouse no longer function and I’ve tried “enable input” and also the one game input (Game and UI Only etc…) in all variations without success.

The input functionality is in my self made “AndyController” not the generic. It’s sort of special using the mouse pointer giving the ability to rotate my ship to where i am pointing while the WASD still moves me leftrightupdown like normal. If you ever played ASTEROIDS back in the day, this is the way it works.

The mouse rotation part of the code is running off EVENT TICK.

My errors when quitting after respawn:

Error Blueprint Runtime Error: Accessed None trying to read property CallFunc_K2_GetPawn_ReturnValue2 from function: ‘ExecuteUbergraph_Andy_Controller’ from node: SetActorRotation in graph: EventGraph in object: Andy_Controller with description: Accessed None trying to read property CallFunc_K2_GetPawn_ReturnValue2

Error Blueprint Runtime Error: Attempted to access Andy_Character_82 via property AndyCharacter, but Andy_Character_82 is pending kill from function: ‘ExecuteUbergraph_Andy_Controller’ from node: Add Movement Input in graph: EventGraph in object: Andy_Controller with description: Attempted to access Andy_Character_82 via property AndyCharacter, but Andy_Character_82 is pending kill

Here is my Movement Keys (again, in the controller not the character)

Having trouble understanding this and as you can see in this pic Get Controlled Pawn and Get Player Character deliver the same result and when I use my AndyCharacter Reference (which is stored on begin play) I cant even use the mouse either.

I have also tried SetControlRotation node and it didnt work.
I also followed the Unreal documentation for the WASD Keys and add world direction code as they showed with no results.

other than that…I am constantly crashing in 4.14…i shoot my lasers in this little partial tutorial game im making for fun with noi enemies in sight and the game crashes. id say in 3 days i’ve crashed a good 50 to 60 times.

ITS JUST A SIMPLE TWIN STICK! :smiley: hehehehe

How are you DEspawning your ship? Destroy actor? If so, after respawning the ship you need to make sure to repossess it with your player controller.

As for crashing, try and update your drivers? It isnt your code making you crash unless youre doing something dumb like spawning 10000 asteroids at a time or something ridiculous

I’m actually possessing from the GameMode, with get player controller attached. It the way it was done in this dudes tutorial…and in quite a few others i found. Makes no sense that my rotation with mouse functions…but WASD and shooting with LMB are dead

I think the crashing is due to me having only 6 gig RAM when i should have 8

Are you sure youre spawning the correct pawncvharacter? Looks like your rotation maps to the PlayerController while your WASD is mapped to your AndyCharacter. Could be thats the source of it.

On the Controller I store a reference to the “Andy Character” on begin play. This is all on the controller…if it looked like i was separating you would see a SELF node.

How about if i actually DONT destroy the character, making everything difficult…and just play an explosion, sound, set an FakePlayerDeath bool stop AI updates for a bit so they go away…fade the screen+hold…destroy all enemies in the darkness, reset whatever variables necessary to regulate dying, make the player visible again, fade back in…reinstate AI sensing updates.

Is there any specific reason why all these UE4 game tutorials ALWAYS destroy the player rather unnecessarily? does this concept have any backlash like saving game only works when the character is destroyed or something? would be good to know!

No. No backlash. Its just the cleaner way to go about things.

My guess is once the pawn is destroyed the reference in andyCharacter is being cleared and your code isn’t setting it to the proper playerController. Try hard mapping playerController at index 0 to both rotation and WASD and see if that fixes it

Well I tried what I mentioned with avoiding Destroy Actor and it worked of course just fine, but then it dawned on me that EventBeginPlay will not fire.

If I use Reset Level, the camera position is all F’d up when i get back in and the hud wont load…

4.14 is so full of strange bugs man…my action mappings wont work either, wrote another thread about it

certain things get reset when i open the editor too…i have blueprint component setting get reset, mainly collision presets etc

Try having the WASD and rotation controls reference thebexact same thing and see if that works man (meaning drag the pins from the exact same node). I have hunch thats where everything is breaking.

Your initial problem is due to not refreshing Andy character reference after destroying a pawn, it still pointing at your old pawn. Just pass a new respawned pawn to Andy character
You’re keep updating rotation successfully because you’re using GetPlayerCharacter instead of empty Andy character.

Just pass a pawn from GetPlayerCharacter to an empty Andy character right after you Possess and everything will be working fine!

Is it because my “AndyCharacter” object reference is not public so it can be refreshed automatically?

Of course now that I have reverted to disable input, hideactoringame,disable collision, fade out…kill enemies, teleport player…unhideactoringame, enable collision, fade in enable input…the event begin play will only fire once right?

The problem lays in the future when I am teleporting the player to other levels not sure what sort of repercussions this aspect will have far down the road because I have so little experience.

Here is how i am storing my AndyCharacter in my AndyController for reference to use with possible other future code:


Notice the REF is not public…does that matter?

See the event is begin play. Which is when the controller is created (meaning game start). Notice how when the character/pawn is destroyed, the controller persists (only depossessing the pawn) meaning the eventBeginPlay isnt triggered again. Meaning on respawn, you never assign the new character/pawn to the “andyCharacter” variable leaving your WASD controls unresponsive.

Rotation controls remain because those are mapped straight to the playerController.

This is why I, and zeOrb, suggested you review that particular segment of your code

Sorry for being stupid…my mouse stuff is done referencing the “get player character”, not the controller…the code is however in the controller.

secondy, I have no idea how to manually assign the controller to the andycharacter…if the andycharacter shooses the aicontroller called AndyController and that controller is set to transform attach to the AndyCharacter…why would I have to manuall do anything?

I didnt have to do anything in my other game like this…when i repsawn there it all just works but on that game I have all the controls in the Character.

in this game i have WASD and mouse rotation aiming on the controller and firing on the character :frowning:

im so confused about how to reassign the controller to the pawn…whether i understand it or not. I’ve always had serious troubles with invisible connections…like electricity…lol

an example picture of reset controller to pawn would be awesome!

All problems sorted out.

I was using a game input only. Got rid of it, problem fixed.

Glad the problems are sorted, and if everything is working now then that’s great. I’m working on something similar to you I think. Like you I had a bit of trouble making respawning work the way I wanted and had a couple of suggestions for you.

I have an event (a custom event I think) that I set up called OnRespawn. This is called from the Game Mode when the character is respawned and forces my Player Controller to set a new reference to the Character. It helps me around the issues you’re having with Event BeginPlay.

This may also be interesting. It uses an Event Dispatcher to call respawn events. It’s a little more complex but I definitely think Dispatchers are worth a little effort to understand.

Hope this helps a little. :slight_smile:

Hey thanks a lot for writing. I have found a working solution that doesn’t destroy the actor on death. I am using dispatchers to cancel pawn sensing updates and a few special things for the hud, so yeah, they are great.
I followed that tutorial, but for some now known reasons it didn’t work. I ended up learning how to do both ways. [Emperor_Imitation]It has only made me STRONGAAAA[/Emperor_Imitation]

The style of gameplay I have chosen to create is easier to work with if the player character is never actually Destroyed. There are advantages to both ways.

I do however greatly appreciate everyone’s help on this :smiley: It helped me realize the real structure of the game.