Somebody knows why the GetStaticTilesArray or GetLandTilesArray functions are returning 0 tiles?
Im using the stealth 6.71.
Forum in READ ONLY mode! All questions and discussions on Discord official server, invite link: https://discord.gg/VxsGzJ7
GetStaticTilesArray returning 0 tiles
-
- Posts: 3
- Joined: 15.09.2015 2:23
Re: GetStaticTilesArray returning 0 tiles
i know. something incorrect.
when you give more info - i will give extended answer.
when you give more info - i will give extended answer.
"Пишите код так, как будто сопровождать его будет склонный к насилию психопат, который знает, где вы живете". (с) Макконнелл, "Совершенный код".
-
- Posts: 3
- Joined: 15.09.2015 2:23
Re: GetStaticTilesArray returning 0 tiles
Im sorry about that. Here is more info:Vizit0r wrote:i know. something incorrect.
when you give more info - i will give extended answer.
Stealth 6.7.1
Windows 8.1
UO Client 3.0.0c
Shard Files: http://santiagouo.com/Santiago_Files_08_22_2015.zip
UO Version: Mondans Legacy
Im using C# to code my script. Here is an simple example that I tried and returned nothing.
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));
}
I just make a simple copy and paste from this script: http://stealth.od.ua/forum/viewtopic.ph ... 869#p11455
Every else is working fine, but everything related with tiles dont. So I thought that my problem was in tiles.mul.. I changed it but nothing happened.
I also tried get details from an specific tile:
Code: Select all
var cell = Stealth.Default.GetCell(2100, 228, 1);
var detail = Stealth.Default.GetStaticTileData(cell.Tile);
Re: GetStaticTilesArray returning 0 tiles
write me in icq\skype. will see
"Пишите код так, как будто сопровождать его будет склонный к насилию психопат, который знает, где вы живете". (с) Макконнелл, "Совершенный код".
-
- Posts: 3
- Joined: 15.09.2015 2:23
Re: GetStaticTilesArray returning 0 tiles
What is your skype?
Re: GetStaticTilesArray returning 0 tiles
same nickname, city - Odessa
"Пишите код так, как будто сопровождать его будет склонный к насилию психопат, который знает, где вы живете". (с) Макконнелл, "Совершенный код".
-
- Posts: 1
- Joined: 08.04.2017 21:17
Re: GetStaticTilesArray returning 0 tiles
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);
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
Re: GetStaticTilesArray returning 0 tiles
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
for such tasks i would recommend you to not use the external context, it's a bit laggy due to protocol ports and so on. Stealth works directly with uo files, so if you want to have stable and fast calculations work in internal script context using or PAX or PS for solving your tasks.
keeping some distance is not very hard thing while you have some area of tiles around you as a geometry square with it's vertices so mob and you should be as far from each other as you command it to but you should always have 2 vertices in mind, one to reach it for now and one which you will reach next and the line between those vertices should not have same points as your waypoint array to reach the next vertex so in this way you will never face the mob, no need in a* or any pathing algorithms.
Ofcourse consider that it's only my opinion, not the way to implement your case.
I wish you luck!