So obviously im super new to this but thank GOD for blueprints!
What im trying to do in my fps game, is to go over an item thats on the floor, use a function on it, and then delete the actor. My function currently runs in my char BP, i activate it when im in the item’s box collision with a key input, runs a widget, then the function - which is to add the item to my “inventory” - but then im stuck at deleteing it.
I only managed to delete all the actors from its class once, not one specific one.
I’ve tried to assign a boolean to the item at the end of the function but the casting doesnt work (or im using it wrong).
Then use this boolean to mark the item as “used” and then substract that boolean from “get all actors from class”.
5 hours later im still here… with a bunch of my hair in my fists
Pls halp!?
Also, btw, im using the Source Editor 4.18.2 so i can build a dedicated server out of this.
yes, yes of course, thats how i managed to delete all the actors, by using the destroy actor node. I dont even know another way of doing it
My problem being that i have to destroy the actor while the boolean that would control the node, to delete ONLY that actor, not a whole class, is in another blueprint and i cant seem to make them connect even after all the blueprint communication tutorials i read.
So, my problem with the reference is that everytime i call for the object, which is itemVolume in here, i don’t know if im calling it correctly. and when i do it just doesnt work. If i call destroyActor i just destroy the characterBP which employs the function.
1st pic is the graph for my characterBP which is named SwatCharacterBP.
2nd pic is the graph for the function it runs when i press a key, to “add an item”
3rd is the graph for the itemVolume (the item with the problem)
In your characterBP add a variable of type itemVolume now when you overlap just set the ItemVolume to self (just like you did with InUseRange and Used) and when you use the item you can drag a pin from the variable you added in call destroy.
thanks for the reply. i’ve been trying for the past 2 hours with no luck.
so i made the “itemVolume” variable type, obj reference in the charBP right?
then i dont know how to give it an actual value of any kind so i can call it back.
i add the destroy function and the variable but it gives me a blueprint error and tells me that the value for the variable is null. which kinda makes sense, since it holds no info?
pic 1 is the charBP and the second is itemVolumeBP
SWEET BABY JESUS! Thaaaaank you ! you;re like my favourite person right now!
Thanks a lot man didnt know about this “self” thing…
so yeah… some 7 hrs later its done
cheers
No problem, also just a tip the “Other Actor” in the ActorBeginOverlap event is the actor that overlapped the volume so it should be your character you should drag a pin from that and cast to SwatCharacter instead of calling GetPlayerCharacter this is useful if you have multiple players.
Other than that glad I could help