Ok, so I’ve tried to read through all the posts, all the documentation (which the activity level of everything is part of the reason why I bought able) and maybe I missed something but, what would be the best way to have an ability spawn at the current mouse position? (Think flamestrike from WoW?)
, this plug in is by far the very best i’ve bought. Thank you for all of the time you saved me!
Thanks for the kind words.
For something like that, you’d need to write some code that does a raytrace to the world using the mouse position (pretty sure there’s a method for that somewhere in UE4), and then you could spawn some invisible dummy actor that just plays the Ability.
That’s probably the easiest way.
spawning the invisible actor is what I was going to try to do, it was the threadsafe getting of the mouse position that I ran into a snafu with. I can do it in a regular blueprint so I’ll see what I can come up with.
yes… please. using montages for abilities is essential. as montages can have additional level of complexity and can be made with more then one animation, have internal loops etc.
Also I had problems with detecting “ability use animation” and “is playing animation” inside the anim graph.
Hello,
I’m trying to create a blueprint function library to apply a passive ability for status effects. In C++ I already created my function that decides whether or not the proc occured, but in order to avoid having to strictly say where the blueprint ability is located, I made another proc function in blueprint that branches out depending on what tag (fire, ice, poison, etc.) was applied and gives the target actor that passive ability. Unfortunately, in the “CalculateDamageForActor” function (or anywhere that derives from any able ability) my function does not show up. The C++ blueprint function library one does, but the blueprint-only function library one does not, even though it shows up everywhere else in the editor that’s not Able-related.
How should I be handling this? Is there any way of applying my passive status effects from within C++ without having to set the Ability’s physical location? I’m using GameplayTags if that helps.
Thanks!
Sorry for bothering you again, but how exactly do stacks work? I have a passive burn ability and if it’s triggered twice I want it to last twice as long (loop twice the number of iterations). I tried enabling stacks and messing with the settings but I couldn’t get it to work. Thanks again!
Hey again,
How do I go about deactivating an ability? I couldn’t find any functions related to it. I tried disabling the component but that didn’t work. When my character dies I want to stop/deactivate all abilities (passives, and the active one); how can I do this?
Thank you!
To be honest, I’ve never dug into Blueprint Function Libraries (I simply make C++ versions). I’m not sure how you would reference one blueprint to a BP library function. Also I’m not sure what you mean by “having to set the Ability’s physical location”.
Right now Stacks have 3 different rules:
- Refresh Duration (resets the Ability time back to 0, effectively playing it again).
- Increase Stack Count (increases an internal counter for that Ability. You can get that value when calculating damage via GetCurrentStackCountForPassiveAbility on the Ability Component).
- Refresh Duration and Increase Stack Count (does both of the previous options).
There is no way to dynamically increase the iterations in a exponential (or whatever) way, if you wanted that you’d need to cancel the current passive Ability and apply a new one with the loop count you want.
I can see about adding a more dynamic loop count that lets you script how many loops you want an Ability to play for. That’s an easy add.
CancelAbility on the Ability Component. You can ask the Ability Component for the Current Active as well as all Passives and just loop through and cancel them all. I’ll make a note to add a “CancelAllPassiveAbilities” or some such to make it a bit easier.
How would I use this as a passive timer that increases hunger over time?
I’m not sure I would. It’s a bit like using a tank to shoot a fly (unless you wants particles and animations tied into that counter). But, if you wanted to you could simply create an infinite looping passive, set the length of the Ability to your tick rate, add logic in OnAbilityStart that gets the SelfActor, casts it to your character class, and then increments your hunger variable.
But again, if it’s something constant like that, I’d likely just make a timer in my Character Blueprint that calls every X seconds/milliseconds and do it that way.
Thanks for the stack explanation! Blueprint Function Libraries in blueprint are the same thing as the C++ ones. After you make the function it’s pretty much accessible within any Blueprint. And in my case it is for all blueprints except Able ones. By the Ability’s physical location I mean having to use FindObject and include the path to the physical Blueprint location in Content. I just made a parent Able class that has the function and it works just fine, so thanks anyways.
I would really appreciate it if you add the dynamic loop count!
Another question if you don’t mind… Something I completely missed was the scaling of particle effects for status damages (burn, poison) depending on the actor’s size. Is there any recommended way of approaching this? Not all burnable actors are the same size, and some are drastically different in size; how can I scale the particle system in the passive ability according to the actor’s size? Thanks again!
You could make a small/medium/large burn ability and choose which one to apply when you go to apply it. You could also just modify the AblPlayParticleEffectTask (or duplicate it and make a AblAutoScalePlayParticleEffect) and have it query table somewhere with the size (or do some simple math) when it goes to scale the particle template.
Honestly, I’d go with the 1st approach - no particle effect is going to be 100% perfect for all body types (even if scaled perfectly), so breaking it up into simple categories and using a “best fit” approach is probably the best.
I might end up going with the first approach, but the second approach sounds a bit cleaner to me so I want to try to it out (might even do both). I created the C++ task and I more or less duplicated the contents of AblPlayParticleEffectTask but I can’t get it to work. I can’t include AbleCorePrivate.h, so I tried moving the logging Macros you set up in it into the task itself but I get compiler errors. Is there a specific way I should approach this? Thanks.
Why are you using my Logging macros? You can use your own if that’s the only thing you’re trying to pull from the AbleCorePrivate.h, otherwise you’ll need to add AbleCore to your PrivateIncludePaths in your .build.cs.
Well I’m not sure how the system works so I just assumed I needed them since they’re referenced a few times in the original AblPlayParticleEffectTask… I added AbleCore to the PrivateIncludePaths and that got rid of most errors, all that I get now is:
Error LNK2019 unresolved external symbol "private: static class UClass * __cdecl UAblParticleEffectParamContextActor::GetPrivateStaticClass(void)" (?GetPrivateStaticClass@UAblParticleEffectParamContextActor@@CAPEAVUClass@@XZ) referenced in function "public: virtual void __cdecl UAblPlayParticleEffectAutoScaled::OnTaskStart(struct TWeakObjectPtr<class UAblAbilityContext const ,struct FWeakObjectPtr> const &)const " (?OnTaskStart@UAblPlayParticleEffectAutoScaled@@UEBAXAEBU?$TWeakObjectPtr@$$CBVUAblAbilityContext@@UFWeakObjectPtr@@@@@Z)
The error happens thanks to this code:
// Set our Parameters.
for (UAblParticleEffectParam* Parameter : m_Parameters)
{
if (Parameter->IsA<UAblParticleEffectParamContextActor>())
{
UAblParticleEffectParamContextActor* ContextActorParam = Cast<UAblParticleEffectParamContextActor>(Parameter);
if (AActor* FoundActor = GetSingleActorFromTargetType(Context, ContextActorParam->GetContextActorType()))
{
SpawnedEffect->SetActorParameter(ContextActorParam->GetParameterName(), FoundActor);
}
}
if (Parameter->IsA<UAblParticleEffectParamLocation>())
{
UAblParticleEffectParamLocation* LocationParam = Cast<UAblParticleEffectParamLocation>(Parameter);
FTransform outTransform;
LocationParam->GetLocation().GetTransform(*Context.Get(), outTransform);
SpawnedEffect->SetVectorParameter(LocationParam->GetParameterName(), outTransform.GetTranslation());
}
}
The error specifically mentions ***UAblParticleEffectParamLocation ***and UAblParticleEffectParamContextActor, any clue what it could be?
Thanks!
I assume those are the classes you added? When you see “GetPrivateStaticClass” that means you likely don’t have the class exported(e.g. class MYGAME_API UMyClass).
I fixed it, thanks!
Hello,
OnAbilityStart() is a BlueprintImplementableEvent; does this mean I can’t override/define it in a C++ ability?
There is a C++ version on the AbilityComponent that is called whenever an Ability is started (FOnAbilityStart). On the Ability itself, there is no C++ version to override. I’m adding that in the next update for people who don’t want to use a Blueprint version (or require some extra work done in C++ before tossing things to BP).
Next update will be out shortly after 4.19 is available.
And you will fix ability anim montage blend?