ID:139410
 
Code:
Evergreentree1
name="Evergreen Tree"
icon = 'Turfs2.dmi'
icon_state = "305"
density = 1
verb
Cut()
set category="Commands"
set src in oview(2)
var/mob/players/M
M=usr
var/obj/Woodcutting/axes/Ironaxe=locate(/obj/Woodcutting/axes/Ironaxe)in usr.contents
if(Ironaxe)
if(!usr.Doing)
if(M.Fatique>=5)
if(M.tired==0)
usr<<"You start cutting the tree."
usr.Doing=1
M.FatiqueActivate()
if(M.woodcuttinglevel>=1)
if(prob(20))
var/obj/Logs/Evergeenlog/temp_pot = new()
temp_pot.ShopGet(usr,temp_pot,1)
M.wexp+=5
M<<"You cut a piece of wood!"
WoodcuttingCheck()
usr.Doing=0
else NoCut()



mob
proc
Fatique()
var/mob/players/M
M=usr
if(M.fatiquestop==0)
if(usr.Doing==1)
M.Fatique-=1
sleep(10+M.adventurelevel)
if(M.Fatique>=5)
Fatique()
else
M<<"You're too tired to cut right now, rest please."
M.tired=1
FatiqueActivate()
var/mob/players/M
M=usr
M.fatiquestop=0
if(M.fatiqueclock==0)
Fatiqueclock()
else
Fatique()
Fatiqueclock()
var/mob/players/M
M=usr
M.fatiqueclock=1
FatiqueActivate()
sleep(50)
M.fatiquestop=1


Problem description: The idea is that when a player is cutting the tree his fatique goes down by 1 every .. time. Now i coded the whole think but the problem is de fatique the fatique does go down but the rest of the code wont follow it stays with decreasing fatique. I hope this is explained correctly if you have a question about it reply pls ill watch this topic closely

The problem is that FatigueActivate() must complete before Cut() can finish. If you added "spawn() " before FatigueActivate(), that would make it work properly (well, more properly, it looks like you might be doing the same thing in your fatigue proc).

Also, instead of checking if a value is 1, you can just use if(var), which will check if the value is true (any value except 0, null, or ""). Conversely, instead of checking if a value is 0, you can use if(!var) to see if var is false (0, "", or null). Of course, this doesn't usually work if you're using more than 0 and 1 for values, but I think you'd be good here.
In response to Jeff8500
It worked thank you very much!
The only think what was missing was the spawn(), really thank you alot!