x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Replication Code gone wrong. Help?

Here are my classes:

SecretPlayerState.h

 #pragma once
 #include "GameFramework/PlayerState.h"
 #include "SecretPlayerState.generated.h"
 #include "Core.h"

 UCLASS()
 class SECRET_API ASecretPlayerState : public APlayerState{
     GENERATED_BODY()
 public:
     ASecretPlayerState(const FObjectInitializer& ObjectInitializer);
     UPROPERTY(BlueprintReadWrite, Category = "Attribute", EditAnywhere, Replicated)
     int32 health;
 };

SecretPlayerState.cpp

     #include "Secret.h"
     #include "SecretPlayerState.h"
     #include "UnrealNetwork.h"             
      ASecretPlayerState::ASecretPlayerState(const FObjectInitializer& ObjectInitializer)
      : Super(ObjectInitializer){
          bReplicates = true;
          health = 100;
     }
                     
    void ASecretPlayerState::GetLifetimeReplicatedProps( TArray< FLifetimeProperty > & OutLifetimeProps ) const
 {
             DOREPLIFETIME( ASecretPlayerState, health);
 }

This is the error i get:

     :\Program Files\Epic Games\4.7\Engine\Source\Runtime\Engine\Public\Net\UnrealNetwork.h(78): error C2653: 'FLogCategoryLogNet' : is not a class or namespace name
     1>C:\Program Files\Epic Games\4.7\Engine\Source\Runtime\Engine\Public\Net\UnrealNetwork.h(78): error C2065: 'CompileTimeVerbosity' : undeclared identifier
     1>C:\Program Files\Epic Games\4.7\Engine\Source\Runtime\Engine\Public\Net\UnrealNetwork.h(78): error C2065: 'LogNet' : undeclared identifier
  There is more to this error but its huge
 








Product Version: Not Selected
Tags:
more ▼

asked Apr 24 '15 at 06:23 AM in C++ Programming

avatar image

DrakeWalker
91 30 30 32

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

When you declare a replicated property, you have to implement GetLifetimeReplicatedProps(). See this replication intro tutorial.

more ▼

answered Apr 24 '15 at 06:30 AM

avatar image

max99x
157 12 8 13

avatar image DrakeWalker Apr 24 '15 at 07:05 AM

I tried using that tutorial, and it kind of fixed the issue, but it gave me more errors now. I edited my original post

avatar image max99x Apr 24 '15 at 07:11 AM

UnrealNetwork.h is relying on some logging methods that it should have included or forward-declared. I believe you can fix the error by adding #include "Engine.h" before the UnrealNetwork.h include.

avatar image DrakeWalker Apr 24 '15 at 06:41 PM

It worked Thanks! Now, how do i connect this playerstate to a character?

I have a custom gamemode that chooses thirdpersonplayer as the default pawn, and a secretplayerstate as the playerstate. But it says that thirdperson is not part of secretplayerstate

avatar image max99x Apr 25 '15 at 04:15 AM

What's your code code and what's the exact error message?

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question