I have been looking at map:checkLineOfSight() and map:checkLineOfFire(). These are very powerful. Both of them take 5 parameters and I am unsure about what the 5th one is.
The 1st four are: x1, y1, x2, y2
The last one is a number too though I am about 80% sure it is treated like a boolean. I seems that if the value is 0, then both of the commands report false when things block. A non-zero value means they report true more often. But exactly when I am not sure of.
Below are my findings for each, taking into account 0 and non-zero for the last parm:
CheckLineOfSight():
Will always report false on wall block
Will always report true, meaning will ignore object blocking (party, mob...)
Will always report true on invisible_wall blocking
5th parm 0: Will report false on closed door blocking
5th parm 1: Will report true on closed door blocking
CheckLineOfFire()
Will always report false on wall block
5th parm 0: Will report false on object block (party or mob will block).
Will report false on invisible_wall blocking
Will report false on door blocking
5th parm 1: Will report true on object blocking (no blocking)
Will report true on invisible_wall and closed door blocking
PLease let me know if I have these wrong or if you can better explain what this last parm does. Thanks.
[Solved] What is the 5th parm for checkLineOfSight()?
[Solved] What is the 5th parm for checkLineOfSight()?
Last edited by MrChoke on Thu Nov 13, 2014 7:52 pm, edited 1 time in total.
Re: What is the 5th parm for checkLineOfSight()?
I've been playing around with these functions a lot trying to get my teleport spell working.
Unless it's coincidence, both functions have been working as you'd expect with the fifth parameter being elevation.
I obviously don't know for sure, but the functions have been returning expected results with this input. I'd also appreciate verification on this, though.
Unless it's coincidence, both functions have been working as you'd expect with the fifth parameter being elevation.
I obviously don't know for sure, but the functions have been returning expected results with this input. I'd also appreciate verification on this, though.

Re: What is the 5th parm for checkLineOfSight()?
I thought at first it was elevation as well but I get different values for 0 and 1 with all areas at the same elevation. I also get the same values with all non-zero values. I agree, we need verification on it.
Re: What is the 5th parm for checkLineOfSight()?
i SHOULD be target elevation, though i agree it seems a bit wierd...
Links to my YouTube playlist of "tutorials" and to my forum thread.
Re: What is the 5th parm for checkLineOfSight()?
One thing about it being elevation is that you would think we would have 6 parameters though. This command is independent of a GameObject so we would have to specify the source elevation as well as target. Unless it always assumes 0.Prozail wrote:i SHOULD be target elevation, though i agree it seems a bit wierd...
Re: What is the 5th parm for checkLineOfSight()?
Upon thinking about Prozail's suggestion that it is elevation I believe he is correct. It is correct if the single elevation value represents the height of both the source and target squares. This means that these functions are limited in their ability to check squares of varying heights. When I look back at my test and see that non-zero values for the 5th parameter results in no blocking except for solid walls, it is because I only have entities at elevation 0. However, a wall is a wall on all elevations. So I think this is it.MrChoke wrote:One thing about it being elevation is that you would think we would have 6 parameters though. This command is independent of a GameObject so we would have to specify the source elevation as well as target. Unless it always assumes 0.Prozail wrote:i SHOULD be target elevation, though i agree it seems a bit wierd...
Thanks Prozail