how do you setup stats for a player?

what im asking is ok if my player has an agility of 20 and the enemy has an agility of 80. how do you bp code it to hit them? since they have a higher agilitly?
i know how to give them stats. i dont know how to set the functionality up

If you have 2 player with differnt stats, all you need to do i check them.
When the hit should occur, Triggerbox ? hit event? by the way you get the “other actor”

If you have only few type of pawn-actors you can :
Other actor- Cast to “Enemy” Get Agility— if myAgility is > enemyAgility , you hit
If you have too many type of blueprint to cast, you can set-up an interface. (Custom interface for Hit-Agilitycheck)
So you just, other actor- Hit Agilitycheck.
The “interface” let you try to send a message without getting error if the other actor dont have that particular interface .
Here a simple cool video

no your not understanding what im asking. i wanted to know how you setup an enemy hitting the player depending on if they have a higher agility. so there chance to hit is greater than the players chance to dodge.
i messed around earlier and i already came up with something. so thanks anyway

What you’re asking is actually a lot more complicated than what can be offered as an answer here because to do it properly would require many different file setup (struct, enum, datatable, widget, child widgets maybe), controller (Master/child), AC, etc…

I mean it could be simplified but if your end-goal is to do something like an RPG; I’m afraid it’s a very complex thing. But if you want to do just know how to calculate it, there are various documents around the web about RPG Game theory which presents different examples on how you can go about the math behind it.

For instance, what does 20 agility mean? What is the max agility? You could do something like Agility/MaxAgility = Speed %. Then you will need a padding value of a certain percentage of what is considered acceptable in range, that way it’s not an absolute miss, but you could formulate maybe a 50% chance if it’s within that padding. Let me explain.

Agility = 20
Max Agility = 255

20 / 255 = 7.84%

Padding = 1.2%
Padding Potential = 50%

So far we’ve determined that the player’s Agility is 7.84% and it can potentially hit the enemy 50% of the time withing the Padding range of 1.2%. This means that so long as the enemy is not greater than 9.04% for their agility, the character will probably hit them.

There are so many different ways you can go about this, you don’t have to have padding, you can even have an inverse padding or a gradient attack based on the speed difference (attack decreases as player’s speed approaches enemy’s speed if it is greater than the player’s speed). etc etc…

I hope this gives you a greater idea on how to go about this. Really, the best thing to do is read up on how these things work in theory so that you can postulate your own integrations. Each game will have its own set of stats and game mechanics that tie into it so there is no one-formula to rule them all.

hi i really appreciate your answer. i think that maybe you have studied this. ive looked up some information on the web about it. and it seems its really not an easy answer.
i read this guys theory about why have a monster miss at all? just have 100% hit but damage is reduced depending on players luck,agility,dodge etc.
this is exactly what i was asking.
i messed with a small project and came up with this. its very simple but it works.
player agility = 20 monster agility = 80 , monster hits = monster agility-player agility
chance to hit = random 0-100
branch, if monster hits > chance to hit monster hits! else monster misses.
you can setup a print string to see it in action
it works! its simple and im going to go with it. :slight_smile:
thanks! :slight_smile:

i gave the player an agility of 300 just to play with and the monster never hit! so it definately works. also i think its an accurate %.

now, anyone know how to do damage? depending on armor level, damage from monster etc?