Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fixing wrong Z position
Author Message
escribano
Journeyman
*

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

Dragon Shard

Post: #1
Tongue Fixing wrong Z position
Have you ever tried to create an object/mobile at random places and figured out your items has been added underground? or get stuck trying to detecting the correctly Z point to add some item?

Ok... me too! but not anymore!!!

Code:
[FUNCTION f_fix_z]
local.z = <z>
local.tz = <serv.map(<p.x>,<p.y>).terrain.z>

if (<abs <eval (<local.z> - <local.tz>)>> < 10)
    z <local.tz>
else
    local.z <local.tz>
    for x 1 <serv.map(<p.x>,<p.y>).statics>
        if (<abs <eval (<local.z> - <serv.map(<p.x>,<p.y>).statics.<local.x>.z>)>> < 10)
            local.z <serv.map(<p.x>,<p.y>).statics.<local.x>.z>
        endif
    endfor

    z <local.z>
endif

To use it, just need to call in any item or mobile after create at the desired position...

The script will try to detect the correct Z position at X,Y based on:

- The land Z point
- The item Z point before the function (in case the item is added in structures with more than 1 floor)
- The possible view/climbable height

So... there is a lot do in this script, but.... it helped me A LOT!

UltimaPHP - OpenSource Ultima Online Server v0.1-pre-alpha under development, we need help!
07-19-2017 01:59 AM
Find all posts by this user Like Post Quote this message in a reply
[+] 2 users Like escribano's post
amonvangrell
Banned

Posts: 338
Likes Given: 17
Likes Received: 32 in 20 posts
Joined: Aug 2012

britannia shard

Post: #2
RE: Fixing wrong Z position
Nice!
07-19-2017 07:20 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
escribano
Journeyman
*

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

Dragon Shard

Post: #3
RE: Fixing wrong Z position
Thanks Amon!!!

Hope it helps Smile

UltimaPHP - OpenSource Ultima Online Server v0.1-pre-alpha under development, we need help!
07-21-2017 05:15 AM
Find all posts by this user Like Post Quote this message in a reply
oozy
Apprentice
*

Posts: 3
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Jul 2012
Reputation: 0



Post: #4
RE: Fixing wrong Z position
Really helpful thing. But what with situation when we have more than one static items in on location? Maybe f_fix_z function need something like that?
Code:
IF (<SERV.MAP(<p.x>,<p.y>).STATICS>)
FOR X 1 <SERV.MAP(<p.x>,<p.y>).STATICS>
LOCAL.Z=<EVAL <DLOCAL.Z>+<SERV.MAP(<p.x>,<p.y>).STATICS.<DLOCAL.X>.Z>>
ENDFOR
ENDIF
03-22-2018 10:27 PM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes oozy's post
Post Reply 


Forum Jump:


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