So I extended the Ability System component using ai. Header looks like this:
// MyAbilitySystemComponent.h
#pragma once
#include "CoreMinimal.h"
#include "AbilitySystemComponent.h"
#include "MyAbilitySystemComponent.generated.h"
UCLASS(Blueprintable, ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))
class MYPROJECT_API UMyAbilitySystemComponent : public UAbilitySystemComponent
{
GENERATED_BODY()
};
And cpp:
// Fill out your copyright notice in the Description page of Project Settings.
#include "MyAbilitySystemComponent.h"
I made a function in this ASC, that uses the Give Ability node to grant abilities, among other things, and I added the ASC to the player character. This is the function:
The function works if it’s called from the player character, but if I were to get this extended ASC from the player character in some other actor and call this function, it doesn’t grant the ability anymore. Why?
are you casting it to your extended ASC’s BP? I’m assuming so if you’re able to call the function, but just checking. Are you hitting the breakpoints you set or is it just not calling the function?
I’m getting the player character, getting its ASC, and calling this function (which resides in the ASC blueprint). I do this in a different actor blueprint than the player character blueprint.
Yes, the breakpoints are hit. The problem is, the ability is not given, if this function is called in some other blueprint than the player character. Like the Give Ability node doesn’t run or something. The game is only single player. I’m even checking if the actor has authority and it does.
Ok, gotcha. Try doing this console command and checking your logs after calling your GiveAbility function that is failing… all the steps in that function are very well logged, it should let you know the failure point: log LogAbilitySystem verbose