So I have 2 blueprints
1 called spell, with lot of floats such as damage, cost, range…etc
another one. called my character, who needs to have a spell and depending on the spell it will have some different properties.
so what I’m doing is creating a “Spell_C” variable inside the mycharacter. and then I try to set the damage
what happen is that I get the error that says "Accessed none ‘spellQ’ from node Set Damage in blueprint MyCharacter.
I already read about it, and I know is because I don’t have my variable initialized. that’s pretty obvious, but I just don’t know how to initialize my variable so I can use it.
Anybody can help me with this?
thanks very much.
Yeah. I already said it. It’s not initialized for sure. and if I use isValid it always go to false.
Thing is, how can I Initialize SpellQ?
October 16, 2014, 12:17pm
Spell Q is probably not initialised, try using an isValid check to make sure there’s something there.
October 16, 2014, 12:39pm
Same way as any other variable, you set it. If this Spell Q thing is a pointer to an instance you need to spawn the instance first, then assign it to your variable.
October 16, 2014, 12:58pm
Is your SpellQ_C a c++ class? and is it exposed to blueprints?
I think its best to do everything in either c++ or blueprints, and try to avoid making a class that needs both, that said there are definitly times when you need to expose a c++ function for access in BP, but for character stuff like what your doing, your probably better off creating the SpellQ class in BP instead.
and how can I spawn the instance first? could you show it to me? I’m just starting with this blueprint stuff and I’m a bit lost.
Thanks for your quick answer!
Both. SpellQ and MyCharacter are Blueprints. I didn’t touch any code yet tho I started using C++ 3 person code template.
SpellQ_C is the type I created the variable in MyCharacter, because is the only one that allows me to access to the functions and variables my Spell Blueprint has.
October 16, 2014, 2:09pm
Are you familiar with casting? It allows your blueprints to “talk” to each other. Here is a video example:
Now that UE4 has been out for a few weeks, it seemed a good time to do another round of quick Blueprint tutorials! I want to try and address some common difficulties, and introduce a couple of handy features. Let’s go!
(You will want to look at the video called “GETTING CLASS BLUEPRINTS TO TALK”)
I hope this works for you.
October 16, 2014, 2:12pm
Try Spawn Actor, and put the result into your SpellQ variable before its used.
thanks all for the quick response!
Actually the tutorial helped me to understand a few things that I didn’t have understand properly. so thank you very much for that!!
Althought that didn’t solve my problem because I wanted to do that with the blueprint script itself.
Try Spawn Actor, and put the result
into your SpellQ variable before its
That actually was the solution I was trying to find!
In case anyone find the same problem. that’s how I solved it