Jump to content

Photo

[solved] IWD2 Object Types [edit: NearLocation]


9 replies to this topic

#1 K4thos

K4thos
  • Modders
  • 1186 posts
  • Gender:Male

Posted 10 August 2018 - 04:27 AM

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, 10 August 2018 - 07:48 AM.


#2 argent77

argent77
  • Modders
  • 818 posts
  • Gender:Male

Posted 10 August 2018 - 04:54 AM

Afaik, these constructs are supposed to be rectangles, that can be used to limit target checks to a specific region of the map.



#3 K4thos

K4thos
  • Modders
  • 1186 posts
  • Gender:Male

Posted 10 August 2018 - 05:26 AM

thanks. Too bad that this feature doesn't exist in EE engine.



#4 K4thos

K4thos
  • Modders
  • 1186 posts
  • Gender:Male

Posted 10 August 2018 - 05:56 AM

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, 10 August 2018 - 07:17 AM.


#5 argent77

argent77
  • Modders
  • 818 posts
  • Gender:Male

Posted 10 August 2018 - 06:33 AM

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

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



#6 K4thos

K4thos
  • Modders
  • 1186 posts
  • Gender:Male

Posted 10 August 2018 - 06:44 AM

'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, 10 August 2018 - 07:18 AM.


#7 argent77

argent77
  • Modders
  • 818 posts
  • Gender:Male

Posted 10 August 2018 - 07:10 AM

 

'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.



#8 K4thos

K4thos
  • Modders
  • 1186 posts
  • Gender:Male

Posted 10 August 2018 - 07:42 AM

thanks!



#9 K4thos

K4thos
  • Modders
  • 1186 posts
  • Gender:Male

Posted 10 August 2018 - 08:53 AM

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, 10 August 2018 - 10:08 AM.


#10 lynx

lynx
  • Modders
  • 3110 posts
  • Gender:Male
  • Location:Ljubljana, Slovenija

Posted 12 August 2018 - 02:29 AM

Looking at our code, the extra object is supported in all iwd variants and pst, but we don't use it anywhere yet, so can't confirm anything.


GemRB - IE anywhere.
Mages needed! Looking for Planescape: Torment testers
Market android version IS NOT SUPPORTED ANYMORE: reported bugs will be ignored! Still looking for builders ...



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users