Extreme... really nice work!!!
I used this base statics tree remover, with some improvements to some areas i've found bugged... dude.. thanks so much!!!
Now, i would like to share the "base" script for a lumber system the chopped tree:
But before, keep in mind that:
1) The script will just run if you made all the configurations that Extreme says and used the program that Feeh shared to remove the trees from your UO files!
2) The script is just a BASE script, to do the animations... re-spawn the tree and stuff..
3) You NEED TO KEEP on sphere your ORIGINAL .mul files... so sphere can calculate the position of the trees and u will not have clients bugged!
Allright... so here is what this really do:
- On the fist knock removes the leaves (if have)
- If the tree that have the leaves removed is not chopped in 3 minutes, the leaves will grow.
- If you do the second knock, the tree will fall dawn, creating 3 tiles of a chopped tree (5 minutes timer) and a stump of the tree
- This stump will be chopped for 15 minutes then it will grow again!
What this script DON'T do:
- Animations [Doing Now.... scroll down for updated code]
- Sounds [Doing Now.... scroll down for updated code]
- Lumberjacking
I made this script to test the theory.. 1 hour of coding.. so i dont recommend to use this on a production shard before make MUCH changes!
I tryied to make the script best clever possible, so it uses the tree ID's to re-grow... no need of thousends of IF/ELSES for each tree type... so enjoy, and if u make this code better... share to the community!
See yah!
Code:
[TYPEDEF t_tree]
ON=@Timer
if !(<tag0.leaves> == 0)
serv.newitem <tag0.leaves>
new.p = <p>
new.update
endif
return 1
[TYPEDEF t_tree_growing]
ON=@TIMER
serv.newitem <tag0.tree>
new.p = <p>
new.update
if !(<tag0.leaves> == 0)
serv.newitem <tag0.leaves>
new.p = <p>
new.update
endif
remove
return 1
[TYPEDEF t_tree_chopped]
ON=@Timer
remove
[TYPEDEF t_weapon_axe]
ON=@TargOn_Item
if (<argo.distance <src>> > 1)
src.sysmessage You need to get closer to the tree
elif (<argo.type> == t_tree_chopped)
// chopped tree, lumberjacking here!
elif (<argo.type> == t_tree_growing)
// growing tree
src.sysmessage This tree is not ready to be chopped!
elif (<argo.type> == t_tree) || (<argo.type> == t_foliage)
local.pos.x = <argo.p.x>
local.pos.y = <argo.p.y>
local.pos.z = <argo.p.z>
local.leaves = 0
local.tree = 0
// Check if have leaves and trees (bugfix)
foritems x 1
if (<p.x> == <local.pos.x>) && (<p.y> == <local.pos.y>)
if (<type> == t_foliage)
local.leaves = <uid>
endif
if (<type> == t_tree)
local.tree = <uid>
endif
endif
endfor
if !(<local.leaves> == 0) && !(<local.tree> == 0)
// If there is leaves, remove it fist saving on tree the ID for later growing
foritems 1
if (<type> == t_foliage)
remove
endif
endif
TRY UID.<local.tree>.timer = 180 // 3 mim
TRY UID.<local.tree>.tag0.leaves = <uid.<local.leaves>.baseid>
elif !(<local.leaves> == 1) && !(<local.tree> == 0)
// If there is no leaves, take the tree down
foritems 1
if (<type> == t_tree)
local.tree = <baseid>
local.leaves = <tag0.leaves>
remove
endif
endfor
if !(<local.tree> == 0)
serv.newitem 0e57
new.tag0.tree = <local.tree>
new.tag0.leaves = <local.leaves>
new.p <eval <local.pos.x>>,<eval <local.pos.y>>,<eval <local.pos.z>>
new.type t_tree_growing
new.timer 900 // 15 mim
serv.newitem 0cf5
new.type t_tree_chopped
new.timer 300 // 5 mim
new.p <eval <local.pos.x> - 3>,<eval <local.pos.y>>,<eval <local.pos.z>>
new.update
serv.newitem 0cf6
new.type t_tree_chopped
new.timer 300 // 5 mim
new.p <eval <local.pos.x> - 2>,<eval <local.pos.y>>,<eval <local.pos.z>>
new.update
serv.newitem 0cf7
new.type t_tree_chopped
new.timer 300 // 5 mim
new.p <eval <local.pos.x> - 1>,<eval <local.pos.y>>,<eval <local.pos.z>>
new.update
endif
endif
else
src.sysmessage Use your axe on trees!
endif
return 1
![[Image: image.png]](http://s1.postimg.org/yxwy83mxb/image.png)
![[Image: image.png]](http://s1.postimg.org/5u8qbuytr/image.png)