Got a bit deeper into the blueprints and just had a suggestion. As you mention above to change the start location of the camera you need to go into the game mode blueprint and then adjust the position of the camera from the player location to your own location.
I thought this should really be a function on the camera blueprint, as I spent a good amount of time trying to figure out how the camera was working, turning on and off things etc… trying to find where to set the initial position of the camera.
It’s me again with another question Looking at the kit and we’re looking into making tiles impassable for just specific classes, any built-in or hacky way we can utilize to let some units cross tiles and not others? So i.e. a tile that is marked as 10 cost for pawn class ranged but marked as 1 cost for class melee?
Hi, I’ve thrown together something that works that will hopefully point you in the right direction. Here is what I did:
I made a new blueprint called BP_HomingMissile. The homing missile contains the following: A static mesh, A vector variable for its TargetLocation (with expose on spawn checked), a float variable for its speed (set to the number of unreal units to move each second. Mine is at 300), and the following nodes that make it move from its start location to the TargetLocation destroying itself and running its custom OnHit event dispatcher when it has reached its destination (note that this is not the best way to move something at a constant speed, but it is something I threw together quickly. Replace with any other method of moving something to somewhere else)
For the skill I’ve made a duplicate of Skill_Laser that I’ve called Skill_Homing. All I’ve done in this new blueprint is to replace the nodes that normally spawn and destroy the laser emitter with ones that spawn a homing missile and continues once the missile has hit. Like so:
If you cope the above you should have a missile that spawns when you click the target to shoot, travels to the target and then deals damage and disappears. Hope that is close to what you were after.
Thanks for the suggestion. I agree completely, and this is actually how it is already in my WIP build. The starting location of is now set in the EventBeginPlay event of the camera blueprint itself. Generally, several things will be in more sensible places in the next update.
Welcome back There are several ways you can solve this, but I’ll give you a farily simple one that should achieve what you want.
For this I’ve created a new Enum called ETerrain that holds our different terrain types. I’ve added Plain, Woods and Water by default.
Then to the Unit blueprint I’ve added a new Map called TerrainCosts, with ETerrain as the Key and Integer as the value. For each unit type you then add to the map what terrain you want the unit to be able to traverse (leaving out any that should be impassable) and set the value to whatever extra cost you want for that terrain type for that unit (keeping it at zero for default cost).
Next, I’ve added an ETerrain variable to BP_Tile where we can specify what terrain that tile represents. I’ve then made two child blueprints of BP_Tile called BP_TileWoods and BP_TileWater, set their ETerrain values to match and set their edge costs to 1.
Following this I’ve added a new array to BP_GridManager called Terrains that holds the terrain type of each tile. At the end of the event graph of BP_GridManager (does not matter where as long as it is after AddViewportTerrainToArrays) I’ve added the following:
This adds the terrain values of each of your tiles to the Terrains array, defaulting to Plain. You could of course forego using tiles and just manipulate the array directly.
The next step is to create a custom pathfinding for our units. If you have not modified it already, use the SearchAndAddAdjacentTiles(Custom1) function, which is identical to the regular pathfinding, but included for ease of adding a new type. However, we will be referencing the current unit a lot in this function, and do not want to cast to it every step of the pathfinding, so go to the CustomPathfinding macro and hook up the SetCurrentPawnPathfinding nodes in front of SearchAndAddAdjacentTiles(Custom1) just like they are in SearchAndAddAdjacentTiles(PassThroughFriendlies)
Next, in the SearchAndAddAdjacentTiles(Custom1) function add a new branch after the one checking the movement cost of the next tile to search. In the new branch, get the terrain type of the tile to be searched from the Terrains array and try to find it inm the TerrainCosts Map of CurrentPawnPathfinding. If you do not do so, abort this seach step of the pathfinding. If you find it, add its cost of moving to this tile. Like so (new nodes are highlighted. Don’t forget the ‘+’:
That should be it, I think. Except remember to set the PathfindingType of your units to Custom1. Here is a screenshot of a unit that has Forest set to 2 cost, plains to 1 and water not addet to its TerrainCosts map
Hi, I’ve thrown together something that works that will hopefully point you in the right direction. Here is what I did:
I made a new blueprint called BP_HomingMissile. The homing missile contains the following: A static mesh, A vector variable for its TargetLocation (with expose on spawn checked), a float variable for its speed (set to the number of unreal units to move each second. Mine is at 300), and the following nodes that make it move from its start location to the TargetLocation destroying itself and running its custom OnHit event dispatcher when it has reached its destination (note that this is not the best way to move something at a constant speed, but it is something I threw together quickly. Replace with any other method of moving something to somewhere else)
https://i.imgur.com/hVsTqg2.png
For the skill I’ve made a duplicate of Skill_Laser that I’ve called Skill_Homing. All I’ve done in this new blueprint is to replace the nodes that normally spawn and destroy the laser emitter with ones that spawn a homing missile and continues once the missile has hit. Like so:
https://i.imgur.com/yBGOvWl.png
If you cope the above you should have a missile that spawns when you click the target to shoot, travels to the target and then deals damage and disappears. Hope that is close to what you were after.
Thanks for the helpful reply. I had a go at implementing that solution but somehow the blueprint library that i have doesnt have the node ‘call onhit’. Instead i implemented the ‘spawnActor class blueprint’ which then executes the ‘move component to’ and then executes ‘destroy actor’. For the input pin ‘over time’, got the result of ‘find distance (in tiles) between indexes’ and did a float div (common factor) of 6. I notice that in previous thread someone mentioned about the 3d widget multi health bars. Ive tried to integrate along side the ‘constuction script - setup the health bar’, but the methods seems to be different to that of the progression bars of 3d widget. So far i have created the simple 3d widget then added a widget component to the ‘unit’ pawn then selected wiget class to reference that 3d widget. I would then need a event tick in the actual 3d widget for facing the camera and upon test progression bars seem to initialise on starting Jungle raid map. Now, when i make a custom event in 3d widget, and then calling that event from the ‘unit’ pawn, the map starts up with the uninitialised 3d widget. I’ll go back to just a single progression bar to see where the error is, but if someone has a solution then it would be great.
I’ve tried to initialise the 3dwidget in the ‘setup references’ of pawn ‘unit’, but upon starting the jungle raid map, each unit is not in their proper grid position but are sequentially spawned at position 0,0 after ending each units’s turn. I have only executed the 3d widget initialisation after the last node of the ‘setup references’ section and think i may have disrupted something or maybe need to re-initialise something else for it to go back to normal.
After this occurrence, i loaded up the backup of jungle raid and now it initialises with the 3d widget. Strange, but it now seems to be operating as intended.
@**miketv23: **You do not have the OnHit event dispatcher, because it was just added by me in the example I presented. You need to add the OnHit (or whatever you want to call it) event dispatcher yourself. Event dispatcher can be added to blueprints in the same way variables or functions can. Starting their names with On is following Epic’s naming conventions.
From your edit I believe you’ve fixed your 3D widget issue, correct? You don’t need any input on it?
I’ll do some reading on what event dispatchers now i know how to create it. The forum is quite difficult to find already posted solutions, i’ve done the search for trying to rotate the 3d widget to face the screen. I’ve tried to implement the following as shown in the picture with scene1 as the added scene component with the 3d widget nested inside. I’ve tried it with getting the location from the Player Camera Manager and that didn’t work. And i also tried it with the BP_Grid_Camera_Ref and that did’nt work. I’ve left the nodes for the BP_Grid_Camera_Ref to show what i attempted in the diagram.
I’ve just found the post. Post #907 for rotating towards the camera.’
I’ve tried to implement the blueprint from post #907 and that didn’t work and can’t find the blueprint where the billboard faces the camera. Still stuck on this camera rotation.
Hello. What is the reason for same warnings in the log?
LogScriptCore:Warning: Script Msg: Attempted to access index 1156 from array VectorFieldArray of length 1156!
LogScriptCore:Warning: Script Msg: Attempted to access index 1157 from array VectorFieldArray of length 1156!
LogScriptCore:Warning: Script Msg: Attempted to access index 1156 from array VectorFieldArray of length 1156!
LogScriptCore:Warning: Script Msg: Attempted to access index 1189 from array VectorFieldArray of length 1156!
…
etc
Hello , I am trying to figure out a way to suspend unit movement at beginning of game and player turn so I can click on other things on map to get info etc.
Then press a key when done and resume moving units. Do you or anyone else here know if this is possible and could you please point me in the direction to achieve this.
“Edit” Earlier I stopped reading posts on page 64… Started reading again, found some ideas on page 66-74…I will try keep trying. A reply is still welcome…
Been a while since I posted, this kit is so easy to work with. Thanks again for your hard work on this !
I believe your solution should also work, though. You probably just haven’t enabled tick events in the unit blueprint. These are disabled by default for performance reasons.
@**strelokqvt: **this error is caused by tile actors at the edge of the map attempting to modify the edge array of tiles outside the map. It will not cause any actual issues, but the warning message is of course annoying. Similar warnings appear when the player hovers the mouse over the very edge of the grid, for similar reasons. I have fixed this in the WIP update.
@ : The first unit is by default activated from ATBTT_GameMode (right *after the Setup actor references and sort units in initiative order *comment box). Break this connection (by the delay node) and add a new event that continues from the AIControlled branch. Call this event to start the game.
Thanks for the quick reply …You couldn’t have made that easier huh…(Joke):). I guess that will teach me to take a break from this, just what I need .
Thank you and I am looking forward to the next update. Till next time.
@miketv23: here is a simple way to get any object to face the camera:
https://i.imgur.com/74vx6Jz.png
I believe your solution should also work, though. You probably just haven’t enabled tick events in the unit blueprint. These are disabled by default for performance reasons.
Thanks, indeed the tick event had been disable and i had no idea it had to be enabled. I have been trying to implement new characters from the child blueprint of 'UnitSkill" after selecting the skeleton mesh and animation blueprint. For the ‘attack’, ‘hit’ and ‘death’ animations the skill blueprints were modified the play that characters animation through casting to that characters animation blueprint. The moving animation of the characters is not so straight forward as the Break Timer script of ‘Unit_Skill’ has the purple node ‘Break_Timer’ which will always cast to Pawn_Anim_BP_Parent when the new characters animation blueprint is required. I have tried creating a variable to a ‘switch’ node to cast to that new characters blueprint but it the new characters move animation still does not play . Is there a better way to add new characters with different skeletons? Can i have more than one purple node to implement a different ‘Break_timer’ for the new character. I know that the new characters move animation is working as i preset the speed in the new characters blueprint and upon play the new character is constantly playing that move animation.
I think i may have to go further into the blueprints.
@miketv23 : Have you seen my tutorial video on adding characters that use different skeletons? Report back to me if this approach does not work for you.
The new skeleton was integrated soley based on the ATBTT tutorial 7 and then tested in the ‘Example Map Grid’ with all animations working and also in the move animations. Now when i create a child blueprint from ‘UnitSkill’ and reference the new skeletal mesh and animation blueprint of that new mesh and test it in the ‘Jungle Raid’ Map the new characters just stay in there idle state when move from one position to another. All of there rotations and transformations are correct but it’s just there movement animations that just don’t seem to be activated. All the other original units in the jungle raid map function correctly. When i preset the speed variable of the new characters blueprint to something like 200 then the new characters are constantly in their running state and of course are never idle. I don’t see how the new units reference from the ‘UnitSkill’ child blueprint can be handled by the ‘UnitSkill’ Move TimeLine as it will cast to just the Pawn_Anim_BP_Parent, but i cannot be certain as i don’t know the code to a high extent and the full understanding of it. I have thought about creating a duplicate of UnitSkill and modify it for the new skeleton, but then all references of UnitSkill in other blueprints will have to be modified. This is where i found the purple node ‘Break Timer’ and am not too sure that another version of it can be created and exist along side it. This is as far as i got in attempting to add new skeletons to be playable in the ‘Jungle Raid’ map.
@miketv23: The way you get around your child blueprint referencing Unit_Skill is to copy the relevant events from the parent blueprint directly into the event graph of the child blueprint. You should not have to copy all of it, but try doing it to see that it works. I’ve tested it on my end and it works fine. A problem is that the skills are set up to reference the ABP_Unit_Parent animation blueprint. If you are only using one animation blueprint then simply replace the cast in the skills with a cast to your own animation blueprint. If you are using multiple different animation blueprint that do not inherent from one another you can either do multiple casts in sequence until one returns true (pretty awkward, but if you only have a couple it is woth considering), or setting up a more generic system using blueprint interfaces (which is something I’m implementing at the moment).
@Deftones4: This is caused by Unreal Engine itself and not ATBTT specifically. I know that some limited support was added for decals on mobile back in UE4.9, but I think that was only for skeletal meshes. A quick search seems to indicate that decals are still not working properly on mobile, but there might be workarounds that I am unaware of. For the moment ATBTT therefore only supports displaying tiles in move/sight range as ISMs on mobile.
The solution for the new character movements is operating well. However upon further testing, the new characters hadn’t been properly removed from gameplay when killed. I guess this was apparent as the implementation was now referenced from the copied blueprints of the ‘Unit Skill Child’. The ‘Received Damage’ referenced the ‘Unit’ blueprint then continued onto the ‘Unit Skill’ blueprint which the flow of execution stop when the generic casting to ‘Pawn Anim BP Parent’. So i added a custom event to connect to the node after this and called it from ‘Unit’ and now the Child ‘Unit Skill’ is then killed successfully. I think this completes the full implementation of adding new characters with different skeletons. As for creating a blueprint interface to handle different skeletons would be quite far away down the path as i am still discovering Unreal Engine’s concepts.
@miketv23 Ok, glad that you managed to get it working. I would recommend looking into blueprint interfaces in the future, but if you do not have multiple blueprint classes that should take similar inputs then casting and regular custom events work fine. Blueprint interfaces are like generic events that can be called on any blueprint that implements that interface, with the exact content of the event designed on the blueprint in question. So you could for example have multiple different animation blueprint that do not necessarily inherit from each other, but implement an interface with events such as Attack, Death or whatever. In your skill blueprints you could then call these events on a unit through the interface without having to do multiple casting operations, which are somewhat clunky and inefficient. But like I said, this might still work fine in your implementation if you really only use on anim BP.
To anyone reading this thread who has not bought the toolkit yet, but is considering, ATBTT is currently 30% off as part of the Unreal Engine Marketplace Holiday Sale