FANDOM


Created by Stragothemad.

Function Main()

Player = Actor()
Tree = ContextActor()
speed = Attribute(Player, "Speed")
cuttinglvl = Attribute(Player, "Woodcutting")
xp = Attribute(Player, "WoodcuttingXp")
;check for ore
If ActorGlobal(Tree, 1) = "1"
Output(Player, "This tree currently has no logs.")
Return
Endif
;check for pickaxe
If HasItem(Player, "Woodcutting axe", 1)
;wait for player to mine ore
time = rand(cuttinglvl * 60, cuttinglvl * 99)
wait = 10000-time
Output(Player, "You start chopping for Logs...")
SetAttribute(Player, "Speed", 0)
AnimateActor(Player, "Slash Right", 1.5)  ;Play anitmation for miss or hit.
AnimateActor(Player, "Slash Right", 1.5)   
;start mining
DoEvents(wait)
;finish mining
AnimateActor(Player, "Slash Right", 1.5)  ;Play anitmation for miss or hit.
AnimateActor(Player, "Slash Right", 1.5)
;what you recieve
chance = Rand(1, cuttinglvl + 3)
If chance = 1
Output(Player, "You failed to get Logs.")
Return
Endif
AnimateActor(Player, "Slash Right", 1.5)  ;Play anitmation for miss or hit.
AnimateActor(Player, "Slash Right", 1.5)
GiveItem(Player, "Oak Log", 1)
Output(Player, "You recieved a Oak log.")
If cuttinglvl <100
SetAttribute(Player, "WoodcuttingXp", xp + 10)
Endif
;get xp
xp = Attribute(Player, "WoodcuttingXp")
nextcuttinglvl = 50 * cuttinglvl
If xp <nextcuttinglvl
;wait for tree to get logs again (no level up)
SetActorGlobal(Tree, 1, "1")
DoEvents(7500)
SetActorGlobal(Tree, 1, "0")
Return
Endif
;level up
SetAttribute(Player, "Woodcutting", cuttinglvl + 1)
newlvl = cuttinglvl + 1
Output(Player, "You gain a level in Woodcutting!")
newxp = xp - nextcuttinglvl
SetAttribute(Player, "WoodcuttingXp", newxp)
SetMaxAttribute(Player, "WoodcuttingXp", newlvl * 50)
;wait for tree to get logs again
SetActorGlobal(Tree, 1, "1")
DoEvents(7500)
SetActorGlobal(Tree, 1, "0")
;no axe
Else
Output(Player, "You don't have a axe.")
Return
Endif
Return
End Function