ID:174893
 
im making a random battle code and two people can enter the same battle.

turf/var/randomnum
turf
battle
battlegrass
Entered()
randomnum= rand(1,100)
if(randomnum>=85)
usr.loc=locate(/turf/battle/battlegrounds)

battlegrounds

thats my code.. i believe the problem is the game doesnt know that the turf "battlegrounds" is already occupied. can anyone help me accomplish this?
As LummoxJR would probably point out eventually you're using usr in a proc which for the most part is wrong. To be on the safe side don't use usr anywhere except verbs. What you need to use is the parameter that Entered() passes in which is the atom that entered the turf.

For more information look up Entered() in the reference.
In response to Theodis
this is what i have come up with
turf/var/randomnum
turf
battle
battlegrass
Entered(mob/M as mob)
if(M.riding==0)//people on horses are safe.
randomnum= rand(1,100)
if(randomnum>=85)


M.Encounter()
else
return 0
battlegrounds

mob/proc
Encounter()
var/turf/Area
for(var/turf/battle/battlegrounds/L in world)
var/occupied=0
for (var/atom/A in L)
if(A.density==1)
occupied=1
if(!occupied)
Area=L
if(!Area)
return 0
src.Move(Area)

any problems that anyone can point out?
In response to Siefer
You need an
if(!ismob(M)) return
on the first line of your Entered() proc.