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)
	 | 
	
		
		escribano   
		
			Journeyman 
			  
			
			
 
 
			
	Posts: 170 
	Likes Given: 16
 
Likes Received: 32 in 23 posts 
	Joined: Nov 2012
	
 Reputation: 2
  
			Dragon Shard
   
		
	 | 
	
		
 | 
	| 07-21-2017 05:15 AM | 
	
		
	 | 
	
	
		   
		 
		
	 | 
	
		
		oozy   
		
			Apprentice 
			  
			
			 
			
	Posts: 3 
	Likes Given: 0
 
Likes Received: 1 in 1 posts 
	Joined: Jul 2012
	
 Reputation: 0
  
			
 ![]()  
		
	 | 
	
		
			
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 | 
	
		
	 | 
	
	
		   
		The following 1 user Likes oozy's post:1 user Likes oozy's post 
		jexnico (05-21-2021)
	 |