ID:148831
 
When I activate Battle mode, it says it 3 times in a row, then I end it, and it says it 3 more times. I'm not sure whats wrong...

var/fight=0
client/Center()
if(!fight == 0) return
for(var/mob/M in get_step(mob,mob.dir))
mob.attack(M)

mob/GM/verb/BattleOn()
if(fight) return
for(var/mob/M in world)
fight = 1
usr<<"Battle Mode has Begun!"

mob/GM/verb/BattleOff()
if(!fight) return
for(var/mob/M in world)
fight = 0
usr<<"Battle Mode has Ended!"
There must be 3 mobs in the world.
In response to Mertek
I dont want it to say Battle Mode has Begun! more than once. What the heck is going on?
In response to Branks
Listen closely:

You see this piece of code in your verbs?

for(var/mob/M in world)

That means, "For every mob in the world, do what's under me."

Under that you have a message, so for every mob in the world, it will print that message.

If you get the message 3 times, there must be 3 mobs in the world.

Understand?
change:
usr<<"Battle Mode has Begun!"
to:
M<<"Battle Mode has Begun!"
i think you want to tell M that the battle has begun. Then it wont tell you that message 3 times
In response to Soori-99
Its already fixed, I corrected my mistakes by typing the code over and changing it