ID:175610
 
Ok im using raekwons random demo, but ive modified and killed all the bugs (Well except for one majoir one that i created) That bug is, when an allied guy attacks some times it un enables me to Attack, and all i can do is run, until i delete that char and make another one, its annoying would any one know how to fix?, it doesnt come up with any errors or run time errors either...

when i run it its like this (Its different each time for how many moves you can do)

You are under attack!
It is now your turn!
Vegeta attacks Wolf, but misses.
Wolf attacks Allied soldier, but misses.
Allied soldier's attack bounced off Wolf.
It is now your turn!
Vegeta Attacks Wolf for 3
Not your turn.
Wolf attacks Vegeta, but misses.
Allied soldier Attacks Wolf for 1
It is now your turn!
Vegeta's attack bounced off Wolf.
Wolf's attack bounced off Allied soldier.
Not your turn.
Allied soldier's attack bounced off Wolf.
It is now your turn!
Vegeta attacks Wolf, but misses.
Wolf's attack bounced off Allied soldier.
Allied soldier's attack bounced off Wolf.
It is now your turn!
Vegeta's attack bounced off Wolf.
Wolf attacks Allied soldier, but misses.
Allied soldier Attacks Wolf for 2
It is now your turn!
Vegeta attacks Wolf, but misses.
Not your turn.
Wolf's attack bounced off Vegeta.
Allied soldier Attacks Wolf for 5
It is now your turn!

im using "vegeta" Because this is a dbz game for me and my friends to play, Heres my code for it:
mob/var
ATTACK=1

