
What is the difference between the two
You’re right, with this code, it makes no difference. The crucial word is
The whole point of BPIs is you don’t need to know the class to make the call. If the actor handles the event, then calling it was a good idea, otherwise, it doesn’t matter.
So, with BPIs we are always calling on an ‘actor’, not a particular class
A classic example is an ‘interact’ BPI. If you’re using casting, you have to laboriously reach into each blueprint and call the right custom event. Not to mention this may include doors, guns, spaceships, lights etc. You really want to try and code all that? ( I don’t think it’s possible ).
With a BPI, you can just say ‘interact’ to the door/gun/spaceship/light, and it opens/fires/takes off/turns on.
You’re still using class in your example.
Think about the door / gun example. Using the object can have many different meanings.
With a BPI you don’t need to know what the object is, you can just say ‘use’.
Imagine I’m walking around the world using a line trace to talk to any object I see. The result of the line trace is an actor reference. Using your method, I have to try casting the EVERY kind of actor in my game, trying to figure out how to use it. With BPI, I can just say ‘use’…
HI, sorry, I still don’t understand, although I know how to use the interface, but why to use it, I still only have a vague idea, I will find more tutorials to try to understand the interface.
Ask me now It will save you A LOT of time. There’s a lot of bad tuuts out there.
Tell me what you don’t get
How do you use things in your game? Line trace, overlap?..
I listened to your comments from the previous post and removed the gameinstance from the save system and only used it for lighting changes. The game is a story game, when I walk into the trigger box, I will get the actorofclss second trigger box, set the boolean value in the second trigger box, so as to decide whether this second trigger box can be triggered, when I walk into the second trigger box, yes, will getactorofclss third trigger box, set the boolean value in the third trigger box, so as to decide whether this third trigger box can be triggered, and so on, right? Please let me know if there is an error.
Can you describe what is happening in the game/story? Why 3 trigger boxes? What does it mean? - thanks
Are the trigger boxes parts of the story that has/hasn’t happened yet?
And you have to remember ( save ) which boxes have been activated, then you know how far along the story is?
Ok, I sort of get what you’re saying.
Why you’re having a problem, is you have written code for each box. You only need code for one box
I will ( try ) to show how
Write your ONE box like this ( or similar )
Notice how all the variables I need can be set when I put the box in the map
I can put 3 boxes in the map and set the variables, so each box has it’s own sound/widget etc and already points to the next box
See, I’ve set box 1 knows which box to set ready next.
Is it making sense?
I really enjoy talking to you, not talking to you, I’ve probably been stuck getting actors of class, thank you for being willing to talk to me.
In this case, with the boxes, you don’t need interfaces. This may be why you don’t get it, because it’s not needed yet.
( see example code above ).
ALSO: If you write the code in the box to save the game and load the game. Automatically, EVERY box knows how to save and load itself. You don’t have to manage that, at all…
So it can still be used like this? It’s like magic, I learned, thank you very much.
Yes, I just made a test example. It’s fine…
You can even make the widget general, and just set the text on the box instance. I have done this ( only short sounds, so the next box is ready quickly… )
Maybe this video here helps you to understand a little bit better, why you should use Interfaces in some cases over casting. It explains and shows when it makes sense to use one or the other:
some helpful articles
Sorry for the late reply, I’m busy modifying my own save system,thank you for the show
Sorry for the late reply, I’m busy modifying my own save system, the link you gave, I have bookmarked, will look at it later.
Sorry for the late reply, I’m busy modifying my own save system, the information you gave, I have bookmarked, will look at it later.