I’m trying to make a level where there is a moving platform (circled in blue) that can be respawned using the box trigger (circled in red), but I don’t want it to be spammed so that the player can make infinite platforms. I want to that whenever you press the button, you need to wait at least 20 seconds before pressing it again. How would I do that?
In a blueprint with a static mesh component, create a custom event, I called my one SpawnFloor.
In the blueprint, you need a FloorMesh variable with the mesh of the floor you want to use, and a CanSpawn? boolean variable.
In your level blueprint, you want a reference to the floor blueprint that is placed in your level and call the custom SpawnFloor function.
Remember you need to have a floor referenced inside of your level blueprint floor variable, you can do that by clicking on the eyedropper icon beside the variable’s value on the right.
If you need me to explain anything else just say, and if my answer was what you were looking for I would appreciate it if you marked my answer as correct by clicking the small tick symbol to the left of the answer beside the arrows. Thanks a lot!
I am unsure of why you are getting this error. The floor mesh is the actual mesh you want to use for the floor, it is a static mesh variable that you set inside your blueprint.
If this is in the level blueprint then you need to make sure you have a reference inside of your level blueprints FloorBP value. Click on the variable and beside the value it has, there should be an eyedropper icon, click it and click on the floor blueprint inside of your level.
Ok if you have done that then go into your Floor blueprint and make sure it has a static mesh set as a value inside of the FloorMesh variable.
I did do that, except whenever I walk over the box trigger, nothing spawns
Alright I put a cube as a static mesh in the Default value
It is not giving me any errors but nothing spawns
I don’t know how to use the Print String function
Ah good finally something spawns, but now I need it to be the moving platform
No but you saw the original screenshot, I already made the platform, all I needed was a delay for the player to not spam the spawn trigger
Well, not really, I know how to spawn a cube, but not how to spawn the thing i wanted to spawn in the first place
Can you show what you mean please?
Alright thank you so much, it works
You could also check the collision of the object you are using to trigger the trigger box. Make sure that it has generate overlap events set to true.
Is it giving you errors or is it still not appearing? Remember you can always check if code is firing by using the print string function, just connect it to wherever you want to debug and it will print a string to the screen if a signal has gone through it.