K4thos Posted August 10, 2018 Share Posted August 10, 2018 (edited) 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 August 10, 2018 by K4thos Quote Link to comment
argent77 Posted August 10, 2018 Share Posted August 10, 2018 Afaik, these constructs are supposed to be rectangles, that can be used to limit target checks to a specific region of the map. Quote Link to comment
K4thos Posted August 10, 2018 Author Share Posted August 10, 2018 thanks. Too bad that this feature doesn't exist in EE engine. Quote Link to comment
K4thos Posted August 10, 2018 Author Share Posted August 10, 2018 (edited) 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: edit: of course I'm talking about encircled rectangle: Edited August 10, 2018 by K4thos Quote Link to comment
argent77 Posted August 10, 2018 Share Posted August 10, 2018 '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. Quote Link to comment
K4thos Posted August 10, 2018 Author Share Posted August 10, 2018 (edited) '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: Edited August 10, 2018 by K4thos Quote Link to comment
argent77 Posted August 10, 2018 Share Posted August 10, 2018 '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. Quote Link to comment
K4thos Posted August 10, 2018 Author Share Posted August 10, 2018 (edited) 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 August 10, 2018 by K4thos Quote Link to comment
lynx Posted August 12, 2018 Share Posted August 12, 2018 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. Quote Link to comment
lynx Posted June 13, 2020 Share Posted June 13, 2020 (edited) Forgot to mention caillean7 did some detailed testing of the rect stuff and it appears it was gimped (doesn't work if the first point isn't [0.0]): https://github.com/gemrb/gemrb/issues/548 Edited June 13, 2020 by lynx Quote Link to comment
Recommended Posts
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.