Can someone show me how to code someone block/defend for attack.
Dec 19 2013, 5:28 pm
|
|
How do you want the thing to go? They get into blocking stance and sit in it? They need to time the block? What?
|
Blocking stuff like in hand to hand combat need to know how i can code something,like if someone attack when you guard is up he reduce,if power of the other person is too strong it will break your guard.
|
You could try to apply the block icon, and reduce if not dodge unblocked damage. Read the DM guide. it'll show you examples on how to attack, you can use your brain and conjure up the code to make them block. i would try just a basic reduce in damage (damage -= M.attack - (usr.defense + usr.block) im not sure if thats how it would go, but that could be the formula you put in your back pocket.
someone tell me if im wrong so i know |
Just make it so you modify a blocking variable if they start blocking. While this blocking variable is true, damage is reduced to that person when attacked.
|
Lugia, could my way work though? is the idea good enough to work? im new so i just wanna know for myself
|
I couldn't really decipher what you said. But you had a blocking var so sure. Why not. I'd do a check to make sure damage isn't negative though, so you don't heal the enemy.
|
Here's something not really simplistic that ought to help you figure out what you need to do:
mob This approach creates a blocking variable that you can check to see if the user is blocking. This version does something neat as well, in that the block gets weaker over time, so you have to let it cool down in order to use it properly. For the first half a second it is in use, it will increase the strength of the block by double, and from there, it will steadily degrade to half as strong using a quadratic formula. Lastly, it will attempt to recover the strength of the block over a period of time determined by a linear relationship between the strength of the block used, and the time you set the block to endure using the blockduration variable. You will need to set up some form of a keybind for this to work using your interface files, and you will need to create client verbs that will call blockStart() and blockStop(). Finally, you can actually use this block like this: mob This might be a little advanced for you, so if you have any questions about how things work, please ask. I will not, however, be changing this for you to work in a certain way, because you should be writing a system that will work for your own game. I'm just here to show you one of many approaches. |
MegaMan999 the unpractice programmer.make a little easier like for example put up block when press b and release when press back b and also is broken when it overpowered.
|
In response to MegaMan999
|
|
MegaMan999 wrote:
MegaMan999 the unpractice programmer.make a little easier like for example put up block when press b and release when press back b and also is broken when it overpowered. Ter13 Wrote: This might be a little advanced for you, so if you have any questions about how things work, please ask. I will not, however, be changing this for you to work in a certain way, because you should be writing a system that will work for your own game. I'm just here to show you one of many approaches. |
In response to MegaMan999
|
|
MegaMan999 wrote:
MegaMan999 the unpractice programmer.make a little easier like for example put up block when press b and release when press back b and also is broken when it overpowered. Gotta remember that Dev Help is for people that help themselves. Asking for handouts will earn you a bad rep and get you nothing. |