mob/proc
//starts the random battle
Rbattle(mob/Enemy,mob/Enemy2,mob/Enemy3, mob/Allied1)
var/turf/Map
for (var/turf/BattleGrounds/BatLoc in world)
var/Taken=0
for (var/atom/A in BatLoc)
if(A.density==1){Taken=1}
if(!Taken){Map=BatLoc}
if (!Map){return}
var/k=rand(1,3)
if(k==1) src<<sound('Battle1.mid',1)
if(k==2) src<<sound('Battle2.mid',1)
if(k==3) src<<sound('Battle3.mid',1)
src.icon_state="battle"
src.overlays=null
src.inbattle=1
src.battle=1
src.south=0
src.oldlocx = src.x
src.oldlocy = src.y
src.oldlocz = src.z
src.ATTACK=1
src.Move(Map)
src.dir=WEST
src<<"You are under attack!"
src.client.lazy_eye = 5
textonscreenbackground(1,1,11,3) //5,3
textonscreenTEXT(1.5,12,3,1.3," Phys")
textonscreenTEXT(1.5,12,2,1.3," Run")
new/obj/menu/Curser(usr.client)
if(Enemy!=null)Enemy.Move(locate(src.x-4,src.y,src.z))
if(Enemy2!=null)Enemy2.Move(locate(src.x-4,src.y + 1,src.z))
if(Enemy3!=null)Enemy3.Move(locate(src.x-4,src.y-1,src.z))
if(Allied1!=null)Allied1.Move(locate(src.x,src.y+1,src.z))
var/list/WhichTurn=new()
var/list/ppl=new()
for(var/mob/Aa in view())ppl+=Aa
var/nextturn,PlayerOrder
do
for (var/aa=0;aa<=length(ppl);aa++)
PlayerOrder=0
for(var/mob/ppp in ppl)
if (ppp.Agility>PlayerOrder){nextturn=ppp;PlayerOrder=ppp.Agility}
else if (ppp.Agility==PlayerOrder)nextturn=ppp
WhichTurn+=nextturn
ppl-=nextturn
while (length(ppl)>0)
do
for(var/mob/pp in WhichTurn)
if (pp.Health>0)
if (pp.client)
if(src.inbattle==1){pp<<"It is now your turn!";pp.Turn = 1}
else return
while(pp.Turn)sleep(5)
else
if(istype(pp,/mob/monsters))
pp.MonsterAttack()
if(istype(pp,/mob/Allied))
pp.Allied()
while(1)
//You Attack
Phys()
if(src.ATTACK==1)
src.ATTACK=0
var/list/MonsterList=new()
for (var/mob/monsters/M in view())
if(M!=null)
if (M.Health > 0){MonsterList += M}
MonsterList += "Cancel"
var/mob/enemy = input("Attack who?") in MonsterList
if (enemy == "Cancel")
src.ATTACK=1
return
var/hitpercent=50+src.Dexterity
var/hitpercent2=hitpercent-enemy.Agility
if(hitpercent2>100) hitpercent2=100
if(hitpercent2<0) hitpercent=0
var/hitpercent3=rand(1,100)
var/damagefirst=rand(src.Strength)
var/damagecount=damagefirst-enemy.Defense
sleep(2)
src.ATTACK=1
flick("sparfury",src)
if(hitpercent3 <= hitpercent2)
if(damagecount > 0)
enemy.Health -= damagecount
src.attack=1
view()<<"<font size = 1>[src] Attacks [enemy] for [damagecount]"
if (enemy != null)
if (enemy.Health < 1)
if (istype(enemy,/mob/monsters)){enemy.icon = null}
src.Victory()
src.Turn = 0
else{view() << "<font size = 1>[usr]'s attack bounced off [enemy].";usr.Turn = 0}
else{view() << "<font size = 1>[usr] attacks [enemy], but misses.";usr.Turn = 0}
//Monster Attack
MonsterAttack()
var/ok=rand(1,2)
if(ok==1)
for (var/mob/Player in view())
if (Player.client && Player.Health > 0)
for (var/mob/M in view())
if (M.Bnum == Bnum && M.client)
var/hitpercent=50+src.Dexterity
var/hitpercent2=hitpercent - M.Agility
if(hitpercent2>100) hitpercent2 = 100
if(hitpercent2<0) hitpercent = 0
var/hitpercent3=rand(1,100)
var/damagefirst=rand(src.Strength)
var/damagecount=damagefirst-M.Defense
sleep(2)
if(hitpercent3 <= hitpercent2)
if(damagecount > 0){M.Health -= damagecount;view()<<"<font size = 1>[src] Attacks [M] for [damagecount]";M.DeathCheck()}
else{view() << "<font size = 1>[src]'s attack bounced off [M]."}
else{view() << "<font size = 1>[src] attacks [M], but misses."}
if(ok==2)
for (var/mob/Allied/M in view())
if (M.Health > 0)
if (M.Bnum == Bnum)
var/hitpercent=50+src.Dexterity
var/hitpercent2=hitpercent - M.Agility
if(hitpercent2>100) hitpercent2 = 100
if(hitpercent2<0) hitpercent = 0
var/hitpercent3=rand(1,100)
var/damagefirst=rand(src.Strength)
var/damagecount=damagefirst-M.Defense
sleep(2)
if(hitpercent3 <= hitpercent2)
if(damagecount > 0){M.Health -= damagecount;view()<<"<font size = 1>[src] Attacks [M] for [damagecount]";M.DeathCheck()}
else{view() << "<font size = 1>[src]'s attack bounced off [M]."}
else{view() << "<font size = 1>[src] attacks [M], but misses."}
else
for (var/mob/person/P in view())
if (P.client && P.Health > 0)
var/hitpercent=50+src.Dexterity
var/hitpercent2=hitpercent - P.Agility
if(hitpercent2>100) hitpercent2 = 100
if(hitpercent2<0) hitpercent = 0
var/hitpercent3=rand(1,100)
var/damagefirst=rand(src.Strength)
var/damagecount=damagefirst-M.Defense
sleep(2)
if(hitpercent3 <= hitpercent2)
if(damagecount > 0){P.Health -= damagecount;view()<<"<font size = 1>[src] Attacks [P] for [damagecount]";P.DeathCheck()}
else{view() << "<font size = 1>[src]'s attack bounced off [P]."}
else{view() << "<font size = 1>[src] attacks [M], but misses."}
Allied()
for (var/mob/monsters/P in view())
if (P.Health > 0)
if (P.Bnum == Bnum)
var/hitpercent=50+src.Dexterity
var/hitpercent2=hitpercent - P.Agility
if(hitpercent2>100) hitpercent2 = 100
if(hitpercent2<0) hitpercent = 0
var/hitpercent3=rand(1,100)
var/damagefirst=rand(src.Strength)
var/damagecount=damagefirst-P.Defense
sleep(2)
for (var/mob/person/A in view())
A.ATTACK=1
A.Turn=1
if(hitpercent3 <= hitpercent2)
if(damagecount > 0){P.Health -= damagecount;view()<<"<font size = 1>[src] Attacks [P] for [damagecount]";P.DeathCheck()}
else{view() << "<font size = 1>[src]'s attack bounced off [P]."}
else{view() << "<font size = 1>[src] attacks [P], but misses."}
//Run, Run RUN!!
Run()
if(src.ATTACK==1)
switch(rand(1,3))
if(3)
src<<'Doubt.mid'
sleep(19)
src<<"<font size = 1>You tryed to run, And Succeeded!"
src.inbattle=0
src.client.lazy_eye = 0
src.Bnum = 0
src.ATTACK=1
src.icon_state="walk"
src.battle=0
src.close_menu()
src.loc = locate(src.oldlocx,src.oldlocy,src.oldlocz)
for(var/mob/M in oview(5))
if(src==M) return
else
del M
src.Turn=0
src.icon_state="walk"
else
sleep(19)
src<<"<font size = 1>You tryed to run, but failed.";src.Turn=0
src.ATTACK=1
//When you die, aww
DeathCheck()
if(istype(src,/mob/person))
if(src.Health<=0)
for(var/mob/M in oview(5))
if(src==M) return
else
del M
src<<'Doubt.mid'
src.icon_state = null
src.client.lazy_eye = 0
src.loc = locate(4,5,1)
src.Bnum = 0
src.ATTACK=1
src.Turn = 0
src.battle=0
src.inbattle=0
src.close_menu()
src<<"you died"
src.icon_state="walk"
//Victory proc, when you win! DING DING
Victory()
var/mm=0
for(var/mob/monsters/M in oview(5))
if(M!=null)
if (M.Health > 0)
mm++
if(mm==0)
var/Gained_Exp
var/Gained_Zen
for(var/mob/monsters/M in oview(5))
Gained_Exp+=M.exp
Gained_Zen+=M.zenni
del M
var/k=rand(1,3)
if(k==1)
src<<sound('BattleEnd1.mid')
sleep(24)
if(k==2)
src<<sound('BattleEnd2.mid')
sleep(30)
if(k==3)
src<<sound('BattleEnd3.mid')
sleep(34)
src<<"Victory is at hand"
src<<"You Gained [Gained_Exp] Experience!, And [Gained_Zen] Zenni!"
src.close_menu()
src.ATTACK=1
src.zenni+=Gained_Zen
src.exp+=Gained_Exp
src.Leveling_up()
src.battle=0
src.icon_state="walk"
src.inbattle=0
src.client.lazy_eye = 0
src.Bnum = 0
src.icon_state="walk"
src.loc = locate(src.oldlocx,src.oldlocy,src.oldlocz)
//Level up proc
Leveling_up()
if(src.exp>=src.maxexp)
src<<"<B>You gained a level!"
src.Level++
src.exp=0
src.maxexp+=src.maxexp/5
src.Strength++
src<<"Strength + 1"
src.Defense++
src<<"Defense + 1"
var/HP=rand(15,20)
src.MaxHealth+=HP
src<<"Health + <b>[HP]</b>"
close_menu()
for(var/obj/text/O in client.screen)del O
for(var/obj/back/O in client.screen)del O
for(var/obj/menu/O in client.screen)del O
textonscreenbackground(var/Xcoord1, var/Ycoord1, var/Xcoord2, var/Ycoord2)
for(var/Xcoord=Xcoord1,Xcoord<=Xcoord2,Xcoord++)
for(var/Ycoord=Ycoord1,Ycoord<=Ycoord2,Ycoord++)
var/obj/back/background=new(client)
if(Xcoord==Xcoord1)background.icon_state="l"
if(Xcoord==Xcoord2)background.icon_state="r"
if(Ycoord==Ycoord1)background.icon_state="b"
if(Ycoord==Ycoord2)background.icon_state="t"
if(Xcoord==Xcoord1&&Ycoord==Ycoord1)background.icon_state="ll"
if(Xcoord==Xcoord2&&Ycoord==Ycoord2)background.icon_state="ur"
if(Xcoord==Xcoord1&&Ycoord==Ycoord2)background.icon_state="ul"
if(Xcoord==Xcoord2&&Ycoord==Ycoord1)background.icon_state="lr"
background.screen_loc="[Xcoord],[Ycoord]"
textonscreenTEXT(var/Xcoord1, var/Xcoord2, var/Ycoord1, var/Ycoord2,var/T)
var Xcoord=Xcoord1,Ycoord=Ycoord1
Textonscreenproc(T)
for(var/Y in textonscreenlist)
var/obj/text/characters=new(client)
if(Xcoord==round(Xcoord)&&Ycoord==round(Ycoord)) characters.screen_loc="[Xcoord],[Ycoord]"
else if(Xcoord!=round(Xcoord)&&Ycoord==round(Ycoord)) characters.screen_loc="[Xcoord-0.5]:16,[Ycoord]"
else if(Xcoord==round(Xcoord)&&Ycoord!=round(Ycoord)) characters.screen_loc="[Xcoord],[Ycoord-0.5]:+16"
else if(Xcoord!=round(Xcoord)&&Ycoord!=round(Ycoord)) characters.screen_loc="[Xcoord-0.5]:16,[Ycoord-0.5]:+16"
characters.icon_state="[Y]"
Xcoord+=0.5
if(Xcoord==Xcoord2)
Xcoord=Xcoord1;Ycoord-=0.5
if(Ycoord==Ycoord2-0.5)
break
Textonscreenproc(var/textonscreen)
textonscreenlist=list()
for(var/a=1,a<=length(textonscreen),a++)
textonscreenlist+=copytext(textonscreen,a,a+1)
1. Please make your subject line more specific next time.

2. Don't post masses of code on the forums. Work out which bits are relevant to the problem (in this case, attacking), and just post those bits. Occasionally people will wade through your entire post to find the probem(s), but more often they won't.
In response to Crispy
Crispy wrote:
1. Please make your subject line more specific next time.

2. Don't post masses of code on the forums. Work out which bits are relevant to the problem (in this case, attacking), and just post those bits. Occasionally people will wade through your entire post to find the probem(s), but more often they won't.

allright then, i will next time.
In response to Wanabe
Neaver mind, i fixed it, sorry for wasting peoples time.