Hello Everybody, and thanks in advance for the help.
I’m writing a puzzle game, as a portfolio and exercise for learning. On the path to the solution, there are some “spheres” (teleports) for choosing a path and attempting to exit. Every Sphere is colored and when u choose (for ex) a red sphere, u get teleported to his twin red teleport exit in a part of the map. It’s a memory game, u can memorize the colors of dead paths and in the end find the escape.
For being more efficient in level creation, I created a BP with of the sphere (BP_TeleportSphere), with editable vars (number , entrance/exit, and Color to assign material). The whole of these 3 variables are recalled enum and the vars are editable (i know I could use array but I did not arrive to that point), so when I place them (spheres) into the map, I can just modify editable variables, and let the engine do the rest (the idea sound good but…)
Where’s the problem:
I don’t know how to Set the name of instance (_self) to the object inside the BP_TeleportSphere at BeginPlay (or Construction script), and I do not know how to set into a var the name of the target where to “worldTransform” cause I do not find right way to pass a string into “object value”.
How to set “name” to instance (object) passing a string (i know how to build the right string)
How to find world coords (transform) of sphere destination without intercept her (i could put vector data into var, but I don’t know how to find it inside BP_thirdPersonCharacter)
Extra (not necessary) how to change “Base color” to material instance (if possible) I had to create a lot of “set material” in a Macro, because I cannot pass the name of the material to “set material” and I cannot change Base Color).
Do you think you could get us some pictures of your blueprint code? I’m not really having an easy time understanding what it is you’re needing. Do you NEED the names? Or do you just need to reference a specific object?
I hope it’s more clear now
Working in this way, i have just to Design the paths (evalutating the solutions) and then, assign to balls exact variables for make it work, and Engine do the rest.
I’ve and extra Bonus achieve, I created a macro that uses a switch case to assign a material to the spheres based on the colorEditableVar. Just in this way, I created a material for each colour and a made multiple ‘setMaterial’ for each case using a switch. I’d like to assign an editable vector variable to color(editable) and send it at the end of the “BeginEvent” directly to the “BaseColor” of the material, modifying it only within the instance, but I’m afraid that doing so will change the “material” and thus all the colours of the existing spheres.
maybe this issue could be less severe using “arrays” but, even if I have a base of OOP, 3D Modelation, Music, and Video, I’m new at bluePrints, and I’m proceeding per step, cause BluePrints are a very great fast way to program, but they are organized differently, and I need to digest this new way before to tackle a more complex organization.
In the awaiting for some replies, I was watching some posts in this forum, and i found something interesting. TAGS, they could be a solution? they are the right one? or there’s better way to proceed?
I assign to BP sphere the editable var i set in the “level Editor”. ExitSphere is the corresponding ball of a entrance version (i store this value in the “ExitBallName”)
.
.
I built the name of the exit ball. I will use it after as “Tag” for intercept spatial position
(i know, is a bad usage of MACRO, but i’m a beginner this make my “EventGraph main window” more clear
.
.
If BP type is EN value (EN mean entrance) if this is true, i just go fwd. If this condition is false, it means this is an exit, in this case i apply the tag (i dont know if my steps are fine, or i could save some steps and do it differently).
.
.
Here the last ISSUE, clearly this blueprint is working, but he’s not efficient and or clean. I would add another editable variable to the list, use it to pass his value directly to the “Base Color” parameter of material assigned. (if this change just this instance and not all the instances contain same material in map).
.
.
On Event Overlap (sphere overlapped by ThirdPersonCharacter) i check if the ball is an ENTRANCE, if false, i send message to UI (i will build it after), if true i search all instances with tag “my ball name” (just 1 ball has that tag, cause they are unique), i get the name, I pass the name to GetWorldTransform to get the spatial position, and calling a function “CharacterTeleport” passing “transformation” and run it as a function in “BP_thirdPersonCharacter” that bring BP to that position.
.
.