Is there a function that instead of "Is in Attack Range Of Player"node?
I'm learning UE4(and C++) through the book "Learning.C++.by.Creating.Games.with.UE4.2015". The book is about UE4.6(or someother version,I'm not sure). My version is 4.10. So there are some compatible promblem.
void AMonster:: SwordSwung()//A function that will be invoked in a blueprints node
if(MeleeWeapon) //MeleeWeapon is definition in AMonster as follows"AActor* MeleeWeapon;"
I'm search for the solution in many place. But still don't get the point. This really made me depressed. Hope this time will help! Thanks for everyone for reading here.
asked May 28 '16 at 12:38 PM in Using UE4
Thats a expected error.
You have a AActor pointer that should be your Sword. Problems is AActor does not know how to Swing a Sword because the Code inside AActor does not have a Swing() Function.
You can create a class that inherits from AActor say AWeapon and than you can teach this class how to Swing() and istead of pointing to a AActor* you would use AWeapon* (This can point to any weapon or children of AWeapon)
But if you want to use a AActor* and you know you refference a AWeapon Object in there you first have to check if it really is AWeapon or something completly else that inherits from AActor. The only thing your Code know right now is that it can do what a AActor can do.
Here is how you would check if its pointing to a specific Child Type its called Casting.
answered May 28 '16 at 02:13 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here