Salk Posted May 22, 2020 Posted May 22, 2020 Hello! I would like for a creature to wear the armor that another creature is currently wearing (in this case, Carth) so I was thinking of this: object oArmor = GetItemInSlot(INVENTORY_SLOT_BODY, GetObjectByTag("Carth")); but CreateItemOnObject() requires the item's TemplateStrRef rather than the object so my question is: how do I make it work? GetTag() is not the right function and neither is GetName(). Thanks for the assistance! Quote
DarthParametric Posted May 22, 2020 Posted May 22, 2020 There is no function to get the ResRef. The game doesn't store that value. That's why vanilla items typically use the same value for both Tag and ResRef, so yes, using GetTag is the right function. Unless he is wearing an item from a mod, in which case all bets are off. 1 Quote
JCarter426 Posted May 22, 2020 Posted May 22, 2020 There are, however, some items for which the two don't match. These are the ones I know of, in K2: g_danceroutfit / DancersOutfit a_khoonda / KhoondaMilitiaArmor Only thing that can be done for those is to add an if statment to take care of the exceptions. Quote
Salk Posted May 22, 2020 Author Posted May 22, 2020 Indeed it seems like this solution may work for all the vanilla items. I made a quick search and it seems the only difference between the Tag and the TemplateResRef is upper and lower case for the same string. I will have to look for possible exception, as suggested by JC but overall it should be alright. I had also another idea that worked fine but wouldn't solve the problem: it is possible to use the EffectDisguise() but even in this case it would not produce a creature wearing the equipment of the party NPC. Cheers! Quote
JCarter426 Posted May 22, 2020 Posted May 22, 2020 Just now, Salk said: I made a quick search and it seems the only difference between the Tag and the TemplateResRef is upper and lower case for the same string. If I recall correctly, GetTag() always returns a lowercase string anyway. 1 Quote
DarthParametric Posted May 22, 2020 Posted May 22, 2020 That does mean it probably won't work on Linux/Mac, since they are case-sensitive OSs. Although the actual filenames are all lowercase aren't they? So that should be fine in that case. Also, as to ones not matching, yeah, a lot of the unique/quest-related items don't use matching Tags/ResRefs. Maybe your next coding project can be to browse every UTI in both games and compile a database of mismatches. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.