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"

Pushing function in c++ to blueprints

I am new to c++ and wanted to learn how to make my AI better so I followed this tutorial: link text

I got to the bit about overriding the function in blueprints after the character and realised that I made a mistake in my code as I couldn't find the function I defined in c++ anywhere in the list of overridable functions. I can't find the mistake as I am so new to c++ and hope that someone can. I didn't do the AI controller part as I prefer altering those settings in blueprints and it said that it was optional to do that step I know that it is a lot of code to look through but I would really appreciate it if someone could help me find the problem even if that is to link me to another question with the same problem.

 // Fill out your copyright notice in the Description page of Project Settings.
     #This is for AICharacter.h
     #pragma once

 #include "CoreMinimal.h"
 #include "GameFramework/Character.h"
 #include "AIChar.generated.h"
 class MYPROJECT4_API AAIChar : public ACharacter
     // Sets default values for this character's properties
     UFUNCTION(BlueprintNativeEvent, Category = "AIVariables | Character")
         void GetPerceptionLocRot(FVector &OutLocation, FRotator &OutRotation) const;
         void GetPerceptionLocRot_Implementation(FVector &OutLocation, FRotator &OutRotation) const;
     // Called when the game starts or when spawned
     virtual void BeginPlay() override;
     // Called every frame
     virtual void Tick(float DeltaTime) override;
     // Called to bind functionality to input
     virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
     virtual void GetActorEyesViewPoint(FVector &Location, FRotator & Rotation) const override;
 #And this is for the AICharacter.cpp
 // Fill out your copyright notice in the Description page of Project Settings.
 #include "AIChar.h"
 // Sets default values
      // 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 AAIChar::BeginPlay()
 // Called every frame
 void AAIChar::Tick(float DeltaTime)
 // Called to bind functionality to input
 void AAIChar::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
 void AAIChar::GetActorEyesViewPoint(FVector &Location, FRotator &Rotation) const
     GetPerceptionLocRot(Location, Rotation);
 void AAIChar::GetPerceptionLocRot_Implementation(FVector &OutLocation, FRotator &OutRotation) const;
     OutLocation = GetActorLocation() + FVector(0, 0, 50);
     OutRotation = GetActorRotation();

Many Thanks

Product Version: UE 4.19
more ▼

asked Apr 14 '18 at 04:00 PM in C++ Programming

avatar image

7 3 5 11

avatar image MrMcKvarz Apr 14 '18 at 08:26 PM

You don't need to declare implementation function, UFUNCTION macros do that for you. Also, check if your BP inherits from correct class.

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

0 answers: sort voted first
Be the first one to answer this question
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