escribano 
Journeyman

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

|
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 |
|
The following 2 users Like escribano's post:2 users Like escribano's post
darksun84 (07-19-2017), jexnico (05-20-2021)
|