Punching code
Punch()
if(!src.Doing)
if(src.Combo<=src.MC)
src.Doing=1
if(src.client)
src.Speed+=0.025
src.MSPE+=0.025
src.BPM+=0.5
src.P3=1
src.Attackable=1
if(src.Voices)
var/R=rand(1,3)
if(R==1)
src<<sound("[src.Voice]Attack.WAV")
if(R==2)
src<<sound("[src.Voice]Attack2.WAV")
if(R==3)
src<<sound("[src.Voice]Attack3.WAV")
if(src.LastAttack=="Punch2")
flick("Punch",src)
src.LastAttack="Punch"
//src.Attacking=1
//spawn(10) src.Attacking=0
else
if(src.LastAttack=="Punch")
flick("Punch2",src)
src.LastAttack="Punch3"
else
if(src.LastAttack=="Punch3")
flick("Punch3",src)
src.LastAttack="Punch2"
//src.see_invisible=1
for(var/mob/M in get_step(src,src.dir))
if(ismob(M))
if(M)
if(M.BP>=1)
if(src.Attackable)
if(M.Attackable)
var/d=rand(src.Strength-M.Defense,src.Strength+src.Strength/4)
if(wt == 0)
src.combo += "A"
if(src.combo == "ASA")
//flick("Teleport",src)
wt = 1
view()<<output("[src]: Dynamic Punch!","window5.output1")
M.BP-=d/4
new/obj/Explosion(M.loc)
spawn()
src.finisher = 1
src.ncombo = ""
src.Wait(10,"s")
if(!M.Blocking&&!M.Dodge&&!M.Attacking)
src.Hit2(M)
src.Hit(M)
if(M.Blocking&&!M.Dodge&&!M.Attacking)
src.Hit4(M)
if(M.Dodge&&!M.Blocking&&!M.Attacking)
src.Hit5(M)
if(M.Attacking)
src.Hit6(M)
if(d<M.Defense*4&&!M.Attacking)
if(src.SE)
if(src.client)
src<<sound('W Punch.wav')
//src.Hit(M)
else
if(d>=M.Defense*4&&d<M.Defense*8&&!M.Attacking)
if(!M.Dodge)
if(src.SE)
if(src.client)
src<<sound('Punch.wav')
//for(var/mob/MM in oview(8,src))
//if(MM.SE)
// MM<<sound('Punch.wav')
M.Previousdir=M.dir
step(M,src.dir)
M.dir = M.Previousdir
src<<"<B>You knocked [M] back</B>"
M.Defense+=0.3
M.MDEF+=0.3
if(M.Rage<=93)
M<<"Your rage is becoming stronger."
M.Rage+=7
if(M.Rage>=100)
M.Rage=100
M<<"Your rage is eating you alive. You can choose to unleash your rage by pressing tab on your keyboard, or release it to calm yourself down by pressing shift."
else
if(d>=M.Defense*8&&!M.Attacking)
if(!M.Dodge)
if(!M.ChargingK)
if(src.SE)
if(src.client)
src<<sound('S Punch.wav')
M.Previousdir=M.dir
walk(M,src.dir,2)
M.dir = M.Previousdir
//var/turf/T
//if(T in get_step(M,M.dir))
//src<<"You knocked [M] into a wall!"
if(src.client)
src<<"<B>You sent [M] flying!</B>"
M.Defense+=0.5
M.MDEF+=0.5
if(M.Rage<=90)
M<<"Your rage is becoming stronger."
M.Rage+=10
if(M.Rage>=100)
M.Rage=100
M<<"Your rage is eating you alive. You can choose to unleash your rage by pressing tab on your keyboard, or release it to calm yourself down by pressing shift."
//M.icon_state="KB"
//M.Refresh()
M.Pushed=1
M.Frozen=1
spawn(10)
if(M.client)
M.Frozen=0
src.icon_state=src.Stance
sleep(10)
M.Pushed=0
walk(M,0)
else
if(src.client)
src<<"You attack [M] with a ferocious blow, but the Ki he has charged up keeps him standing in place."
..()
else
if(src.client)
src<<"[M] isn't a combatant yet."
..()
else
if(src.client)
src<<"You aren't a combatant yet. You will become a combatant once you reach 200 BP."
..()
src.DeathCheck(M)
else
src.Death(M)
//if(istype(M,/turf/))
//del(M)
sleep(10-src.Speed/10)
src.Doing=0
sleep(3)
if(!src.Doing)
src.Combo=1
combo = ""
com = 0
wt = 0
hit = 0
ncombo = ""
finisher = 0
if(src.client)
winshow(src,"default.combo",0)
..()
Hits
mob
proc
Hit(mob/M)
var/d=rand(src.Strength/5-M.Defense/5,src.Strength/5+src.Strength/5)
M.BP-=d
M.Defense+=0.1
M.MDEF+=0.1
if(src.client)
winshow(src,"default.combo",1)
winset(src,"combo","text=\" [src.Combo]\"")
if(M)
src.US7(M)
//src << output("<br><br>You punch [M] for [d] damage!","window5.output1")
s_damage(M,d,"white")
src.Combo++
src.MSTR+=0.75
src.Strength+=0.75
src.Speed+=0.05
src.MSPE+=0.05
src.BPM+=1
if(M.Rage<=100)
M << output("<br><br>Your rage is becoming stronger!","window5.output1")
M.Rage+=5
if(M.Rage>=100)
M.Rage=100
M << output("<br><br>Your rage is eating you alive. You can choose to unleash your rage by pressing tab on your keyboard, or release it to calm yourself down by pressing shift.","window5.output1")
Hit3(mob/M)
var/d=rand(src.Strength/5-M.Defense/5,src.Strength/5+src.Strength/3)
M.BP-=d
//M.Defense+=0.2
//M.MDEF+=0.2
if(src.client)
winshow(src,"default.combo",1)
winset(src,"combo","text=\" [src.Combo]\"")
if(M)
src.US7(M)
//src << output("<br><br>You kick [M] for [d] damage!","window5.output1")
s_damage(M,d,"red")
src.Combo++
src.MSTR+=0.75
src.Strength+=0.75
src.Speed+=0.02
src.MSPE+=0.02
src.BPM+=1.2
if(M.Rage<=100)
M << output("<br><br>Your rage is becoming stronger!","window5.output1")
M.Rage+=5
if(M.Rage>=100)
M.Rage=100
M << output("<br><br>Your rage is eating you alive. You can choose to unleash your rage by pressing tab on your keyboard, or release it to calm yourself down by pressing shift.","window5.output1")
//M<<"Your rage is eating you alive. You can choose to unleash your rage by pressing tab on your keyboard, or release it to calm yourself down by pressing shift."
Hit4(mob/M)
var/d=rand(src.Strength/15-M.Defense/5,src.Strength/15+src.Strength/6)
M.BP-=d
M.Defense+=0.3
M.MDEF+=0.3
if(src.client)
winshow(src,"default.combo",1)
winset(src,"combo","text=\" [src.Combo]\"")
if(M)
src.US7(M)
//src << output("<br><br>You kick [M] for [d] damage!","window5.output1")
s_damage(M,d,"white")
src.Combo=0
src.combo=""
src.MSTR+=0.5
src.Strength+=0.5
src.Speed+=0.02
src.MSPE+=0.02
src.BPM+=1.0
src.Doing=0
Hit5(mob/M)
M.Reflexes+=0.3
M.MREF+=0.3
flick("Teleport",M)
if(src.client)
winshow(src,"default.combo",1)
winset(src,"combo","text=\" [src.Combo]\"")
if(M)
src.US7(M)
//src << output("<br><br>You kick [M] for [d] damage!","window5.output1")
src.Combo=0
src.combo=""
src.Rage+=2.5
src.Doing=0
Hit6(mob/M)
if(src.client)
winshow(src,"default.combo",1)
winset(src,"combo","text=\" [src.Combo]\"")
if(M)
src.US7(M)
//src << output("<br><br>You kick [M] for [d] damage!","window5.output1")
src.Combo=0
src.combo=""
src.Doing=0
new/obj/Clash(src.loc)
Hit2(mob/M)
var/H=rand(1,5)
if(H==1)
new/obj/Midhit(M.loc)
flick("Hit2",M)
if(H==2)
new/obj/Lefthit(M.loc)
if(H==3)
new/obj/Righthit(M.loc)
if(H==4)//FACE
new/obj/Highhit(M.loc)
flick("Hit",M)
if(H==5)
new/obj/Lowhit(M.loc)
Problem description: For some reason I'm getting a strange runtime error that has something to do with my macros.
Here it is:
runtime error: type mismatch: 0 += "A"
proc name: Punch (/mob/verb/Punch)
usr: Forerunnerz (/mob/Player)
src: Forerunnerz (/mob/Player)
call stack:
Forerunnerz (/mob/Player): Punch()
See the "A", that part of the error changes for the "K" key too, but then again they are very similar codes, one is for punching("A"), and the other is for kicking("S"), I don't know how I'm getting the Runtime Error but it stops my punch or kick whenever I'm about to hit an enemy but works fine if there is no enemy a step away from me. I know I need to clean this code up but first I want to solve this problem.
Please try;