GetStaticTilesArray returning 0 tiles
Posted: 15.09.2015 2:28
Somebody knows why the GetStaticTilesArray or GetLandTilesArray functions are returning 0 tiles?
Im using the stealth 6.71.
Im using the stealth 6.71.
Альтернативный клиент Ultima Online
https://stealth.od.ua/forum/
Im sorry about that. Here is more info:Vizit0r wrote:i know. something incorrect.
when you give more info - i will give extended answer.
Code: Select all
ushort xmin = (ushort)(Self.X - 10),
ymin = (ushort)(Self.Y - 10),
xmax = (ushort)(Self.X + 10),
ymax = (ushort)(Self.Y + 10);
byte worldNum = Stealth.Default.GetWorldNum();
List<FoundTile> listTiles = new List<FoundTile>();
for (ushort i = 1339; i <= 1359; i++)
{
listTiles.AddRange(Stealth.Default.GetStaticTilesArray(xmin, ymin, xmax, ymax, worldNum, i));
}
Code: Select all
var cell = Stealth.Default.GetCell(2100, 228, 1);
var detail = Stealth.Default.GetStaticTileData(cell.Tile);
hey man, do you solved the problem?Vizit0r wrote:same nickname, city - Odessa
Code: Select all
statlist = TileReader.ReadStaticsXY(x, y, world);
std = TileReader.GetStaticTileData(statlist[0].Tile);
tdf = TileReader.ConvertFlagsToFlagSet(TileFlagsType.Static, statlist[0].Tile);
Code: Select all
public static object MarshalToObject(this byte[] buffer, Type type)
{
object target = null;
if (type.GetInterfaces().Any(intf => intf == typeof(IDeserialized)))
{
target = Activator.CreateInstance(type);
using(MemoryStream str = new MemoryStream(buffer))
using (BinaryReader br = new BinaryReader(str))
{
(target as IDeserialized).Deserialize(br);
}
}
else
{
int size = buffer.Length;
GCHandle gcHandle = GCHandle.Alloc(buffer, GCHandleType.Pinned);
IntPtr ptr = Marshal.UnsafeAddrOfPinnedArrayElement(buffer, 0);
target = Marshal.PtrToStructure(ptr, type); <<====== HERE: ArgumentException: An unhandled exception of type 'System.ArgumentException' occurred in mscorlib.dll. type -> {Name = "TileDataFlags" FullName = "StealthAPI.TileDataFlags"}
gcHandle.Free();
}
return target;
}
Hey!Test3imolesi wrote:hey man, do you solved the problem?Vizit0r wrote:same nickname, city - Odessa
Im in trouble too, with the exactly same problem. But im tryed the tileType from 0 to 20000;
I cant use anything of TileReader:
The ConvertDataTileFlags() causes error:
Code: Select all
statlist = TileReader.ReadStaticsXY(x, y, world); std = TileReader.GetStaticTileData(statlist[0].Tile); tdf = TileReader.ConvertFlagsToFlagSet(TileFlagsType.Static, statlist[0].Tile);
Resuming:Code: Select all
public static object MarshalToObject(this byte[] buffer, Type type) { object target = null; if (type.GetInterfaces().Any(intf => intf == typeof(IDeserialized))) { target = Activator.CreateInstance(type); using(MemoryStream str = new MemoryStream(buffer)) using (BinaryReader br = new BinaryReader(str)) { (target as IDeserialized).Deserialize(br); } } else { int size = buffer.Length; GCHandle gcHandle = GCHandle.Alloc(buffer, GCHandleType.Pinned); IntPtr ptr = Marshal.UnsafeAddrOfPinnedArrayElement(buffer, 0); target = Marshal.PtrToStructure(ptr, type); <<====== HERE: ArgumentException: An unhandled exception of type 'System.ArgumentException' occurred in mscorlib.dll. type -> {Name = "TileDataFlags" FullName = "StealthAPI.TileDataFlags"} gcHandle.Free(); } return target; }
I need to read the map tiles around my char and check if it is walkable. Whats the best way to do this?
Im creating a bot that will attack monsters keeping some distance from them
I will apply A* pathfinding algorithm to decide which is the better location to go.
Tried to use the TileReader.IsWorldCellPassable but its just an "line of sight" and its too slow.
thankz in advance