ID:161722
 
Ok, so I'm developing a combat system, where you choice your attack from a list, and your enemy chooses a counter-action. ie You pick left punch and your oppenent choices block high.
How would you check to see if your oppenent choice block high or any other defensive action?
Well... the same as when you check what the attacking player chose? Where are you initiating the choosing from? You can show your code and we'll see.
In response to Kaioken
Kaioken wrote:
Well... the same as when you check what the attacking player chose? Where are you initiating the choosing from? You can show your code and we'll see.

Well, I don't have a basic code, but pretty much i have a
physicalattack = list("Left Punch","Right Punch","Elbow","Knee","Right Kick","Left Kick")

Person chooses the attack, and then I don't know how to check to see if the enemy AI chooses a skills that would be in
physicaldefense = list("Block High","Block Low","Duck")
Like, if you choose Left Punch, if the enemy AI choices Block High, you block it but if he closes like Block Low or Duck, you get hit.
In response to Lundex
I dunno, maybe something like this?
matrix
var/list/hit[][]
New()
hit["Left Punch"]["Block High"] = 0
hit["Left Punch"]["Block Low"] = 1
//...
proc
is_hit(attack,defense)
return hit[attack][defense]


or this?
proc
is_hit(attack,defense)
if (attack=="left punch")
if (defense=="block high") return 0
if (defense=="block low") return 1
// ...
return 0
if (attack=="right punch")
if (defense=="block high") return 0
if (defense=="block low") return 1
// ...
return 0
// ...
return 0
In response to Traztx
I know very old, but i'm trying to figure it out, so basically you punch right I want it, so you only have x seconds to react before the attack hits you...