I’m inside a blueprint called “zombieBP” and I need to access information from a blueprint called “MusketActor” which has parent called WeaponBase. WeaponBase has information such as: damage, currentAmmor, maxAmmo, etc. I need the information “damage”, for that I’m using “Cast to WeaponBase” as below:
Which results in “cast failed” and the errors printed. Where “Boneco BP” is my character blueprint and inside is “MusketActor”.
Which is weird because the code below works fine (which to me looks like the same thing, but where it works is a widget blueprint inside a function, and where it not works is a blueprint class inside event graph)
I might be wrong, but it seems to me that there may be some mistake on how you’re setting the variable “As Boneco BP”. Compare the way you are setting it in the working blueprint with how you’re setting it in the faulty one.
I tried creating “boneco bp ref” again in the working blueprint. I tried: create variable, name it “boneco bp ref 2” change variable type to “Boneco BP”. This way does not work. I don’t know how the working blueprint is working.
to me it seems the both variables, “boneco bp (working)” and “boneco bp (not working)” are the same, except one works and the other doesn’t. How do I see their differences?
I don’t know if thats the answer you want, but for the not working I did: in the variables tab I added another variable, named it “boneco bp not working” change the variable type to “Boneco BP”. I don’t remember how the working one was created. I think the working one was created this way:
Yeah, calling it on “Construct” means that this code is running when this object is being instantiated in the world, and you can’t guarantee the order most of your custom actors will be created. For the non-working BP, “BonecoBP” had not yet been created when it was running its construct, so the value of “As Boneco BP” was null.