Announcement

Collapse
No announcement yet.

[SUPPORT] Advanced Turn Based Tile Toolkit

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

  • replied
    Originally posted by Monokkel View Post



    Abilities are a good way to handle player input and displaying relevant in-game visualization such as 3D widgets etc. However, I'm not sure if you need a separate ability for this. Am I correct in guessing that you only want to show one such widget at a time? If so you can add this widget to the ability you have already created, you then place it over a tile when the tile is clicked and make it visible.
    Each tile has its own widget such as forest tile would have its own widget for construction or cutting down tree's ect, flat flat would have its own widget for its tile type. but widget should only be visible when current tile selected.


    Basically in the Parent class of the Terrain tile I added a widget class created event interact set visibility of widget.

    now what would be the best way to activate that event from the abilites blueprint?


    Attached Files
    Last edited by AlbertFive; 04-08-2020, 02:13 AM.

    Leave a comment:


  • replied
    Originally posted by AlbertFive View Post
    After doing some careful review it was the bp I was referencing.. here is video showing it working now..



    I am now setting up widget inside tile. If I want to have a widget be hidden inside a tile unless the tile is clicked whats the best way to activate a wiget on a tile that is otherwise hidden until needed?
    Originally posted by AlbertFive View Post
    I am guessing the best way to do widget visibility on tile is create a new ability class and have in that ability have ability triggered on tile have it show widget for that tile?
    Abilities are a good way to handle player input and displaying relevant in-game visualization such as 3D widgets etc. However, I'm not sure if you need a separate ability for this. Am I correct in guessing that you only want to show one such widget at a time? If so you can add this widget to the ability you have already created, you then place it over a tile when the tile is clicked and make it visible.

    Leave a comment:


  • replied
    I am guessing the best way to do widget visibility on tile is create a new ability class and have in that ability have ability triggered on tile have it show widget for that tile?

    Leave a comment:


  • replied
    After doing some careful review it was the bp I was referencing.. here is video showing it working now..





    I am now setting up widget inside tile. If I want to have a widget be hidden inside a tile unless the tile is clicked whats the best way to activate a wiget on a tile that is otherwise hidden until needed?

    Leave a comment:


  • replied
    I got everything added into the ability base terrain bp as shown in your sample code.

    but when I run I get this error.

    And this is my code

    Attached Files

    Leave a comment:


  • replied
    Originally posted by AlbertFive View Post
    On the Grid terrain map elements it will not allow me to add tile types when when selecting them from the pull down list it remains as none.
    Yeah, you cannot add references to specific actors (which are what references are) to a blueprint that is not itself instanced. No need for that, though. This loop adds all the tiles in the viewport during runtime instead.

    Leave a comment:


  • replied
    On the Grid terrain map elements it will not allow me to add tile types when when selecting them from the pull down list it remains as none.
    Attached Files

    Leave a comment:


  • replied
    Originally posted by AlbertFive View Post
    I am having to adjust since it seems I was not doing some elements correct, I am trying to link the the grid terrain variable into the add at end but it says cannot connect to this type?
    That means that they are not identical variables. How did you create the Add node here? Drag a pin out from the GridTerrain reference and then type Add. The context sensitive search should give you the correct node.

    Leave a comment:


  • replied
    I am having to adjust since it seems I was not doing some elements correct, I am trying to link the the grid terrain variable into the add at end but it says cannot connect to this type?
    Attached Files

    Leave a comment:


  • replied
    Originally posted by AlbertFive View Post
    Where do I locate these last circled bits. I got all the rest added in but cant seem to find how to call the target grid terrain and hovered tile.

    And attached is how my current abilities blueprint looks
    Well, HoveredTile is a part of BP_AbilityBase already. Check show inherited variables in the variable list to find it. The GridTerrain map you have to create yourself in the grid manager. It is a map with integers as keys and BP_Tile_Terrain actor references as values.

    Leave a comment:


  • replied
    Where do I locate these last circled bits. I got all the rest added in but cant seem to find how to call the target grid terrain and hovered tile.

    And attached is how my current abilities blueprint looks
    Attached Files

    Leave a comment:


  • replied
    Originally posted by AlbertFive View Post
    I managed to find the two but I cant seem to figure out how to add the Grid Terrain into the add bit at end? where is that function to add to that slot?


    Also what if instead of having it do the terrain high adjustment when player clicks on tile if instead I want it to pop up a widget that would have buttons assigned to perform different actions for that tile.. so instead whenever player click tile it pops up widget for that terrain tile type?



    Update I managed to find the Add bit at the end I had to create a variable


    In the ability base where do I locate the event server interact function to add it?
    Hey, seems like you managed to figure out a lot on your own. For any child blueprint you can right click the event graph and type the name of any event in the parent blueprint to override the event. If you do not wish to override it, but add to it, afterwards you need to right click the event and select call parent function. Functions (not events) in a child blueprint can also override functions in the parent blueprint by clicking the override button at the top of the function list (though you do not need that in this case, since ServerInteract is an event)

    Leave a comment:


  • replied
    I managed to find the two but I cant seem to figure out how to add the Grid Terrain into the add bit at end? where is that function to add to that slot?


    Also what if instead of having it do the terrain high adjustment when player clicks on tile if instead I want it to pop up a widget that would have buttons assigned to perform different actions for that tile.. so instead whenever player click tile it pops up widget for that terrain tile type?



    Update I managed to find the Add bit at the end I had to create a variable


    In the ability base where do I locate the event server interact function to add it?
    Attached Files
    Last edited by AlbertFive; 04-06-2020, 05:50 AM.

    Leave a comment:


  • replied
    Trying to follow your code how do I add in the Parent activate grid manager cant find that bit to add also where do I locate the "ADD" bit at end I circled the two bits I am having issue locating to add to the blue print

    Leave a comment:


  • replied
    Originally posted by AlbertFive View Post
    If I want to set up a tile so I can have multiple type of tiles to represent Hills, forests ect and make it so tiles can be selected like units cans be selected not just units how do I make terrain clickable so I can access the terrain tile information?

    something like in this video.

    https://www.youtube.com/watch?v=RO_NOJJ6kNc


    update on my question

    What I am meaning to ask is there an easy way to have tile type classes and have the grid manager then use those tiles for generating of map?

    I am trying to do a populous type game where how one raises and lower the terrain or change the tile type improves the terrain to gain access to improvements and expansions on one's settlement.

    Originally posted by AlbertFive View Post
    I managed to get some of my test terrain tiles in such as hills and forest..


    Hey Albert, so there are likely many ways you can go about doing this, but I'll give you a simple setup to get you started.

    First you need a way to store your terrain tiles on the grid in appropriate grid indexes. We can start by creating a new special tile actor for your terrain tiles. This might not be what you want, especially if you have a very large map and want your tiles to be instanced meshes But maybe it is fine for your game, and it is simple for our demonstration. I create a new child actor of BP_GA_Tile, which I've called BP_Tile_Terrain. I create three child actors of this for plains, forest and mountains and place them on a grid with the default tiles hidden:



    Now we need to add these tiles to the grid. I add this code to BP_GridManager_Hex directly for simplicity. When the GridManager is activated I loop over all BP_Tile_Terrain on the map and add them to a newly created GridTerrain TMap. Since our terrain tiles are children of GridActor they have their GridIndex easily accessible (if not we could have converted their location with ConvertLocationToIndex):



    Ok, so far so good. The tiles are in our game and stored in the grid, but we need to access them so we can manipulate them. Most interaction of this sort is done through abilities in this toolkit. Abilities do not need to be tied to a unit, but can represent an input mode of the player. BP_Ability comes with a lot of stuff only related to units and AI, though, so here we'll use the parent actor BP_AbilityBase as a parent of our new ability.

    BP_AbilityBase already has all the code we need to hover over tiles and interact with them, so we just need to define what happens when we interact (click)

    I keep it simple here. When the player interacts through this ability we check that there is a valid tile under the cursor and that the mouse is released. If so we check if there is a value in GridTerrain on the clicked tile. If so we push the tile 50UU up on a left click and 50UU down on a right click. We make sure to update GridLocations to reflect this, so that the location stored on the grid is updated for pathfinding and the like:



    Ok, almost there. Now we just need a way for the player to activate this new ability. For this demonstration I'll make it as simple as possible. In the Player Controller I add a couple of nodes that activate the ability if the player presses X on the keyboard:



    Et voilà:

    Leave a comment:

Working...
X