Author Topic: CheckLOS function broken?  (Read 5688 times)

0 Members and 1 Guest are viewing this topic.

Offline playforfunTopic starter

  • Restricted
  • **
  • Posts: 28
  • Activity:
    0%
  • Reputation Power: 1
  • playforfun has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
CheckLOS function broken?
« on: September 03, 2016, 01:14:49 PM »
0
Hello, I'm trying to use the function CheckLOS. But it seems not to work, anybody else having this issue?

It's always returning False, even if I'm clearly in LOS.

Code: [Select]
if checkLOS(GetX(self), GetY(self), GetZ(self), GetX(test), GetY(test), GetZ(test), WorldNum) then
  AddToSystemJournal('Target is in sight!');
« Last Edit: September 03, 2016, 01:40:49 PM by playforfun »

Offline Crome969

  • Moderator
  • *
  • *****
  • Posts: 2098
  • Activity:
    0%
  • Reputation Power: 25
  • Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.
  • Gender: Male
  • UO Enthusiast
  • Respect: +211
  • Referrals: 10
    • View Profile
    • ScriptSDK
Re: CheckLOS function broken?
« Reply #1 on: September 04, 2016, 12:04:50 AM »
0
As far i remember, los calculation on stealth is based on runuo code. Not sure if this is still acurate & its not SDK but stealth framework part..

Offline playforfunTopic starter

  • Restricted
  • **
  • Posts: 28
  • Activity:
    0%
  • Reputation Power: 1
  • playforfun has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: CheckLOS function broken?
« Reply #2 on: September 04, 2016, 06:50:22 PM »
0
hmm I'm playing on a RunUO server.

I guess I will have to create my own LOS Function, I'm guessing the function is determining if it's in sight based off range and the tile between the two targets?

Offline Crome969

  • Moderator
  • *
  • *****
  • Posts: 2098
  • Activity:
    0%
  • Reputation Power: 25
  • Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.
  • Gender: Male
  • UO Enthusiast
  • Respect: +211
  • Referrals: 10
    • View Profile
    • ScriptSDK
Re: CheckLOS function broken?
« Reply #3 on: September 05, 2016, 01:50:24 AM »
0
hmm I'm playing on a RunUO server.

I guess I will have to create my own LOS Function, I'm guessing the function is determining if it's in sight based off range and the tile between the two targets?

Best idea is download runuo\servuo source and check that source, then adapt it.. Thats how i wrote SDK and XScript Framework. The structure is pretty good and it allows to design stuff on a good oop level.

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: CheckLOS function broken?
« Reply #4 on: September 05, 2016, 09:18:41 AM »
0
Best idea is download runuo\servuo source and check that source, then adapt it.. Thats how i wrote SDK and XScript Framework. The structure is pretty good and it allows to design stuff on a good oop level.

Translation: Good Roswell-launching platform!  ;)

#littlegreymencode
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline Boydon

  • Moderator
  • **
  • *****
  • Posts: 76
  • Activity:
    0%
  • Reputation Power: 3
  • Boydon has no influence.
  • Respect: +16
  • Referrals: 0
    • View Profile
Re: CheckLOS function broken?
« Reply #5 on: September 11, 2016, 08:55:51 AM »
0
In standard Pascal script you have to choose the type of emulator your are working with.

Code: [Select]
TLOSCheckType = (losSphere = 1, losSphereAdv = 2, losPOL = 3, losRunUO = 4);
TLOSCheckOption = (losSphereCheckCorners, losPolUseNoShoot, losPolLOSThroughWindow);
TLOSCheckOptions = set of TLOSCheckOption;

Not sure this is exported to external script though...

Modification post edit

I've checked and this seems to be related on the way ScriptSDK is exporting the CheckLOS function. If you look at the stealth_script.pas that is packed with the standard Stelath distro you'll see that the function is exported as following:

Code: [Select]
function Script_CheckLOS(xf, yf : Word; zf : ShortInt; xt, yt : Word; zt : ShortInt; WorldNum : Byte; LOSCheckType : Byte; LOSOptions : Cardinal) : Boolean; stdcall; external ConstScriptDLL name 'Script_CheckLOS';

and the used like this:

Code: [Select]
function TMover.CheckLOS(xf, yf : Word; zf : ShortInt; xt, yt : Word; zt : ShortInt; WorldNum : Byte; LOSCheckType : TLOSCheckType; LOSCheckOptions : TLOSCheckOptions) : Boolean;
var LOSOptions : Cardinal;
begin
LOSOptions := 0;
if losSphereCheckCorners in LOSCheckOptions then
  LOSOptions := $100;
if losPolUseNoShoot in LOSCheckOptions then
  LOSOptions := LOSOptions OR $200;
if losPolLOSThroughWindow in LOSCheckOptions then
  LOSOptions := LOSOptions OR $400;
  Result := Script_CheckLOS(xf, yf, zf, xt, yt, zt, WorldNum,Byte(LOSCheckType),LOSOptions);
end;

@Chrome969
Maybe you should review the ScriptSDK source on this: last two parameters (LOSCheckType and LOSOptions) are missing ;)
« Last Edit: September 11, 2016, 09:26:54 AM by Boydon »
Member of the Stealth development team.

Offline playforfunTopic starter

  • Restricted
  • **
  • Posts: 28
  • Activity:
    0%
  • Reputation Power: 1
  • playforfun has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: CheckLOS function broken?
« Reply #6 on: September 17, 2016, 12:23:37 AM »
0
Nice find, I tried to add the missing parameters but stealth doesn't recognize them and says I have too many =(

Tags: