SphereServer BugTracker - SphereServer
View Issue Details
0001693SphereServerexecutable - genericpublic21-12-09 12:2213-03-11 03:34
nolok 
MrSugarCube 
normalfeaturealways
closedsuspended 
20-09-2009, 0.56b Prerelease 
0.56c Nightly 
20-09-2009
WalkCheck
None
0001693: Problem with CanSeeLOSFlag
Hi all :)
Every time i use canseelosflag, with any flag, with advancedlos in sphere.ini set to 0,01,02 or 03, or these experimental flags (walkcheck,diagonalwalkcheck,newpositionchecks) all or some activated, so in ALL cases, it returns 0.

Waiting a response/new build :)
No tags attached.
jpg cansee.JPG (317,765) 22-12-09 11:18
http://tracker.sphere.torfo.org/bugs/file_download.php?file_id=27&type=bug
Issue History
21-12-09 12:22nolokNew Issue
21-12-09 12:22nolokNightly Version => 20-09-2009
21-12-09 12:22nolokExperimental Flags => WalkCheck
21-12-09 12:22nolokOption Flags => None
21-12-09 20:30MrSugarCubeStatusnew => resolved
21-12-09 20:30MrSugarCubeFixed in Version => 0.56c Nightly
21-12-09 20:30MrSugarCubeResolutionopen => fixed
21-12-09 20:30MrSugarCubeAssigned To => MrSugarCube
22-12-09 10:51nolokStatusresolved => feedback
22-12-09 10:51nolokResolutionfixed => reopened
22-12-09 10:51nolokNote Added: 0000341
22-12-09 10:58nolokNote Edited: 0000341
22-12-09 11:17nolokNote Edited: 0000341
22-12-09 11:18nolokFile Added: cansee.JPG
22-12-09 11:19nolokNote Edited: 0000341
22-12-09 11:22nolokNote Edited: 0000341
22-12-09 11:42nolokNote Edited: 0000341
22-12-09 11:55nolokNote Edited: 0000341
22-12-09 11:56nolokNote Edited: 0000341
22-12-09 12:01nolokNote Edited: 0000341
02-01-10 04:30MrSugarCubeStatusfeedback => resolved
02-01-10 04:30MrSugarCubeResolutionreopened => fixed
02-01-10 04:30MrSugarCubeNote Added: 0000345
02-01-10 18:58nolokStatusresolved => feedback
02-01-10 18:58nolokResolutionfixed => reopened
02-01-10 18:58nolokNote Added: 0000346
11-03-10 18:48HOCOKNote Added: 0000402
22-01-11 02:56MrSugarCubeNote Added: 0000854
22-01-11 03:07MrSugarCubeNote Added: 0000855
13-03-11 03:33MrSugarCubeStatusfeedback => closed
13-03-11 03:33MrSugarCubeAssigned ToMrSugarCube =>
13-03-11 03:33MrSugarCubeResolutionreopened => suspended
13-03-11 03:33MrSugarCubeFixed in Version0.56c Nightly =>
13-03-11 03:34MrSugarCubeAssigned To => MrSugarCube
13-03-11 03:34MrSugarCubeFixed in Version => 0.56c Nightly

Notes
(0000341)
nolok   
22-12-09 10:51   
(edited on: 22-12-09 12:01)
Now it works, but only if i use this:
<SRC.CANSEELOSFLAG 020|040|080,<UID>>
If i use: <CANSEELOSFLAG 020|040|080,<SRC.UID>>, it doesn't work. I think it's strange, because in the sphere.ini the AdvancedLos flag is set to 03 :P

// Uses the new LoS algorithm
// ADVANCEDLOS_DISABLED 0x00 // Disabled, use the old method
// ADVANCEDLOS_PLAYER 0x01 // Enabled only for players
// ADVANCEDLOS_NPC 0x02 // Enabled only for NPCs
AdvancedLos=03

