Download

Calling Events

So, I’m making the switch from C++ to blueprints, and I’m trying to figure out how to call blueprint events.

I have a base class VItem that has an event called ‘Drop’.

But I can’t seem to call that event from a VItem reference!

I must be missing something simple, thanks for any help guys.

Drop is located in Roscoe, so must be accessed from a Roscoe reference, or a child of Roscoe.

Drop is part of VItem, and is overridden by Roscoe (VItem is Roscoe’s Base Class). I can’t call it using a VItem reference? That’s too bad.

What’s the design pattern here? There’s no way i have to have an emum or something of every possible VItem so I can cast it to the proper Blueprint to call its event and that’s all I can think of!

Parent’s can’t call functions from their children, otherwise I’d be able to call any of my existent functions in the Actor class, and that is not how inheritance works.

Could you be more specific? I believe you misunderstand me but without more I can’t correct exactly what the misunderstanding is as I’m not trying to call a child’s function from a parent (or even an event) and at any rate that should absolutely be possible (but maybe not in Blueprints I guess).

I suppose one way to summarize it to be more simple is how can I call an event without knowing exactly what item I’m referring to (only its parent blueprint)? This is trivial in C++ with Virtual methods for example.

The reason for the need for this is that any Weapon can be assigned to the Secondary Weapon variable, so I can’t know beforehand what it is I’m calling the drop event on.

If there is something I’m not being clear about please ask!

EDIT:
I can’t seem to call it even if I cast it to a Roscoe (pretending to know what Item I have).

I should be able to right? So this might suggest that the issue is more to do with how my events are set up or some other fundamental issue.

EDIT 2:
After some testing I have found this to be related to the C++ back-end for VItem and how ‘BlueprintImplementableEvent’ methods do not seem to work like normal custom events it seems. This is more of a C++ issue now.



	UFUNCTION(BlueprintImplementableEvent, Category = "VItem")
	void Drop();


Ok, so the problem was that I did not add BlueprintCallable to the UFUNCTION definition. Oops lol.

Should look like this:



	UFUNCTION(BlueprintImplementableEvent, BlueprintCallable, Category = "VItem")
	void Drop();