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"

Problems with code

I am having some problems with my code could you look at it for me`

BaseCharacter.h

 // Fill out your copyright notice in the Description page of Project Settings.
 #pragma once
 
 #include "GameFramework/Character.h"
 #include "BaseCharacter.generated.h"
 
 UCLASS(Blueprintable)
 class TWINSTICKSHOOTER_API ABaseCharacter : public ACharacter
 {
     GENERATED_BODY()
 
 public:
 
     //Make a health property 
     UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Base Character")
         float Health = 100;
 
     //Make an isdead property
     UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Category = "BaseCharacter")
         bool isDead = False;
 
     //Calculate death funtion (helper)
     virtual void CalculateDead();
 
     //Calculate health funtion
     UFUNCTION(BlueprintCallable, Category = "BaseCharacter")
         ABaseCharacter();
     virtual void CalculateHealth(float delta);
 
 #if WITH_EDITOR
     //Editior-centric code for changing properties
     virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent
         override;)
 #endif
 
 
 
 public:
     // Sets default values for this character's properties
     ABaseCharacter();
 
     // Called when the game starts or when spawned
     virtual void BeginPlay() override
     
     // Called every frame
     virtual void Tick( float DeltaSeconds ) override;
 
     // Called to bind functionality to input
     virtual void SetupPlayerInputComponent(class UInputComponent* InputComponent) 
 override;
 #endif


BaseCharecter.cpp

 // Fill out your copyright notice in the Description page of Project Settings.
 
 #include "TwinStickShooter.h"
 #include "BaseCharacter.h"
 
 
 // Sets default values
 ABaseCharacter::ABaseCharacter()
 {
      // Set this character to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
     PrimaryActorTick.bCanEverTick = true;
 
 }
 
 // Called when the game starts or when spawned
 void ABaseCharacter::BeginPlay()
 {
     Super::BeginPlay();
     
 }
 
 // Called every frame
 void ABaseCharacter::Tick( float DeltaTime )
 {
     Super::Tick( DeltaTime );
 
 }
 
 // Called to bind functionality to input
 void ABaseCharacter::SetupPlayerInputComponent(class UInputComponent* InputComponent)
 {
     Super::SetupPlayerInputComponent(InputComponent);
 
 }
 
 //CalculateHealth
 void ABaseCharacter::CalculateHealth(float Delta)
 {
     Health += Delta;
     CalculateDead();
 }
 //Implement CalculateDead
 {
     if (Health <= 0)
         isDead = true;
     else
         isDead = false;
 
 }
 // Implement PostEditChange Property
 {
 #if WITH_EDITOR
     void ABaseCharacter::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
     isDead = false;
     Health = 100;
 
     Super::PostEditChangeProperty(PropertyChangedEvent);
 
     CalculateDead();
 }
 #endif

Microsoft.MakeFile.Targets

 <TargetPath Condition="'$(NMakeOutput)' != ''">$([System.IO.Path]::Combine('$(ProjectDir)','$(NMakeOutput)'))</TargetPath>
 <LocalDebuggerCommand Condition="'$(LocalDebuggerCommand)'==''">$(TargetPath)</LocalDebuggerCommand>

 <!-- Create the directories for intermediate and final build products, and any other arbitrary directories. -->
 <MakeDir Directories="$(OutDir);$(IntDir);$(TargetDir)"/>
   
 <VCMessage Code="MSB8005" Type="Warning" Arguments="NMakeCleanCommandLine" Condition="'$(NMakeCleanCommandLine)'==''"/>
 <Exec Command="$(NMakeCleanCommandLine)"  Condition="'$(NMakeCleanCommandLine)'!=''"/>
   
 <VCMessage Code="MSB8005" Type="Warning" Arguments="NMakeBuildCommandLine" Condition="'$(NMakeBuildCommandLine)'==''"/>
 <Exec Command="$(NMakeBuildCommandLine)"  Condition="'$(NMakeBuildCommandLine)'!=''"/>
   
 <VCMessage Code="MSB8005" Type="Warning" Arguments="NMakeReBuildCommandLine" Condition="'$(NMakeReBuildCommandLine)'=='' and ('$(NMakeCleanCommandLine)'=='' or '$(NMakeBuildCommandLine)'=='')"/>
 <Exec Command="$(NMakeReBuildCommandLine)" Condition="'$(NMakeReBuildCommandLine)'!=''"/>
 <Exec Command="$(NMakeCleanCommandLine)" Condition="'$(NMakeReBuildCommandLine)'=='' and '$(NMakeCleanCommandLine)'!='' and '$(NMakeBuildCommandLine)'!=''" />
 <Exec Command="$(NMakeBuildCommandLine)" Condition="'$(NMakeReBuildCommandLine)'=='' and '$(NMakeCleanCommandLine)'!='' and '$(NMakeBuildCommandLine)'!=''" />

 <ItemGroup>
   <ProjectReference>
     <Targets>%(Targets);Rebuild</Targets>
   </ProjectReference>
 </ItemGroup>      
   
 <PropertyPageSchema Include="$(VCTargetsPath)$(LangID)\ProjectItemsSchema.xml" />
 <PropertyPageSchema Include="$(VCTargetsPath)$(LangID)\directories.xml" />
 <PropertyPageSchema Include="$(VCTargetsPath)$(LangID)\debugger_*.xml" />
 <PropertyPageSchema Include="$(VCTargetsPath)$(LangID)\nmake.xml" />
 <PropertyPageSchema Include="$(VCTargetsPath)$(LangID)\cl_nmake.xml" >
   <Context>File</Context>
 </PropertyPageSchema>
 
 <!-- project only rules -->
 <PropertyPageSchema Include="$(VCTargetsPath)$(LangID)\general_makefile.xml">
   <Context>Project</Context>
 </PropertyPageSchema>
 
 <!-- Property sheet only rules -->
 <PropertyPageSchema Include="$(VCTargetsPath)$(LangID)\general_makefile_ps.xml;$(VCTargetsPath)$(LangID)\usermacros.xml">
   <Context>PropertySheet</Context>
 </PropertyPageSchema>
 
 <!-- File only rules -->
 <PropertyPageSchema Include="$(VCTargetsPath)$(LangID)\general_file.xml">
   <Context>File</Context>
 </PropertyPageSchema>    
   
 <AppTypeMakefileTarget Condition="'$(AppTypeMakefileTarget)' == ''">$(VCTargetsPath)\Application Type\$(ApplicationType)\$(ApplicationTypeRevision)\$(ApplicationType).Makefile.Targets</AppTypeMakefileTarget>


Product Version: UE 4.13
Tags:
more ▼

asked Oct 03 '16 at 10:22 PM in C++ Programming

avatar image

nac5678
1 1 4

avatar image Mastersmith98 Oct 04 '16 at 05:18 AM

This might be part of your problem:

This: //Calculate health funtion UFUNCTION(BlueprintCallable, Category = "BaseCharacter") ABaseCharacter(); virtual void CalculateHealth(float delta);

Should be: ABaseCharacter();

  //Calculate health funtion
  UFUNCTION(BlueprintCallable, Category = "BaseCharacter")
  virtual void CalculateHealth(float delta);

As you shouldn't make a constructor a UFUNCTION. Also, I have no ideal what the XML stuff is at the end of your post. Could you specify what errors your getting as well?

avatar image ImVawx ♦♦ STAFF Oct 04 '16 at 01:11 PM

Can you post what problem you are having? The error you having or the issue you are trying to solve.

Thanks

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

As Mastersmith98 has pointed out, on line 27 of your header, you have an extraneous ABaseCharacter();

Additionally, you're missing a ";" (semi-colon) on line 43, after declaring BeginPlay(). You need add one after "override".

And lastly, in your CPP, you haven't actually declared the CalculateDead() function, you've just put a comment. So you'll need to put:

 void ABaseCharacter::CalculateDead()

I believe you'll also need to NOT initialize your properties in the Header, but rather move these to your constructor in the CPP. So your constructor would now look like:

 ABaseCharacter::ABaseCharacter()
   : Health( 100.f )
   , isDead( false )
  {
       // Set this character to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
      PrimaryActorTick.bCanEverTick = true;
  
  }
more ▼

answered Oct 07 '16 at 11:03 AM

avatar image

Jawdy
361 2 4 6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Hears the errors I am havingalt text

capture.jpg (772.3 kB)
more ▼

answered Oct 04 '16 at 07:49 PM

avatar image

nac5678
1 1 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Can someone just send me a finished version of the visual studio file

more ▼

answered Oct 09 '16 at 02:25 AM

avatar image

nac5678
1 1 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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