So I’ve made the beginnings of a paper-2D game and have managed to create an item (actor) that acts as a pick-up to transform my character (Swap the Pawn) but when I activate it (begin collision with the item) the Pawn swaps and the screen simultaneously goes dark and if I move at all I clip through the floor and float off into the void.
The blueprint I made doesn’t interact with lighting at all and whilst constructing the blueprint (in an earlier stage when I made the new pawn spawn but didn’t possess it) nothing like this happened.
I’m not expecting an answer to my whole problem but I literally don’t know how to start, any help would be appreciated, thanks.
You don’t need to cast to child classes, if you use functions implemented in parent classes. Also you should avoid using the GetActorOfClass node, try the following code.
Tell me if this helps.
Hi, I tried using the blueprint as you suggested and nothing happens, I realised that’s because there is no event/trigger for the ‘spawn’, where before I have the Collision as the event, I tried using the same collision event as above to trigger the spawn and an error occurred reading: Spawn node SpawnActor NONE must have a Class specified.
I went back to my original code but cut out the ‘GetActorOfClass’ node like you suggested, pulling ‘FRanma’ from the spawn return value to the Cast instead and this returned an identical result to previously (my pawn floating in the void) but this time gave me Runtime errors:
1 - Blueprint Runtime Error: “Accessed None trying to read property MRanma”. Blueprint: Snowflake Function: Execute Ubergraph Snowflake Graph: EventGraph Node: SpawnActor FRanma
2 - Blueprint Runtime Error: “Accessed None trying to read property CallFunc_K2_GetRootComponent_ReturnValue”. Blueprint: Snowflake Function: Execute Ubergraph Snowflake Graph: EventGraph Node: SpawnActor FRanma
3 - Blueprint Runtime Error: “Accessed None trying to read property MRanma”. Blueprint: Snowflake Function: Execute Ubergraph Snowflake Graph: EventGraph Node: SpawnActor FRanma
4 - Blueprint Runtime Error: “Accessed None trying to read property CallFunc_K2_GetRootComponent_ReturnValue”. Blueprint: Snowflake Function: Execute Ubergraph Snowflake Graph: EventGraph Node: SpawnActor FRanma
Which I don’t really understand either.
Thanks for your help btw
Yeah, sorry. I thought you would insert my altered code into your graph. I can’t select “FRanma”, because I don’t have it, so you should select that. You should also plug the transformation in the way you did in your own graph. Keep me updated if there is still some confusion.
Ah! Error log. This is good. I believe you have never set the variable “MRamna”.
Try getting the MRanma from the cast node and attach it to a “GetActorLocation” and attach this to the spawn transform.
Glad to help.
I’ve done that now and I got the results in the comment below, the Runtime errors and the original problem persisting
We are constantly ninja’ing each other. haha. Let’s stick to the comment thread below.
That did remove the errors but the problem persists, I’m not sure it even necessarily is the blueprint but I’m not sure what other problems there could be?
can you send me another picture of your graph? just to double check?
Using the PrintString node you can read a lot of information during run-time. This enables you to check whether the locations match.
EDIT: you don’t need the FRanma cast node.
Ah, I think you might have found the issue, it seems to Spawn FRanma misaligned with the 2D plane… not sure why though, not sure how to fix it either.
(the plane is at ~513, FRanma spawns at ~544
Split the vector by right-clicking on the output, do the same for the transform (and the vector contained in the transform). set the plane-axis value to 513 manually, then plug in the 2 remaining floats in their respective axis. If this solves the issue, let me know.
Now it appears to spawn me in the correct location, which I can tell due to the alignment with the pick-up around the silhouette of my pawn (see picture) but everything still goes dark as if it’s unlit and my character appears to be stuck in place, I can turn left and right so inputs work but I seem to be stopped by something from actually moving.
(fyi I filled the black of the screen with grey for clarity)
How very odd. I am not sure what happens there. Everything beyond this point is only guessing work on my part without source code.
You can connect the following to the beginning (right after the first CastTo Node), and another set of these nodes to the end of your overlap graph, and check the actors you want to check the movement of. (e.g. the light source you use) Check one actor class at a time. You can do the same thing for the rotations too.
EDIT: Don’t forget to remove the PrintString nodes when you don’t need them anymore. Otherwise your screen will overflow with text.