Tiles and Landtiles

Bug reports and feature requests. New features can only be added to the current development version. Bug-fixes may be back-ported.

Current release: 099 / Current development: 100
Locked
Harley
Forum Regular
Posts: 360
Joined: Sat Mar 18, 2006 1:41 am
Location: Germany

Tiles and Landtiles

Post by Harley »

Hi guys! There is a problem with '.landtile'

I have check for .landtiles in my mining.src:

Code: Select all

	var is_swamp, is_sand, is_minable;
	is_swamp := IsSwampLandscape( info.landtile );
	if (!is_swamp)
		is_minable := ExistMinableAt( use_on, who.realm );
		if (!is_minable)
			is_sand := IsSandLandscape( info.landtile );
			if (!is_sand)
				SendSysmessage(who, "You can't mine or dig anything there.");
				ReleaseItem(tool);
				UnlockAction( who );
				return;
			endif
		endif
	endif

When I stand on the ground where Z=0, my checks work good and I can mine.
But when I stand underground (where Z<0, for example -60), and on the surface is water tile (Z=0), there is error, I see msg "You can't mine or dig anything there." and can't mine.

Here is the example of my custom statics file.
Intotile bug.png
I think that this is very serious bug in core, cause it does not recognize Z level and it has to be fixed!
xeon
Forum Regular
Posts: 338
Joined: Fri Oct 31, 2008 3:18 am
Location: Italy

Re: Tiles and Landtiles

Post by xeon »

But... ExistMinableAt() and IsSandLandscape() are core functions or your functions?
Harley
Forum Regular
Posts: 360
Joined: Sat Mar 18, 2006 1:41 am
Location: Germany

Re: Tiles and Landtiles

Post by Harley »

xeon wrote: Thu Apr 20, 2017 12:34 am But... ExistMinableAt() and IsSandLandscape() are core functions or your functions?
Why are u asking for? I think you know all of POL functions)) They are custom.
Do you know how to help me with .landtile?
xeon
Forum Regular
Posts: 338
Joined: Fri Oct 31, 2008 3:18 am
Location: Italy

Re: Tiles and Landtiles

Post by xeon »

Yes, I would check inside these functions, maybe there's some scripting error :blush:
Turley
POL Developer
Posts: 670
Joined: Sun Feb 05, 2006 4:45 am

Re: Tiles and Landtiles

Post by Turley »

I guess at this position its wrong to check the landtile, you need to search for a static.
Add a print of ListStaticsAtLocation to know for sure.
Harley
Forum Regular
Posts: 360
Joined: Sat Mar 18, 2006 1:41 am
Location: Germany

Re: Tiles and Landtiles

Post by Harley »

xeon wrote: Thu Apr 20, 2017 11:51 pm Yes, I would check inside these functions, maybe there's some scripting error :blush:
I'm afraid I can't satisfy your request. These are our custom functions and we can't share them!

Turley, I'll check it and write.
xeon
Forum Regular
Posts: 338
Joined: Fri Oct 31, 2008 3:18 am
Location: Italy

Re: Tiles and Landtiles

Post by xeon »

Harley wrote: Fri Apr 21, 2017 10:56 am
xeon wrote: Thu Apr 20, 2017 11:51 pm Yes, I would check inside these functions, maybe there's some scripting error :blush:
I'm afraid I can't satisfy your request. These are our custom functions and we can't share them!

Turley, I'll check it and write.
Yes, that is why I suggested that you check them (not to post anything!) :P
Harley
Forum Regular
Posts: 360
Joined: Sat Mar 18, 2006 1:41 am
Location: Germany

Re: Tiles and Landtiles

Post by Harley »

I found the bug. Or maybe it isn't a bug, but!

Turley, I've checked your function, and it gaves me that one:
mining.src | ListStaticsAtLocation() : { struct{ hue = 0, objtype = 1339, x = 459, y = 3500, z = 0 } }
It is right objtype - type of the cave, but! Guys, look please here!

It's in function:

Code: Select all

	is_minable := ExistMinableAt( use_on, who.realm );
This function has:

Code: Select all

	var get_landtile := GetMapInfo( use_on.x, use_on.y, realm).landtile;
	if( IsLandscapeMinable( get_landtile ) )
In IsLandscapeMinable() are only .landtile graphics like

Code: Select all