EDIT: It works even if AdvancedLos setted to 0, it's a bug or it's wanted? I remember nazghul wrote that should not work without this flag, because canseelosflag uses new algorithms and so on :P

EDIT 2: If i am in gm mode, canseelosflag returns always 1, and it's correct. But, with any flag (also with 0, and with this flag it should return always 1, because i dont't set any block to the los), without the gm mode, it still returns zero :( (this time advancedlos is set to 03)

(0000345)
MrSugarCube   
02-01-10 04:30   
With AdvancedLos disabled, CANSEELOSFLAG will still 'work' but the flags will be ignored (basically functions the same as CANSEELOS would).

As far as I can tell, without the flags (or flags=0), normal LOS checks will take place, so a wall would cause the function to return 0 unless the appropriate 'no-block' flags have been passed in.
(0000346)
nolok   
02-01-10 18:58   
I tried also with all no-block flags, and i am really near the npc or above it.
This function doesn't work, since i have AdvancedLOS=03 and no walls or any type of obstacles between us.
(0000402)
HOCOK   
11-03-10 18:48   
CanSeeLosFlag works incorrect.

NPC|Rock|Player
-------------------------
Troll|0136d|Player

All flags returning: 1
(0000854)
MrSugarCube   
22-01-11 02:56   
I still can't see anything wrong with the way CANSEELOSFLAG works - is this still an issue on the latest builds?


Here's a function which may help if you can find a location where you believe the flags don't work correctly. When you use this function a number of tiles are created around your character coloured blue or red to indicate the result of CANSEELOSFLAG (blue=can see, red=cannot see).

//
// Usage: F_TestLos <Flags> <Distance=8> <Time=10>
// Flags = flags to pass to CANSEELOSFLAG (default 0)
// Distance = distance to show los (default 8)
// Time = time before items decay (default 10)
//
[FUNCTION f_testlos]
IF (<ISGM>)
    SYSMESSAGE Please switch off GM mode before using this function.
    RETURN
ENDIF

LOCAL.FLAGS = <ARGN1>
LOCAL.DIST = <ARGN2>
LOCAL.TIME = <ARGN3>
IF !(<LOCAL.DIST>)
    LOCAL.DIST = 8
ENDIF
IF (<LOCAL.TIME> < 1)
    LOCAL.TIME = 10
ENDIF

FOR x -<LOCAL.DIST> <LOCAL.DIST>
    FOR y -<LOCAL.DIST> <LOCAL.DIST>
        LOCAL.PX = <EVAL <P.X> + <LOCAL.X>>
        LOCAL.PY = <EVAL <P.Y> + <LOCAL.Y>>

        IF (<CANSEELOSFLAG <LOCAL.FLAGS>, <dLOCAL.PX>,<dLOCAL.PY>,<P.Z>,<P.MAP>>)
            LOCAL.HUE = 02
            LOCAL.CANSEE += 1
        ELSE
            LOCAL.HUE = 022
        ENDIF

        SERV.NEWITEM i_rune_alchem_4
        REF1 = <NEW.UID>
        REF1.COLOR = <LOCAL.HUE>
        REF1.TYPE = t_normal
        REF1.ATTR = attr_decay
        REF1.TIMER = <LOCAL.TIME>
        REF1.P <dLOCAL.PX>,<dLOCAL.PY>,<P.Z>,<P.MAP>

        LOCAL.COUNT += 1
    ENDFOR
ENDFOR
SYSMESSAGE Can see <dLOCAL.CANSEE>/<dLOCAL.COUNT> tiles.
RETURN
(0000855)
MrSugarCube   
22-01-11 03:07   
When AdvancedLos is enabled the height of objects is taken into consideration, therefore I would expect CANSEELOS/CANSEELOSFLAG to return 1 for the Troll-Rock-Player example. In the default script pack the player (height=16) can see over the rock (height=2) to view the troll (height=23).