Toon Tanks Pawn Movment Issue


I dont know why my code doesnt compile im trying to implement the input on the tank but i get this error everytime that i try to compile my code, no matter what i do.

Also my Player Input Component its showing me this error

And my GetWorld() Also its not working propertly

i tried to add #include “Engine/World.h” and #include “Components/InputComponent.h” it seems to be fine when i add the #include, but when i compile the same error shows again, help please ¡¡¡ D:

That is saying you haven’t implemented functions you’ve defined in ABasePawn

The latter is the one you need as that is the type you are accessing members on.

So di i have to implemente some function? I already ad the #include InputComponent, but the issue persist on the GetWorld() when i try to add it on my PanTank it shows me the issue and i cant compile my code so im not really sure what to do

Could you show the compilation error?


This is the error

In some part of the lessons i have to remove the public, and protect zone from the base pawn so im not sure if something i did get me that issue

That says you have declared functions in BasePawn but haven’t defined them. I’m assuming you deleted them from the .cpp but didn’t delete the declarations from the header.

Yes it seems so but im not sure what funcitons are not defined this is my code



In the base Pawn i Just Have the constructur i try to remove the tick component on it and add it ond the Pawn tank but the errror persist

The error seems to be on the Pawn tank but it might be something wrong on the base pawn reflecton on the pawn tank
HEAD



CPP

Im not sure if i have to put the functions i remove from the base pawn again, but im going to chechk the lecture again in case i got something wrong while i wait for your help, thank you very much

Could you provide the compilation error? Please always include that even if it looks the same.

Welll in this case it is the same i havent move anything since i send you the compilation error



I suggest you close Unreal and delete the Intermediate folder to force Unreal to re-generate the generated code. It seems it’s still trying to use the deleted functions.

Okay im going to try that im getting used to those weird things ureal does, its really great to know that mi code its fine :smiley: hahaha so i hope i can solve it, thank you very much ill let you know how it goes

Yes i delete the intermediate folder and then i open unreal and compile my code and now everything its perfect, thanks

Everything its fine on my code and i continue the lesson with out any other trouble, but i was wonering why does the GetWolrd() pointer apperes on red

Because it needs the header for UWorld as you are accessing members off it via GetWorld()


Im having this issue with the GetComponentLocation.Z im trying to set the turret Rotation but it doesnt allow me


It seems to be a problem with the syntaxis but im not quite sure i investiget both errors C2440 and C2228 to try to get some info and i realize that i might be the syntaxis so i add the () to the GetComponentLocation.Z so it is GetComponentLocation().Z ant it seems to work right so im not sure if it is the correct way, i compile my code before the instructur do it on the lesson so maybe in somepoint on the video he realize of the issue or maybe im still wrong

GetComponentLocation is a function and would need () in order to call it.


im on the lesson 158 of the Toon tanks and after i add the healt component and the particle system, affter i added those componentes to the BP_ classes Unreal crashes when i tried to shot my projectile so i enter again and didnt shoot the proejctile, when the game started i get closed to a turret and when it shooted at me unreal crashes again so it says that the problem might be on the line 49 of my Base Pawn Fire() function but im not really sure and i dont want to mess up my code because i almost got it haha i already rebuild my code a couple of times but anythings seems to have changed also y created another projectile BP based on the Actor projectile and replece all the reference with the New BP and cleaned the file but the error persist.

BASE PAWN CPP


BASE PAWN H

PROJECTILE CPP

PROJECTILE H

I was trying to figure out what its going on but nothing seems to have change but i realize that the first time i made the Spawn projectile componente i add it as a Static Mesh componente so i change it to a uSceneComponente but know im not able to see the spawn point on my BP_ turret and my BP_ Tank so i think that its why my game crash whenever i try to shoot a rpojectile or a turret does it, because there is no spawn point on my BP Pawns so im not sure how can i See my spawn projectile component on my scene
TURRET


TANK

In both of the Pawns doesnt appear anything on the detail panel when i click the prjectile compoenent and also it doesnt show anything on the viewport.

So i believe the errore its on the base pawn it might be on the header file on the scene component or in the cpp on the fire () function. because whenever something shoots the game crashes.

BASE PAWN.H


BASE PAWN.CPP


On the fire condition i tried to protect my code from null pointers but it seems something still wrong so i Made a chek before running the Projetctile Spawn so If There is not Projectile Class or the Spawn projectile componente the code shouldnt run, and it worked ass speected but now im not able to shoot my projectile because there is no spawn point on my BP_Pawns so thats why im not able to shoot i prevent the crash but the spawn projectile component doesnt exist, im not able to shoot and the turrets either
FIRE()

CRASH LOG


since a put some protection this crash doesnt appear any longer but my spawn point componente doesnt exist on my game for some reason

I Did it i just haved to recreate the pawns and all the options where there whit their corrections, i will leave the protections just in case, but this experience really helped me improve my skills

1 Like

Privacy & Terms