Go to Page... |
Thread Tools | Display Modes |
09/16/20, 07:08 PM | #1 |
|
Setting Unique Sizes for Group Member Map Pins
I'm attempting to make an addon that lets you change a specific group members pin to make them more distinguishable. I used Votan's Map Pins as a base and from what I've gathered, you can access ZO_MapPin.PIN_DATA and filter by crown, group, and players. What I don't understand is there is a function for choosing a icon and tint, and I was able to customize it so a specific player could have a unique one. However, for size and level, I tried setting them to a function which acted similarly and I get errors (I'm assuming because those two fields only accept an integer that effects all pins of that category). So since it doesn't look like I can change the level and size through a similar means as texture and tint, how else can I change those two values on a per pin basis? Here is a sample of the relevant code:
Lua Code:
|
09/17/20, 02:03 PM | #2 |
<emperor>Welcome on the dark side</emperor>
You are right, size is used as a value, only. By default. But by the power of Lua you can intercept accessing properties like "size" to change the returned value dynamically. For example: Lua Code:
Last edited by votan : 09/18/20 at 09:00 AM. |
|
09/22/20, 04:17 PM | #3 | |
|
|
|
09/22/20, 04:35 PM | #4 |
Wouldn't this just be MAP_PIN_TYPE_PLAYER, MAP_PIN_TYPE_GROUP_LEADER or MAP_PIN_TYPE_GROUP again?
Or what unitTag do you need, and whatfor do you need it? The unittag for your (the player) is always "player". And the unitTags of the group members will be always the prefix "group" with the suffix n (number 1 to n, where n = GetGroupSize()). The group leader's tag can be read via GetGroupLeaderUnitTag() Last edited by Baertram : 09/22/20 at 04:41 PM. |
|
09/22/20, 04:44 PM | #5 | |
|
Lua Code:
|
|
09/22/20, 04:51 PM | #6 |
|
I'm essentially trying to figure out where the pin parameter passed to IconFromName comes from and how I can access it in my hook for size
Lua Code:
|
09/22/20, 05:00 PM | #7 |
Code:
Ideally the unit tag for group[n] And maybe check the ESOUIDocumentationPxx.txt for current "Stonethorn" API: https://www.esoui.com/forums/attachm...5&d=1598294293 There exist several GetUnit and Displayname etc. functions you are able to use. And if I understand the code corectly "pin" is a mappin, so pin will be e.g. something like ZO_MapPin.PIN_DATA[MAP_PIN_TYPE_GROUP_LEADER] So pin:GetUnitTag() would be something like ZO_MapPin.PIN_DATA[MAP_PIN_TYPE_GROUP_LEADER]:GetUnitTag() But this should also return the same as GetGroupLeaderUnitTag() then, imo Edit: After checking votan's addon code: Lua Code:
The function is assigned in the settings to e.g. Lua Code:
So leader.texture will be the function accepting the pin. You need to search where leader.texture is used then and where the pin parameter comes from. eh voila: Lua Code:
Whenever this pin (leader, or ZO_MapPin.PIN_DATA[MAP_PIN_TYPE_GROUP_LEADER]) will update it's texture it will call the function assigned to it (addon.IconLeaderSimple) passing in itsself (the "pin" parameter). At least this is what I understood. Try to use the addon merTorchbug or zgoo to inspect ingame the variable ZO_MapPin.PIN_DATA[MAP_PIN_TYPE_GROUP_LEADER] via e.g. /tbug ZO_MapPin.PIN_DATA[MAP_PIN_TYPE_GROUP_LEADER] You'll see the possible functions and variables of it then in a table grid view, and below __index you see other functions etc. which are from "parent classes" of this variable/table, and so on. You'll understand more easily what function belongs where and what value is updated when this way, at least this is what I did :-) Last edited by Baertram : 09/22/20 at 05:09 PM. |
|
09/22/20, 05:18 PM | #8 | |
|
|
|
09/22/20, 05:24 PM | #9 |
|
groupPin and leaderPin are the result of: Lua Code:
pinData is the result of doing the same thing in IconFromName with the pin parameter. I'm essentially trying to figure out how to get the entire pin object from my hooks size function so I can adjust it individually. If I were to randomly generate a size, each players pin would be a different size and that removes the issue of the global change if I did it from ZO_MapPin.PIN_DATA[MAP_PIN_TYPE_GROUP]. But how could I do it for a specific player as opposed to a random number? The most direct approach I thought of was figuring out how to access the pin parameter from the hook and calling GetUnitTag() of that pin. If it isn't possible, how else could I change the size for a specfic player's pin? Last edited by QuantumPie : 09/22/20 at 05:27 PM. |
09/22/20, 06:37 PM | #10 |
|
I guess a better approach to figuring this out is I know where PIN_DATA is declared. Looking at various keys, MAP_PIN_TYPE_FAST_TRAVEL_WAYSHRINE takes a function for the texture and tint and MAP_PIN_TYPE_FAST_TRAVEL_WAYSHRINE takes its level as a function (which I didn't realize was possible but I now have the level being set per player working). But from the looks of it nothing takes a function for size and if I try to do so myself, I get an error. As for the PIN_DATA structure, how can I determine where its being told which fields can and cannot accept a function, and where the parameters are being passed? If I can figure out where that is, I then know where the pin object is coming from
|
09/22/20, 06:49 PM | #11 |
Try this function if you maybe got the ZO_MapPin's control
https://github.com/esoui/esoui/blob/...ppin.lua#L1683 Else try merTorchbug as I said as it's more easy to see the metatables and "parent class" functions and values in it (at the __index line), at least for me, then within zgoo. Or wait for Votan to help you as he is more in the code of this stuff |
|
09/23/20, 09:21 AM | #12 |
Ok. The next hint:
You have to pre-hook ZO_MapPin.UpdateSize(self) Lua Code:
|
|
ESOUI » Developer Discussions » General Authoring Discussion » Setting Unique Sizes for Group Member Map Pins |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|