if( ((landscape >= 0xDC )  && (landscape <= 0xDF ))  || 
	((landscape >= 0xE4 ) && (landscape <= 0xE7 )) ||
When I get print from GetMapInfo( use_on.x, use_on.y, realm).landtile:

Code: Select all

	print(" ExistMinableAt() | GetMapInfo() : " + GetMapInfo( use_on.x, use_on.y, realm) ); // DEBUG
I get this one:
ExistMinableAt() | GetMapInfo() : struct{ landtile = 283, z = 40 }
In the game, my character stand at z = 0

I checked too this function:

Code: Select all

	print(" ExistMinableAt() | GetStandingHeight() : " + GetStandingHeight( use_on.x, use_on.y, use_on.z, realm) ); // DEBUG
And it gives me right Z level:
ExistMinableAt() | GetStandingHeight() : struct{ z = 0 }

So! Tell me please, how can it be that check in GetMapInfo() gives MAX. Z level, not real?
How to fix it? Maybe worth adding to GetMapInfo check at what Z level click character?
And how to get .landtile except GetMapInfo()

With best regards!
Turley
POL Developer
Posts: 670
Joined: Sun Feb 05, 2006 4:45 am

Re: Tiles and Landtiles

Post by Turley »

You should reread the documentation. There is nothing in common between getMapInfo and GetStandingHeight.
GetMapInfo gives you just the map information (map.mul) for given location. GetStaticsAt* gives you the static information (statics*.mul).
GetStandingHeight returns you the lowest possible z where a human could stand from given start z.
For something like mining it makes sense to use targetcoordinates and check if at that location a static exists and if not if a maptile exists there.
Harley
Forum Regular
Posts: 360
Joined: Sat Mar 18, 2006 1:41 am
Location: Germany

Re: Tiles and Landtiles

Post by Harley »

Turley, thank u for ur answer.
I understand the difference between those functions.

This is info from our custom cave with max height 40 like you see.
mining.src | GetMapInfo() : struct{ landtile = 283, z = 40 }
mining.src | TargetCoordinates() : struct{ mobile = <appobj:MobileRef>, objtype = 400, realm = "britannia", x = 459, y = 3499, z = 0 }
mining.src | ListStaticsAtLocation() : { struct{ hue = 0, objtype = 1339, x = 459, y = 3499, z = 0 } }
On the top of this cave lies snow.
SnowCave.png
SnowCave.png (57.5 KiB) Viewed 7032 times
This is info from Minoc cave with max height 44
mining.src | GetMapInfo() : struct{ landtile = 558, z = 44 }
mining.src | TargetCoordinates() : struct{ mobile = <appobj:MobileRef>, objtype = 400, realm = "britannia", x = 2563, y = 488, z = 0 }
mining.src | ListStaticsAtLocation() : { struct{ hue = 0, objtype = 1339, x = 2563, y = 488, z = 0 } }
The top of this cave is mountains.
MinocCave.png
MinocCave.png (106.24 KiB) Viewed 7032 times
In our include:
function IsLandscapeMinable( landscape )
There are checks for landtiles.

Code: Select all

	if( ((landscape >= 0xDC )  && (landscape <= 0xDF ))  ||
	((landscape >= 0xE4 ) && (landscape <= 0xE7 )) || 
... - and else graphic types
		return 1;
	else
		return 0;
	endif
And all of that landtiles define Z level with function:
var info := GetMapInfo( use_on.x, use_on.y, realm );

Like I have shown in 1-st post:

Code: Select all

		is_minable := ExistMinableAt( use_on, who.realm );
		if (!is_minable)
			is_sand := IsSandLandscape( info.landtile );
			if (!is_sand)
				SendSysmessage(who, "You can't mine or dig anything there.");
				ReleaseItem(tool);
				UnlockAction( who );
				return;
			endif
		endif
So my question right is how to check landtile with out MAX Z level like gives GetMapInfo?
And why GetMapInfo gives MAX height Z level? Maybe there is some solution to resolve my problem?
Turley
POL Developer
Posts: 670
Joined: Sun Feb 05, 2006 4:45 am

Re: Tiles and Landtiles

Post by Turley »

Like I said before you cannot just check the landtiles you need to also check the statics.
GetMapHeight does not give you always the max z, there is no logic inside it just returns how your map looks like. Only one landtile can exist per coordinate, that's how the mapfiles work.
Harley
Forum Regular
Posts: 360
Joined: Sat Mar 18, 2006 1:41 am
Location: Germany

Re: Tiles and Landtiles

Post by Harley »

Turley wrote: Sat May 13, 2017 3:48 pm Like I said before you cannot just check the landtiles you need to also check the statics.
Have POL Server function like GetMapInfo for map but for statics?
Turley
POL Developer
Posts: 670
Joined: Sun Feb 05, 2006 4:45 am

Re: Tiles and Landtiles

Post by Turley »

ListStaticsAtLocation for example like I told you before :p
Locked