Is there an alternative function to AddMovementInput? UE.2.0

that might be the problem ?

1 Like

No, that’s not the problem.
My class actually derives from ACharacter.

1

And the imput works sometimes correctly.

I gave the class name ACCharactesBase for another reason.

Because my Player class derives from it, and my ABot class also derives from it.

But thank you very much for trying to help.
I appreciate it

Turning that option on in the scene I sent you & movement still functions and replicates.

Ok, thanks, I’ll keep looking for the problem then…

Is there a way to force the bluprint to update when compiling?

I’ve noticed that there are some things that do update and others that don’t… Especially the components… Even using Live Coding.

It would be very useful to be able to do that.

1 Like

Thank you so much!!

Hi 3dRaven!!

I haven’t been able to fix this problem yet.

I have reviewed the configuration of my Character and everything to be correct.

So I have suspicions that the problem may be in the way of spawning the actor.

I recently changed the way of doing it. Before I did it from Blueprint and now I do it in C++.

I was doing tests and I realized that if I change the variable “bDeferConstruction” to true then the server side also fails in the same way as the client side.

IF “bDeferConstruction” is false then the server side works correctly but the client still doesn’t work.

Also it is possible that I am not using the correct flags.

I was trying different combinations but none gave me good results. The only one that worked more or less well is “RF_Transient” and because I saw it in the Lyra code…

Could you tell me a standard basic configuration that works on the client and on the server without problems?

This is the way I am spawning the characters:


What do you think? Did I do something wrong?

Maybe it’s more comfortable to see it in code.

SpawnFunction.cpp (3.5 KB)

Thank you very much 3dRaven!!

Personally I’ve never needed to use bDeferConstruction

uint8 bDeferConstruction: 1

Determines whether the construction script will be run. If true, the construction script will not be run on the spawned Actor. Only applicable if the Actor is being spawned from a Blueprint.

If you want to postpone the constructor script I would use
GetWorld()->SpawnActorDeferred function like this

1 Like

Ok, I’m going to try it!!
Thank you very much for your help 3dRaven!!

Hi 3dRRaven
I found the problem…
I checked everything and I never imagined that it was this.

The problem is that my AMyPlayer class does not derive directly from the ACharacter class.

It does work

class AMyCharacterBase : public ACharacter

It does not work

class AMyPlayer : public AMyCharacterBase

It does work

class AMyPlayer : public ACharacter

I don’t know what the engineers did but this goes against the intuition of any programmer.

And the worst part is that I need MyPlayer to derive from MyCharacterBase. Much of the logic of my game is based on this. And also there is no programmatic logic to repeat the same code twice if it can be inherited. And with blueprint there was no problem with inheritance…

Is there a way that AMyPlayer class inherits from AMyCharacterBase and ACharacter doesn’t break?

Thank you very much 3d Raven!!

In the example files i sent you AMyplayer class derives from AMyCharacterBase and that derives from ACharacter.

Hi 3dRaven
Yes, your example works correctly.

What does IVAN_API do? It is important? I deleted that from my classes. I changed the name of the project several times and that was a headache. Maybe that’s the problem?

Why did you override the OnMovementChange() function? The implementation is empty…

Also I deleted the class specifiers

UCLASS(config=Game, Blueprintable)

Now it’s empty

UCLASS()

I don’t see any difference

For the rest I think that everything is the same.

Thank you so much!!

The _API is just the project name. Yours will be YOURPROJECTNAME_API

I didn’t want to name it IVAN3Z because I know unreal can be problematic with project names so I skipped any numbers just in case.

I needed to start naming them according to people because I’m slowly losing track of which project related to who on the forum :P. Makes it easier to find.

1 Like

Ok, so if it doesn’t have any programmatic function then I won’t worry about omitting it. My code is much more portable this way.

Thank you so much 3dRaven!!

I found this:

I think this explains part of the problem. The other part I think has to do with the SpawnActor function (With the Deferred option).

SpawnActorDeferred:

this allows scale as well). WILL NOT run Construction Script of Blueprints to give caller an opportunity to set parameters beforehand. Caller is responsible for invoking construction manually by calling

So I think there are two problems instead of just one. Or maybe more…

I think the reason your example works and mine doesn’t is because in your example the Charartes is automatically spawned by an empty GameMode and the Character is the default pawn class.

I think I tried with the constructor without parameters and it did not solve anything. So the problem must be caused by the SpawnActor() function (I think)…

However now I think I have made the problem worse.

I customized the character components.

And the truth is that I like it that way… my code is much more organized like this.

However, I think there is a big problem with inheritance, Constructors, and spawn…

And I don’t know how to fix it :rofl: :rofl: :rofl:
But at least I know what the problem is!! (I think)

I sent this message to myself… but I really wanted to send it to you

Hi 3dRaven!!

You will not believe this:

The error is because I forgot to put this

Super::PossessedBy(NewController);

Do you want to try it?
The OnPossesBy function must be in the base class.

3

https://forums.unrealengine.com/uploads/short-url/nYnUvRoD4RoLMyrmqFk6x7mrTTw.zip

I don’t understand many things about this.

-What relationship does this have with the movement component?

-Why does it only fail on the client side?

I’ve been looking for this bug for a week… I almost went crazy…

Thank you so much 3dRaven!!

Ah yes the depth of some bugs can be surprising. If you are overriding any function, then if you skip calling it’s super you might miss out on some of it’s initialization processes.

PossessedBy is responsible for setting up the controllers and some network replication functions.

If it’s the first time overriding a function, it’s always good practice to find it in source (cpp) and look at what it’s responsible for and then decide if the super should be called (99% of the time it should be unless you want to 100% redefine it’s behavior).

1 Like

Thank you very much for your help, and your enormous patience with me.
And for your explanations and your examples.
I really appreciate all that so much!!
You Rock So So Much!! :heart: :heart: :heart:

Having this in the files
.h

virtual void PossessedBy(AController *NewController) override; 

and cpp

void AMyCharacterBase::PossessedBy(AController* NewController) {
	Super::PossessedBy(NewController);

	GEngine->AddOnScreenDebugMessage(-1, 1, FColor::Orange, GetName() + " has been possessed by "+NewController->GetName());
}

Works as expected. You get to override the function and call your own extra code.

You can also decide if you want to call you own code before the super (sometimes you want to do your stuff first :slight_smile: )

1 Like