[Solved] What is the 5th parm for checkLineOfSight()?

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
MrChoke
Posts: 324
Joined: Sat Oct 25, 2014 7:20 pm

[Solved] What is the 5th parm for checkLineOfSight()?

Post by MrChoke »

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.
Last edited by MrChoke on Thu Nov 13, 2014 7:52 pm, edited 1 time in total.
User avatar
jxjxjf
Posts: 33
Joined: Fri Oct 24, 2014 6:26 am

Re: What is the 5th parm for checkLineOfSight()?

Post by jxjxjf »

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. :lol:
MrChoke
Posts: 324
Joined: Sat Oct 25, 2014 7:20 pm

Re: What is the 5th parm for checkLineOfSight()?

Post by MrChoke »

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.
User avatar
Prozail
Posts: 158
Joined: Mon Oct 27, 2014 3:36 pm

Re: What is the 5th parm for checkLineOfSight()?

Post by Prozail »

i SHOULD be target elevation, though i agree it seems a bit wierd...
MrChoke
Posts: 324
Joined: Sat Oct 25, 2014 7:20 pm

Re: What is the 5th parm for checkLineOfSight()?

Post by MrChoke »

Prozail wrote:i SHOULD be target elevation, though i agree it seems a bit wierd...
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.
MrChoke
Posts: 324
Joined: Sat Oct 25, 2014 7:20 pm

Re: What is the 5th parm for checkLineOfSight()?

Post by MrChoke »

MrChoke wrote:
Prozail wrote:i SHOULD be target elevation, though i agree it seems a bit wierd...
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.
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.

Thanks Prozail
Post Reply