Jump to content

[solved] IWD2 Object Types [edit: NearLocation]


K4thos

Recommended Posts

In IWD2 objects/ids objects are often followed by another object type (?) consisting of 4 values. Examples:


Exists(Player1[110.520.190.600])

See([0.0.LIZARDMAN][0.0.10000.10000],0)

Dead([GOODCUTOFF][793.376.1093.676])

ChangeSpecifics([GOODCUTOFF.0.0.0.0.255][0.0.10000.10000],0)


At first I thought those are just nested objects (even though no script in other games nests like this) but these values don't seem to have anything to do with IDS files. According to gemrb the normal ids object type in IWD2 should consist of following values: [EA.GENERAL.RACE.SUBRACE.SPECIFIC.GENDER.ALIGNMNT.CLASS.CLASS20.CLASSMSK]. Anyone knows what those bolded values are used for and what sets them?

Edited by K4thos
Link to comment

one more question. Let's say I want to limit the range in similar way to those rectangles using NearLocation(O:Object*,I:PointX*,I:PointY*,I:Range*) trigger. Does anyone know how Range refers to area pixels?

 

Let's say I'd like to convert this rectangle into NearLocation check:
Exists(Player1[110.520.190.600])

The middle of it can be calculated via:

PointX = x1+(0.5*(x2-x1))
PointY = y1+(0.5*(y2-y1))

So we end up with:

NearLocation(Player1,150,560,I:Range*)

What would be the correct range value here? I don't think Range matches pixels 1:1, so calculation like this is likely not correct:

render.png

 

edit: of course I'm talking about encircled rectangle:

JGtIBvo.png

Edited by K4thos
Link to comment
'Radius' most likely scales to search units, which roughly translates to 16 pixels horizontally and 12 pixels vertically per unit.

 

just to be sure that I understand this correctly - the range in the example I've shown would be 8 (8.333 rounded down), is that right? (radius calculated like in the above mentioned formula but using rectangle length divided by 16 and rectangle height divided by 12)

 

edit:

render.png

Edited by K4thos
Link to comment

 

'Radius' most likely scales to search units, which roughly translates to 16 pixels horizontally and 12 pixels vertically per unit.

 

just to be sure that I understand this correctly - the range in the example I've shown would be 8 (8.333 rounded down), is that right? (radius calculated like in the above mentioned formula but using rectangle length divided by 16 and rectangle height divided by 12)

 

Radius would be 4.1666 (rounded down to 4). You forgot to divide by 2.

Link to comment
I don't know how reliably NearLocation() works outside of visual range though. You might want to test it first.

 

Seems to be working as expected. Tested with code attached to Imoen:

IF
  Global("doOnce","LOCALS",0)
THEN
  RESPONSE #100
    JumpToPoint([2344.873])
    SetGlobal("doOnce","LOCALS",1)
END


IF
  See(Player1)
THEN
  RESPONSE #100
    DisplayStringHead(Player1,1)  // No, I'm sorry, none of them sound familiar.
    Continue()
END


IF
  NearLocation(Player1,2344,873,40)
THEN
  RESPONSE #100
    DisplayStringHead(Player1,2)  // You played Elminster?
END

the message shows up a bit further than visual range: https://i.imgur.com/kTiQu6Y.jpg

Here is where visual range kicked-in: https://i.imgur.com/qAWp3GD.jpg

Increasing the range value also increases NearLocation range far beyond the visual range (for example NearLocation(Player1,5000,5000,521) covered whole area that I was in).

Edited by K4thos
Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...