ID:179561
 
Ok in my game i got random combats in but i have one problem ,when you click on the monster the attack screen comes up so you can attack it(what i mean is i dont want ti to where you could click attack like a million times before the monster gos)
i have tried making a var (klik)
i make it if your klik = 0 then the main combat screen shows up and your klik gets to be 1 now, then i made it so when you attack yout klik gos down to 0 but that doesnt work
so can someone please help me out here
Thanks
Greg wrote:
Ok in my game i got random combats in but i have one problem ,when you click on the monster the attack screen comes up so you can attack it(what i mean is i dont want ti to where you could click attack like a million times before the monster gos)
i have tried making a var (klik)
i make it if your klik = 0 then the main combat screen shows up and your klik gets to be 1 now, then i made it so when you attack yout klik gos down to 0 but that doesnt work
so can someone please help me out here
Thanks

Is the klik var connected to your mob? The klik variable must be defined under mob. Make sure it looks something like this:
mob
  var
    klik

I think I need more information, but it seems like when you set klik to 0 again, there might be some confusion if you are in combat. If you can supply a short code snippet with the problem, it would be good.


/Andreas
In response to Gazoot
Yes i do have it assigned to a mob
here is a part of the code
mob
monster
slime
i have its vars here
Click()
if(usr.klik==0)
usr.klik = 1
maincombat(usr,src)
else
usr<<"Nothing happenes."
then i have the battle code here(just part of it)
attack(mob/attacker as mob, mob/target as mob)
attacker << "You chose to attack [src]"
if(prob(80))
normaldamage(attacker, target)
usr<<sound('Attack.wav',)
sleep(5)
usr<<sound('Hit.wav',)
usr.klik=0

i figured that this would work but it doesn't
so if you can figure out why and tell me. well just a big THANX
In response to Greg
Greg wrote:
Yes i do have it assigned to a mob
here is a part of the code
mob
monster
slime
i have its vars here
Click()
if(usr.klik==0)
usr.klik = 1
maincombat(usr,src)
else
usr<<"Nothing happenes."
then i have the battle code here(just part of it)
attack(mob/attacker as mob, mob/target as mob)
attacker << "You chose to attack [src]"
if(prob(80))
normaldamage(attacker, target)
usr<<sound('Attack.wav',)
sleep(5)
usr<<sound('Hit.wav',)
usr.klik=0

i figured that this would work but it doesn't
so if you can figure out why and tell me. well just a big THANX

Could it be that the klik is set to null instead of 0 in the beginning? Try changing "if(usr.klik==0)" to "if(!usr.klik)" and see what happens.

If that isn't the problem, it might be something in maincombat. Let me know!


/Andreas