Announcement

Collapse
No announcement yet.

How can i cast to desired blueprint?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    I knew i did it before, I had some brain lag and tried to cast directly to class instead do it the way you showed.
    Thanks works perfectly!

    Leave a comment:


  • replied
    Originally posted by Tafonath View Post
    So I've made SpawnBox custom event inside grid blueprint and now i want to call that event from gamemode BP.

    There are several ways to it.

    1 - In the gamemode, you get the grid reference, using for example, "Get All Actors of Class", get the first element of the array, cast it to PogoPainter_BP. Now that you have a direct reference to the grid, you can directly call "SpawnBox".

    Click image for larger version  Name:	spawn.png Views:	1 Size:	56.3 KB ID:	1462306

    2 - using event dispatchers.

    In your gamemode, create an event dispatcher, which I called "SpawnBox" (don't use this name, because it's the same name as your Spawn event in the Grid BP). Then setup the system that will trigger the spawn - in my case, I setup a timer that will call "SpawnBox" every second:

    Click image for larger version  Name:	gamemmode.png Views:	1 Size:	52.4 KB ID:	1462308

    In your grid BP, bind your "Spawn" event to the event dispatcher:

    Click image for larger version  Name:	grid.png Views:	1 Size:	163.6 KB ID:	1462307

    Leave a comment:


  • replied
    They are BPs (i guess?).
    https://i.imgur.com/lxwI52I.png
    https://i.imgur.com/uS6fNc7.png

    Yes, I want to spawn box on surface, the script is already done and working https://i.imgur.com/Eody7FL.png inside grid blueprint, but I have read that gamemode/gamestate on server side should keep track of those things and perform action, e.g. if there are no boxes on the grid spawn one, or if time left is 30s or less, spawn at least two boxes etc.
    So I've made SpawnBox custom event inside grid blueprint and now i want to call that event from gamemode BP.

    Leave a comment:


  • replied
    So, you have the grid in the world, and now you want to spawn boxes over it's surface, yes? Are these boxes static meshes or BPs?

    Leave a comment:


  • started a topic How can i cast to desired blueprint?

    How can i cast to desired blueprint?

    I have made grid blueprint, construct event looks like this:
    https://i.imgur.com/LrMcZo2.png
    All it does is making a grid out of static meshes, grid itself: https://i.imgur.com/eDGYpsU.png

    Now inside my gamemode i want to handle logic of spawning boxes on this grid, what should i use to make it work?
    https://i.imgur.com/AISJJM8.png
Working...
X