var
Route1ShinySpawn=8000
Route1SpawnActive=0
Route1ReSpawn=0
list/Route1 = list()
list/NormalRoute1Pokemon=list("Charmander", "Bulbasuar", "Squirtle")
list/ShinyRoute1Pokemon=list("ShinyCharmander", "ShinyBulbasuar", "ShinySquirtle")
Route1Pokemon1
Route1Empty=1
mob/var
Route1=0
turf/PokemonSpawn
icon='Route.dmi'
Route1
density=0
Crossed(mob/A)
if(ismob(A) && A.client)
if(Route1SpawnActive<=0)
Route1SpawnActive+=1
Route1.Add(A)
Route1Empty=0
if(Route1SpawnActive==1)
if(Route1ReSpawn==0)
Route1Spawn()
..()
Route1DeSpawn
icon_state="TEST"
Crossed(mob/A)
if(ismob(A) && A.client)
if(A.dir==EAST||A.dir==NORTH)
Route1.Remove(A)
if(Route1.len==0)
sleep(40)
if(Route1.len==0)
if(Route1SpawnActive==1)
Route1SpawnActive=0
if(Route1.len==0)
if(Route1ReSpawn==1)
Route1ReSpawn=0
Route1Empty=1
for(var/mob/Route1Pokemon/P in world)
if(P)
del(P)
..()
Route1PokeBlock
Enter(mob/A)
if(ismob(A) && A.client)
return 1
else
return 0
proc
Route1Spawn()
spawn while(Route1SpawnActive&&!Route1ReSpawn&&!Route1Empty)
Route1ReSpawn=1
if(Route1.len==0)
Route1SpawnActive=0
for(var/mob/Route1Pokemon/P in world)
if(P)
del(P)
for(var/mob/M in Route1)
if(M.ShinyCharm==1)
Route1ShinySpawn=7000
var/ShinyChance=rand(1,Route1ShinySpawn)
if(ShinyChance==5000)
Route1Pokemon1=pick(ShinyRoute1Pokemon)
else
Route1Pokemon1=pick(NormalRoute1Pokemon)
if(Route1Pokemon1=="Charmander"){ var/mob/Route1Pokemon/Charmander/C = new;C.loc=M.loc }
if(Route1Pokemon1=="Bulbasuar"){ var/mob/Route1Pokemon/Bulbasuar/B= new;B.loc=M.loc }
if(Route1Pokemon1=="Squirtle"){ var/mob/Route1Pokemon/Squirtle/S = new;S.loc=M.loc }
if(Route1Pokemon1=="ShinyCharmander"){ var/mob/Route1Pokemon/ShinyCharmander/SC = new;SC.loc=M.loc }
if(Route1Pokemon1=="ShinyBulbasuar"){ var/mob/Route1Pokemon/ShinyBulbasuar/SB= new;SB.loc=M.loc }
if(Route1Pokemon1=="ShinySquirtle"){ var/mob/Route1Pokemon/ShinySquirtle/SS = new;SS.loc=M.loc }
if(Route1ReSpawn==1)
Route1ReSpawn=0
for(var/mob/Route1Pokemon/P in world)
if(P)
del(P)
sleep(40)
Problem description:
If player enters and stays in the timer works fine, if player leaves the timer works correctly
BUT if player enters then leaves then enters then leaves then enters say real fast the timers stack and it causes problems how do i fix this issue?
For your numbered vars those should all use lists. You may also want to use a single list, with datums that hold info about these things, rather than a list for each var.
Finally that block of ifs where you're basically copy-pasting the same code over and over: no good. If you had an associative list with name=type pairs, you could simply look up the type without all those ifs and it would perform much better.