The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm8 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm8 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm8 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Open your mind, make the impossible!
Author Message
escribano
Journeyman
*

Posts: 170
Likes Given: 16
Likes Received: 32 in 23 posts
Joined: Nov 2012
Reputation: 2

Dragon Shard

Post: #22
RE: Open your mind, make the impossible!
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][Image: image.png][Image: image.png]

UltimaPHP - OpenSource Ultima Online Server v0.1-pre-alpha under development, we need help!
(This post was last modified: 06-24-2015 06:11 PM by escribano.)
06-24-2015 04:14 PM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes escribano's post
Post Reply 


Messages In This Thread
RE: Open your mind, make the impossible! - escribano - 06-24-2015 04:14 PM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)