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"

C++ BTService disappears in Behavior tree after reopening editor?

Hello! Soo I created a custom C++ BTService, but for some reason, it keeps removing itself from the editor after restarting it?

Once compiled:

Before

and here's after restarting the editor

After

I've also attached my code i have currently as well

DetectEnemy_Crawler.h

 // Fill out your copyright notice in the Description page of Project Settings.
 
 #pragma once
 
 #include "BehaviorTree/Services/BTService_BlackboardBase.h"
 #include "DetectEnemy_Crawler.generated.h"
 
 /**
  * 
  */
 UCLASS()
 class TEST_API UDetectEnemy_Crawler : public UBTService_BlackboardBase
 {
     GENERATED_BODY()
 
 public:
 
     UDetectEnemy_Crawler();
     
     virtual void TickNode(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, float DeltaSeconds) override;
     
 };


DetectEnemy_Crawler.cpp

 // Fill out your copyright notice in the Description page of Project Settings.
 
 #include "Test.h"
 #include "BehaviorTree/BehaviorTreeComponent.h"
 #include "BehaviorTree/BlackboardComponent.h"
 #include "BehaviorTree/Blackboard/BlackboardKeyAllTypes.h"
 #include "CrawlerController.h"
 #include "Crawler.h"
 #include "DetectEnemy_Crawler.h"
 
 
 UDetectEnemy_Crawler::UDetectEnemy_Crawler()
 {
     bCreateNodeInstance = true;
 }
 
 
 void UDetectEnemy_Crawler::TickNode(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, float DeltaSeconds)
 {
     Super::TickNode(OwnerComp, NodeMemory, DeltaSeconds);
 
     ACrawlerController *CC = Cast<ACrawlerController>(OwnerComp.GetAIOwner());
     if (CC != NULL)
     {
         ATargetPoint* Waypoint = Cast<ATargetPoint>(OwnerComp.GetBlackboardComponent()->GetValue<UBlackboardKeyType_Object>(CC->WaypointID));
         if (Waypoint)
         {
             GEngine->AddOnScreenDebugMessage(-1, 2.f, FColor::Red, "Found!");
         }
     }
 }


Any help would be super :(! such a strange thing to happen here

Product Version: UE 4.11
Tags:
more ▼

asked Apr 27 '16 at 08:07 AM in C++ Programming

avatar image

CHADALAK1
128 25 24 30

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

1 answer: sort voted first

Ok soooo, I think i found my workaround. Soo I created a new Service through BP. Went to Class Settings and found the DetectEnemy_Crawler service. I applied that and it works!

alt text

However, I was curious if there was still away to still have it call through C++ and not having to create a BP object? If not, then I will stick to this method and consider this issue solved

more ▼

answered Apr 27 '16 at 08:36 AM

avatar image

CHADALAK1
128 25 24 30

(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