Sphereserver / Source-X

Ultima Online server emulator
Apache License 2.0
57 stars 45 forks source link

ISSTUCK #1240

Open Steinny opened 5 months ago

Steinny commented 5 months ago

27-09-04, Vjaka

does not work

Jhobean commented 5 months ago

@Steinny i use it in my script.

Move a NPC where there no map(black zone) it will return 1.

Place boulder rock around. Shoule work too.

How do you test it?

Steinny commented 5 months ago

and only underground withour ARGN!! - shows 1

Screenshot_1

Screenshot_2

Jhobean commented 5 months ago

Seem to only check static item.... Spawn NPC on a mountain and it work. Maybe we should evaluate added in game item...

Steinny commented 5 months ago

is the castle wall not static enough?

Jhobean commented 5 months ago

ON a quick check, server only evaluate if player can move... Static and in game intem shoud change nothing

bool CChar::IsStuck(bool fFreezeCheck)
{
    CPointMap pt = GetTopPoint();
    if ( fFreezeCheck && OnFreezeCheck() )
        return true;
    return !( CanMoveWalkTo(pt, true, true, DIR_N) || CanMoveWalkTo(pt, true, true, DIR_E) || CanMoveWalkTo(pt, true, true, DIR_S) || CanMoveWalkTo(pt, true, true, DIR_W) );
}
Steinny commented 5 months ago

as I see it without arguments

Steinny commented 5 months ago

ISSTUCK R Returns 1 if the character cannot walk in any direction.

this is not how this function works it checks for a specific!!!! tile where you stay on passability!!!

Jhobean commented 5 months ago

this is not how this function works it checks for a specific!!!! tile where you stay on passability!!!

Don't mad, what you propose? For me it's clear. When you char cannot move in any direction it return 1.

Apparently canmovewalkto do not consider some item on the path.

I use it on my custom spawn point. After I spawn a NPC, I check isstuck. If npc is spawned on water or on black area map, it return 1.(So it work correct on specific case)

Steinny commented 5 months ago

the function does not work as described Screenshot_1

Steinny commented 5 months ago

my self-written function where I just make the npc run in all directions works better and how it described in wiki ))

xwerswoodx commented 5 months ago

ISSTUCK isn't check the dir you are entering, it only checks if you can move in North, West, South or East, if you can walk any of these direction, it returns 0.

For Underground check, LLama can only not walk to left, so he can move other 3 directions, so yes return 0 is correct. For the half blocks, they are walkable, so llama can walk on them, so yes he can walk all directions 0 is correct. While you are in an item/wall/table etc. that blocks you to walk any side, it returns 1.

ISSTUCK means you can't walk any direction. Maybe you thought it shows only if he can walk to any direction but it's not for it. it's CANMOVE dir

image

Steinny commented 5 months ago

ISSTUCK isn't check the dir you are entering, it only checks if you can move in North, West, South or East, if you can walk any of these direction, it returns 0.

but it doesn't even work that way. he checks the passibility of the tile according to my test. look last screen

xwerswoodx commented 5 months ago

ISSTUCK isn't check the dir you are entering, it only checks if you can move in North, West, South or East, if you can walk any of these direction, it returns 0.

but it doesn't even work that way. he checks the passibility of the tile according to my test. look last screen

I am testing it on my sphere, and it works fine for me, it doesn't return 0 when I am in a table, do you have any function named ISSTUCK that overrides default behaviour?

image

Steinny commented 5 months ago

Strange. NO. I do all my functions like f_function

xwerswoodx commented 5 months ago

Okay, I think I find out the issue, let me check, Okay I will take a note for this issue, I will check it in next pr.

Tolokio commented 1 month ago

I see no issue.

IsStuck-> If npc can walk on any direction, it is not stuck, so it return 0

image

Im not sure if thoose are walls. I think they are consider as stairs ("bridge" in tiledata) I think if u say "all come" npc can walk on it even if players is not able. Did not test it and not sure but I think npcs can climb thoose.

image No args accepted for isstuck as werswood said.

Tolokio commented 1 month ago

Okay, I think I find out the issue, let me check, Okay I will take a note for this issue, I will check it in next pr.

What did you find?

image

Is this height related?

image

is correct that isStuck always check OnFreezeCheck()?