Sphereserver / Source-X

Ultima Online server emulator
Apache License 2.0
54 stars 40 forks source link

Archery itemdefs do not inherit range from ID they use #710

Open Soulless-1 opened 3 years ago

Soulless-1 commented 3 years ago

When you are using a bow with a different baseid than i_bow, say i_bow_test, and you attempt to use the archery butte @dclick won't trigger when you have it equipped. It does work for the standard i_bow though.

Jhobean commented 3 years ago

Would you share the script of your bow? it's working for me...

image

Jhobean commented 3 years ago

Ok I think I found the problem. You get the message you can't reach that?

If yes, it's because the range of your bow seem to not be define. Force a new range and test

If it,s not this message, I need more info and need to be able to reproduce

Soulless-1 commented 3 years ago

yeah you get the message "you can't reach that" right!

I fixed it on my end by adding range to the young player bow.

it should still trigger @dclick if range is not set imo , but if range isnt set perhaps it should use the ID default as well.

Jhobean commented 3 years ago

Dclick do not trig because you cant use the object. Afaik, if you dclick an item on the ground ( a stone for example), if you cant reach it you will not have the dclick trigger.

Jhobean commented 3 years ago

I'm agree your new bow should have the same range than the id= in the itemdef. Dont know why range follow with i_bow and not from different bow

Soulless-1 commented 3 years ago

I added this though on=@create canmask=can_i_dcignoredist

so i should be able to dclick it from anywhere

drk84 commented 3 years ago

can you send me the script of i_test_bow

Soulless-1 commented 3 years ago

This is with the range fix (range=2,10), i commented it out so you can see how it was before when it didnt work

defname=i_bow_young
defname2=i_bow_noob
id=i_bow
reqstr=0
value=0
weight=0
//range=2,10
tevents=+t_youngplayer_item
category=Custom
subsection=Newplayer Pack
description=Bow (youngplayer)

on=@create
HITPOINTS={50 60}
attr=attr_newbie
color=058b
Tolokio commented 1 year ago

It is weird, I don't find where archerybutte look for weapons range. It just check for distance betwen butte and archer. the issue got to be outside butte behaviour. seems that nolok fix something about this at 2018

The problem got to be here:

image ..... .... ... image

I dont know what could be failing but that last conditional is the only way to get "can't reach that" message.

I think this code was left behind on a update. range could be given without check for type or range. "CChar::Use_Train_ArcheryButte" already checks items and distance and even better...

image

It looks for ranged weapons. so throwing weapons or other type can be used as well. Code looks prepared for throwing weapons, ieven the anim of the weapon going back to owner. But it is not possible with the type's checks.

Should be nice to know whats happening, I got some bad theories, but I think thoose checks should be removed and range should be given automaticaly. Then checks throwing and do any fix needed.

image

Something like this,

Jhobean commented 1 year ago

@Tolokio you are proposing the archery bute will work for a fix distance? You have a bow max range 5 and it will work at 10 tiles?

It's what you propose? It was like this before?

Tolokio commented 1 year ago

I saw archery butte only works at 5 or at 6 tiles of distance.,Your bow got more distance than that. The range dosnt really matter at that moment. And the type's check is blocking throwing that is already coded.

I did a pull request where Im going to update fixes for people who wants to test and accelerate proccess. I did not test anything yet but any should work at least xD

xwerswoodx commented 9 months ago

It seems pretty simple issue, seems like if you don't define Range it doesn't collect it from the base bow directly so your range seems "1" while looking .xshow range. Not every data can be collected ids itself, for example, value, weight, skillmake, resources etc doesn't collected from id itself if not defined.

I don't know what's going on for that but at the moment if you don't set RangeH value, bow range is infinite, but you can't attack Butte which is the only thing works correctly in this case.

Anyway I can put that my todo list and check it later on to see what's the issue. But for butte it works fine, you have to define Range for weapons if you want to have range honestly, it works like how it should be.