If we use the example that was in your previous post, then we have an attacker in 3001, shooting at the player in 1001. Ultimately, I want to know if the player is considered to be in cover from the shooter’s perspective. To complicate things, I only want to use the cover around the player’s tile (i.e. I don’t want to know if there is intervening cover).
You’re in luck, because that is how cover works by default. You can use the FindTargetCoverRelativeToSource function in the cover component to find the cover value (float) of a tile (the Target) when being targeted by an ability from a different tile (the Source)
Here is a quick debugging setup you can use to check the cover values of the tiles you hover over from the tile of the current active unit:
https://i.imgur.com/JoYIasy.png
I implemented the debug script that you provided and it works wonderfully. I’ll need to find where you implement this to see how you handle the mouse clicks – select unit (may already be selected) click on the laser ability and then click on the target. Thank you very much for taking the time to explain this so fully.
Hi ,
We ran into a weird camera issue. The camera zooms and rotates just fine on desktop using the keyboard but attempting to pan the camera makes it jump somewhere else entirely (works fine with touch screen though). If we press End Turn it goes back to centering on the next player.
We didn’t touch the camera controls at all to our knowledge so I am wondering what may have recently caused this. Could it be the UpdateTilesInRange function we implemented so players can spawn new tiles? Something to do with the method you shared for players sharing spaces?
Any idea what might be causing this?
Thanks
Glad my explanation made sense Let me know if you run into any other difficulties.
Hi, I’m guessing it might be caused by bConstrainToGrid in BP_GridCamera. Might it be turned on?
Yup, that was it! I turned it off and it is fine now.
Thank you!
Glad that fixed it. My bad, really. Should probably not have made it the default in the last update, as it interferes with some setups, such as your own.
Hi Mono,
I am trying to duplicate the heal ability. I understand, that action names are given from the specific queue where it is called from. But at one point after clearing out and so on the real action name needs to be passed throu to match the switch on name node. So I tried to make a new ability named “lesser healing”. But the system won´t ever pass the switch on name.
So I searched the heal ability where it is defined that at some point the input is “heal” for your already implemented “heal” ability. But I can´t find it, as the action name variable is set to “none” in the “heal ability BP”. Can you please tell me where this specific names comes from and where it is set in the run down for the heal ability?
I already watched the videos for the action manager and abilities up and down, but can´t find the info there. Big thanks.
Hi Infest, the Heal action is called from the ExecuteAbility function within BP_Ability_Heal. If you are struggling to find something in blueprints you can use the FindInBlueprints window in the Windows tab of the editor. Here you can search for whatever node or string input you are looking for, though admittedly for “heal” you have to look through a lot of stuff to find it.
Hi Mono,
startet with the value for the AI and abilities. It is designed really really great. With relatively low effort you can achive nearly everything you want per ability. Nearly never saw this AI combat skill in any other TBSG. Wow!
Maybe you may help me out with two things:
-
At some point (obviously after nearly all APs are consumed) after moving with “move attack” “enemy display” is automatically activated. I can´t find where this comes from. I wan´t to unbind that this is going to happen.
-
I wan´t to add a new animation for casting. Is there something in the toolkit what I can use? Or can you tell me what I have to do?
Thank you
I’m happy to hear that you like the ability system, Infest I’ve put a lot of effort into it, trying hard to keep it as flexible as possible, so I’m glad to hear you experience it that way.
Strange to hear that it is automatically activated. I’m assuming this is in a modified project? The EnemyDisplay ability is activated only one place in the toolkit, which is if an actor is selected where unit activation is not allowed (specifically where the CheckIfUnitActivationAllowed function in BP_Unit returns false). By default this returns false if the unit is not owned by the active player controller (the current active player controller is defined in the turn manager). Maybe you’re spawning units in some way where they end up not having a player controller assigned as an owner? I’m just guessing here, since it is hard to know what you might have modified. At least I’ve given you some suggestions for places to look.
There are no animations suited for casting in the toolkit, but I’m assuming you’re asking about the coding part. First you should watch my tutorial series on adding new units if you have not done so already, just to get an overview of how the animation blueprints are set up. Once you have added a new spellcasting animation and set it up with the correct notifies (as described in the tutorial) you will want to add a new action name to the SwitchOnName in your animation blueprint. You likely want to set it up a similar way to how the “default” option is set up. You will need new booleans to set in the animation blueprint, which you can use to define new rules in the UnitStateMachine in the AnimGraph (Again, look at the Attack state and transition rules).
Lastly, in your spellcasting ability you will need to call on this animation through an action. You can perhaps look at BP_Ability_Heal for an example. In the AnimateAction of BP_Ability_Heal you can see that it queues the “special” action, which is not defined anywhere. The executing actor here is a unit, and in BP_Unit any action that is not defined in its animate action is sent to the animation blueprint. Since there is no “special” action defined in the animation blueprint, the default is used (which is the attack animation). This means that if you have added a new “special” output pin to the name switch in the animation blueprint and a unit with that animation blueprint uses the heal ability, that part of the animation blueprint will be activated. You can use this same approach to define any number of custom animations for your units. Hope that made sense
Hi Mono,
thank you for your answers. Yes it is a modified project. But I think that comes anywhere from the default setting, that when you have two “move points” and used your first one. So that what already is in the default when the first movepoint is spent, the default toolkit switches to show only target markers instead of movement markers. Maybe it is not tight to enemy display, instead it only shows the wrong markers in my case.
Edit: Okay I think it is the “Suggest Target” event what is causing this. Maybe thats because what I want to achive is different from whats the default. In my case I wan´t that an attack is not possible when current AP<AP cost, but the unit should still be able to move with “move Attack”. The default is, that an attack is possible anytime, but movement is not. Move attribute within the units is already set to 1 and “fromPathfindingCost” is active.
aha, yeah then EnemyDisplay is probably not the culprit, just the way MoveAttack is set up to allow movement/attack with 2+AP and only attack with 1AP. You essentially want the opposite, then?
Ok, try this as a starting point:
https://i.imgur.com/Fl39858.png
https://i.imgur.com/z4IDsBp.png
I’ve read the other *big units *questions in here but I didn’t see any that addresses mine.
I will be needing a big unit that doesn’t take up a square amount of space but one that goes across 3 spaces. As in, one lane. Kind of like a row of bowling pins and it will consist of multiple characters as one big unit. It will basically be a wave of destruction, simply using a collision box trigger that decimates as it moves. If I modify a unit and simply copy paste characters next to it so it is 3 spaces across that almost works, but they won’t animate when moving like the center character does.
Any suggestions?
Okay got it now working with the “enemy display thing”. It was something in AbilitySystem that does not allow me to activate move attack and then activates enemy display. Thank you for pointing me in the right direction.
I have a general thing, where nobody needs to answer, but I can´t get it :).
I want to calculate the “chance to kill” via blueprints. Here is the setup:
Min Damage =9 Max Damage= 14 Critchance=30% Critical multiplyer = 1,5 Current Health = 14
Of course every value is variable. I am not able to calculate that dynamicially in Blueprints
The regular animated unit animates by passing commands to the animation blueprint stored in AbpRef. For your triple-unit you could similarly store references to all three abps as an array and for any command that would normally be passed to AbpRef you would loop over this array.
Ok, glad you figured it out
I’m sure there is a smart and efficient way, but here is at least a dumb and inefficient way:
https://i.imgur.com/iDgdFrp.png
Hi Mono,
thank you for this amazing toolkit, I am very new to the blueprints system in Unreal and I am using this kit as a learning process for now. Having a complete framework in front of me so tidy and well designed is very useful and your tutorials are super helpful. I would like to ask you a few question that will help me get started on prototyping new mechanics on top of the basic ones and please bear with me if they sound obvious or silly, I am a beginner
I wanted to create some custom abilities but if I duplicate one already in the kit to use as a starting point it gives me a compiling error, I guess it’s not that easy. I should I do that?
I would like the unit to extract a number between a range and use it as “move limit” (like a “dice roll” basically) at the begging of every turn. Should I create a new move ability (which brings me to the first question) with that function or use the turn manager blueprint?
How would you go about overriding the game mode in order to have custom ‘game overs’ like for example an enemy unit reaching the center of the grid before the player or similar?
I hope these question make sense, of course just pointing me in the right directions would be more than enough.
Thank you for your time.
Big Thanks
But it does not work completely. I have tested it with: MinDam=9 MaxDam=14 Critchance=2 Multiplier=1,5 Current Health=14
I have attached a screenshot where its calculated after the first loop, where I think its just something with invers calculation. Values are passed through correctly from the input site.
Still havent tested 0% and 100% critchance cases though.
The second screenshot shows the end result in game, where the the 1,5% are a bit strange.
Hi serajky I’ll do my best to help. So first for the compiler error when duplicating an ability. This is just an annoying UE4 thing that has to do with references. Most abilities use Event Dispatchers. When you duplicate an ability with an event dispatcher, a new one is created for the duplicated blueprint. However, the nodes in the event graph are still referencing the old event dispatcher, which the new blueprint don’t have access to. It is quick to fix, though. Just add a call to the new dispatcher, which has an identical name to the old one:
https://i.imgur.com/SIvRvyl.png
as a more general tip for debugging blueprints, you can see the specific compiler errors in the CompilerResults tab (see the screenshot). If you click the underlined words in the error they will take you to the specific places that have issues.
The question makes sense So you want to randomize the move range of a unit each turn based on a dice roll. Both of your ideas make sense, and which is better depends a lot on your game. If you have lots of different move abilities, and they all depend on the same dice roll, then doing it in the turn manager might be sensible (so you don’t have to duplicate code). Or rather, you might want to do it as part of the RefreshActor code, which is called from the turn manager on all units at the start of a new turn. Here is a super simple way to set the move of all units to 1d6 at the start of a turn:
https://i.imgur.com/qqQbxjk.png
Naturally you would not want to hardcode the values, and might want to use a random seed, but this is a good starting point.
Now for your main question.
I’m guessing you’re inputting 2.00 for the crit percentage instead of 0.02?
Yes that was it. Big big thanks again
Exept for higher critchances, again a mistake on my site maybe.