Copy a blueprint with unique references
Hello guys and gals, i have a really annoying problem with some pretty basic blueprinting, but my brain is drawing a complete blank, so i hope someone here can give me quick rundown of what i am doing wrong!
I have created blueprints for seperate objects that store points and damage (in some cases), i thought i could simply drag and drop the blueprint into the level to have the same behaviour manifest for each of them (feel like i have done that before)
But it seems like it does not like referencing a spesific object, or in other words,
If i roll over a copy of my 50point sphere, it only affects the original (hides the actor and respawns in a while, while the copy does nothing)
I really like the effect the current setup is giving me, so if there is a way to copy this blueprint around, that would be awesome!
I am guessing i have either forgotten something vital, or done something really stupid.. Please help me out if you can :')
Thanks in advance
asked Feb 03 '19 at 07:33 PM in Blueprint Scripting
your script here is showing the level bp which references specific actors in the level. so if you want a overlap event for each of the points gold you would need to create the script for each one. obviously this is not a good way to do things. it would be much better to implement the script in the pointsgold actor itself, so then when you copy the actor it will already have the functionality it needs.
below is an example of how you should implement your actor. basically create your pickup actor (goldPickup in my case), then add the needed components (mesh and such). then for the script you just need to make things in a way where you dont need to reference specific actors but rather classes. so on overlap we first check to make sure the object is visible as per your script. then we see if the overlapping actor is of the players class by casting to identify it, this could also be done using the get player character node and the ==(equal) node. then since we have a reference to the character we can get the values stored within it, which also means we can add to the coins variable or whatever else you want to do.
doing things this way allows you to create as many of the coin spawns as you like and you never have to recreate the script or reference a specific actor in the level. its much easier, simpler, and performant.
answered Feb 03 '19 at 08:10 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here