Download

Need Help with making a C++ Base Character Class

I am following the video Tutorial Twin Stick Shooter. I am totally new to UE4 or any other game development software. Any way I am following the tutorial instructions exactly. from the first video. when I get to Making the C++ Base Character Class, I typed the code line by line the way the tutorial’s instructions when i build it I get I get a bunch of errors the main one is MSB3073. I googled this error and find that I do not have the authorization to be doing what I am doing so I am denied. How can fix this.

 Error	1	error code: OtherCompilationError (5)	C:\Users\Russell1\Documents\Unreal Projects\TwinStickShooter\Intermediate\ProjectFiles\Error	TwinStickShooter


 Error	2	error MSB3073: The command ""C:\Program Files\Epic Games\4.9\Engine\Build\BatchFiles\Build.bat" TwinStickShooterEditor Win64 Development "C:\Users\Russell1\Documents\Unreal Projects\TwinStickShooter\TwinStickShooter.uproject" -rocket -waitmutex" exited with code -1.	C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets	38	5	TwinStickShooter

Can you show as the code and maybe, if there is more, the whole log? (:

Error 1 error code: OtherCompilationError (5) C:\Users\Russell1\Documents\Unreal Projects\TwinStickShooter\Intermediate\ProjectFiles\Error TwinStickShooter
8 IntelliSense: expected an expression c:\Users\Russell1\Documents\Unreal Projects\TwinStickShooter\Source\TwinStickShooter\BaseCharacter.cpp 49 1 TwinStickShooter
5 IntelliSense: identifier “Health” is undefined c:\Users\Russell1\Documents\Unreal Projects\TwinStickShooter\Source\TwinStickShooter\BaseCharacter.cpp 39 2 TwinStickShooter
6 IntelliSense: identifier “calculateDead” is undefined c:\Users\Russell1\Documents\Unreal Projects\TwinStickShooter\Source\TwinStickShooter\BaseCharacter.cpp 40 3 TwinStickShooter
9 IntelliSense: expected a ‘;’ c:\Users\Russell1\Documents\Unreal Projects\TwinStickShooter\Source\TwinStickShooter\BaseCharacter.h 20 3 TwinStickShooter
10 IntelliSense: this declaration has no storage class or type specifier c:\Users\Russell1\Documents\Unreal Projects\TwinStickShooter\Source\TwinStickShooter\BaseCharacter.h 25 3 TwinStickShooter
Error 2 error MSB3073: The command ““C:\Program Files\Epic Games\4.9\Engine\Build\BatchFiles\Build.bat” TwinStickShooterEditor Win64 Development “C:\Users\Russell1\Documents\Unreal Projects\TwinStickShooter\TwinStickShooter.uproject” -rocket -waitmutex” exited with code -1. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets 38 5 TwinStickShooter
7 IntelliSense: expected a ‘(’ c:\Users\Russell1\Documents\Unreal Projects\TwinStickShooter\Source\TwinStickShooter\BaseCharacter.cpp 45 5 TwinStickShooter
11 IntelliSense: expected a ‘;’ c:\Users\Russell1\Documents\Unreal Projects\TwinStickShooter\Source\TwinStickShooter\BaseCharacter.h 25 11 TwinStickShooter
3 IntelliSense: no instance of overloaded function “ABaseCharacter::ABaseCharacter” matches the specified type c:\Users\Russell1\Documents\Unreal Projects\TwinStickShooter\Source\TwinStickShooter\BaseCharacter.cpp 8 17 TwinStickShooter
4 IntelliSense: class “ABaseCharacter” has no member “CalculateHealth” c:\Users\Russell1\Documents\Unreal Projects\TwinStickShooter\Source\TwinStickShooter\BaseCharacter.cpp 37 22 TwinStickShooter

Is this what you need? I do not know that much about this.

I checked the code and found several typos.I corrected them and now only 2 errors remain.

Error 1 error code: OtherCompilationError (5) C:\Users\Russell1\Documents\Unreal Projects\TwinStickShooter\Intermediate\ProjectFiles\Error TwinStickShooter
Error 2 error MSB3073: The command ““C:\Program Files\Epic Games\4.9\Engine\Build\BatchFiles\Build.bat” TwinStickShooterEditor Win64 Development “C:\Users\Russell1\Documents\Unreal Projects\TwinStickShooter\TwinStickShooter.uproject” -rocket -waitmutex” exited with code -1. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets 38 5 TwinStickShooter

the BaseCharacter.h code is

// 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:

// Makea health Property
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "BaseCharacter")
	float Health = 100;
	// Make an isDead property
	UPROPERTY(BlueprintReadOly, VisibleAnwhere, Category = "baseCharacter")
	bool isDead = false;
// Calculate death function (helper)
virtual void CalculateDead();
//Calculate health function
UFUNCTION(BlueprintCallable, Category = "BaseCharacter")
	virtual void CalculateHealth(float delta);
	//Editor-centric code for changing poperties

#if WHITH_EDITOR
virtual void PostEditChangeProperty(FPpropertyChangedEvent& PropertyChangedEvent) Override;
#endif
// 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;

};

And the code for BaseCharacter.cpp is

// 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);

}

// Implement CalculateHealth Function
void ABaseCharacter::CalculateHealth(float Delta)
{
Health += Delta;
CalculateDead();
}
//Implement CalculateDead Function
void ABaseCharacter::CalculateDead()
{
if (Health <= 0)
isDead = true;
else
isDead = false;
}
#if WHITH_Editer
// Implement Post Edit Change Property
void ABaseCharacter::PostEditChangeProperty(FPropertChangedEvent& PropertyChainded Event)
{
isDead = false;
Health = 100;
Super::PostEditChangeProperty(PropertyChangedEvent);

CalculateDead();

}
#endif