ID:269514
 
This is not for an idle rpg. I'm making a building game, and it would be nice for the frequent players to have levels. I have certain building commands that people can abuse and destroy the map. I want it to count active time (not idling). how can i add these verbs when a player reaches a higher level. And how can i make it so the world times doesent count idlers?
mob/var
active=0//1 for the mob isn't active, 1 for he is
activecheck=20//when this is 0 mob/active becomes 0
activepoints=0//how long the mob has been active
level=1
world/New()
..()
spawn while(1)
sleep(10)
for(var/mob/M in world)
if(!M.client) continue
M.activecheck--
if(M.activecheck<=0)
M.activecheck=0
M.active=0
else
M.active=1
M.activepoints++
if(M.activepoints>=5)
M.activepoints-=5
M.level++

In response to CIB
problem

runtime error: Division by zero
proc name: Stat (/mob/Stat)
source file: Stat Panels.dm,5
usr: Xx Dark Wizard xX (/mob)
src: Xx Dark Wizard xX (/mob)
call stack:
Xx Dark Wizard xX (/mob): Stat()
runtime error: Division by zero
proc name: Stat (/mob/Stat)
source file: Stat Panels.dm,5
usr: Xx Dark Wizard xX (/mob)
src: Xx Dark Wizard xX (/mob)
call stack:
Xx Dark Wizard xX (/mob): Stat()
runtime error: Division by zero
proc name: Stat (/mob/Stat)
source file: Stat Panels.dm,5
usr: Xx Dark Wizard xX (/mob)
src: Xx Dark Wizard xX (/mob)


and code
mob/Stat()


statpanel("Status")
stat("Experience point's",(activepoints / activecheck))
stat("Level",level)
stat("Location",src.loc.loc)
stat(src)
stat("Gold",gold)
statpanel("World")

stat("World Host:", "[host]")
stat("World Address:", "[world.address]:[world.port]")
stat("World System:", "Windows XP")
stat("World Cpu:", "[world.cpu]%")
stat("World Lag:", "[world.tick_lag*100] ms")
var/online = 0
for(var/mob/M in world)
if(M.client)
online += 1
stat("People online:", "[online]")//after count show ppl online
statpanel("Inventory",contents)


mob/var
active=0
activecheck=20
activepoints=0
level=1
world/New()
..()
spawn while(1)
sleep(10)
for(var/mob/M in world)
if(!M.client) continue
M.activecheck--
if(M.activecheck<=0)
M.activecheck=0
M.active=0
else
M.active=1
M.activepoints+=1
if(M.activepoints>=50)
usr<<"You are nor level 2"
usr.level = 2
if(M.activepoints>=250)
usr<<"You are nor level 3"
usr.level = 3
if(M.activepoints>=500)
usr<<"You are nor level 4"
usr.level = 4
if(M.activepoints>=1000)
usr<<"You are nor level 5"
usr.level = 5


it takes like 2 seconds to gain a level and it producing that runtime error when the level exceeds 5
In response to Xx Dark Wizard xX
(bump)
In response to Xx Dark Wizard xX
edit

mob/Stat()


statpanel("Status")
stat("Level",level)
stat("XP",activepoints)
stat("Location",src.loc.loc)
stat(src)
stat("Gold",gold)
statpanel("World")

stat("World Host:", "[host]")
stat("World Address:", "[world.address]:[world.port]")
stat("World System:", "Windows XP")
stat("World Cpu:", "[world.cpu]%")
stat("World Lag:", "[world.tick_lag*100] ms")
var/online = 0
for(var/mob/M in world)
if(M.client)
online += 1
stat("People online:", "[online]")//after count show ppl online
statpanel("Inventory",contents)
var

host = "Xx Dark Wizard xX"
mob/var
active=0
activecheck=20
activepoints=0
level=1
world/New()
..()
spawn while(1)
sleep(1)
for(var/mob/M in world)
if(!M.client) continue
M.activecheck--
if(M.activecheck<=0)
M.activecheck=0
M.active=0
else
M.active=1
M.activepoints+=1
if(M.activepoints>50 && M.level == 1)
usr<<"You are now level 2"
M.level = 2
if(M.activepoints>=250 && M.level == 2)
usr<<"You are now level 3"
M.level = 3
if(M.activepoints>=500&& M.level == 3)
usr<<"You are now level 4"
M.level = 4
if(M.activepoints>=1000 && M.level == 4)
usr<<"You are now level 5"
M.level = 5

well once your xp gets to 19 it stops for some reason?


In response to Xx Dark Wizard xX
fixed