Zum Inhalt wechseln

Foto

Equipping Custom Armor (solved)


  • Bitte melde dich an um zu Antworten
15 Antworten in diesem Thema

#1
MerAnne

MerAnne
  • Members
  • 1.157 Beiträge

I have been trying to equip a NPC (Companion) with custom armor. 

 

I use UnequipItem, CreateItemOnObject or UT_AddItemToInventory, and EquipItem.  This works for like a charm for DAO vanilla equipment. 

 

As soon as I start using armor that I created, all I can do is strip the NPC of what she is wearing.  The new items will show up in inventory, but they aren't equipped.  The custom items all show the module and module owner as my mod.  The DAO equipment, of course, shows up with module and module owner as Core.  I can start experimenting with the temporary storage chest that the 'Rescue the Queen' quest uses or I can experiment with changing the armor to 'core' resources. 

 

Before I start flailing around trying to find a solution.  Has anyone seen this issue and know how to resolve it?

 

Edit: so I've been flailing around with no success.  Creating an item as a 'core' resource did not cause the item to be equipped even though vanilla armor still equips



#2
luna1124

luna1124
  • Members
  • 7.649 Beiträge

No answers yet? I wish I could help you MerAnne :(



#3
theskymoves

theskymoves
  • Members
  • 1.358 Beiträge

The only thing that comes to mind is whether the NPC meets the requirements to equip the custom items, i.e. sufficient strength, etc. /not helpful contribution



#4
luna1124

luna1124
  • Members
  • 7.649 Beiträge

There is a mod that equips the family Cousland with new equipment, but it is probably vanilla armor redone?. That seems like where the problem lies.... If it works with the vanilla armor, but NOT the custom armor? Could it be something with the single player extended module? Maybe your custom armor needs to be single player and not exclusively for the mod? I know this is probably dumb, but you never know.



#5
MerAnne

MerAnne
  • Members
  • 1.157 Beiträge

What I was trying to do.... but don't have to because I do know how to equip armor weapons....

 

Moira is supposed to be trying to escape the Mage's Tower.  It is a little hard to 'sneak out' when wearing obvious 'traveling clothes'.  So I wanted her to be wearing standard 'mage robes' when the GW encounters her and then change into light armor after being recruited.  I've been having no problem removing the mage robes, but replacing them with something else hasn't been working out so well.

 

If I can't get it to work, then she will just be wearing the armor to begin with. :D   No problem with not knowing the answer, I don't know it either ;)


  • luna1124 gefällt das

#6
Sunjammer

Sunjammer
  • Members
  • 925 Beiträge
I haven't encountered any issues before. Are you using functions directly or adding commands to the NPCs command queue? Is thi in a plot script or an event script, if the latter what event are you using?

#7
DarthGizka

DarthGizka
  • Members
  • 867 Beiträge

The best thing would probably be to produce a minimal test case - a small script that equips vanilla armour on a character and succeeds, but fails to do the same with custom armour (on the same character or another, depending on whether the script type permits command line parameters). That way people could reproduce the problem and look for solutions, much more quickly and effectively than with 'debugging by forum post'...

 

Creating a minimal test case also tends to increase and clarify one's understanding of the problem.



#8
MerAnne

MerAnne
  • Members
  • 1.157 Beiträge

The script is a subset of the hiring script.  The armor is removed beautifully, but is not replaced on the Companion.

 

Two separate computers so I'm just typing in the commands - there may be typing mistakes, but the code compiles/runs on the desktop:

 

object oClothes;

oClothes = GetItemInEquipSlot(INVENTORY_SLOT_CHEST, oFollower);

UnequipItem(oFollower, oClothes);

CreateItemOnObject(R"drm_moira_armor_chest.uti", oFollower, 1);

oClothes = GetObjectByTag("drm_moira_armor_chest");

EquipItem(oFollower, oClothes, INVENTORY_SLOT_CHEST);

 

 

I've tried UT_AddItemToInventory() which does the same thing as CreateItemOnObject()   This code works for armors in the core resources (I used dalish armor for a test) and does not work for armor I've created.  Armor is always unequipped from the NPC and the items always appear in inventory, but (new) armor is not equipped.

 

Running to get ready for work.  Probably kept me from being too verbose :D


  • luna1124 gefällt das

#9
Sunjammer

Sunjammer
  • Members
  • 925 Beiträge

One thing I noticed, and while it may not be the cause it makes sense to eliminate it from the equation, is that rather than trying to get the object by tag (as it may not be unique or it may not be what you expect it to be) the CreateItemOnObect will return you a reference to the newly created item so you replace lines 4 and 5 with:

oClothes = CreateItemOnObject(R"drm_moira_armor_chest.uti", oFollower, 1);

At least this way you know you are trying to equip the right bit of armour.

 

Also be aware that the description of CreateItemOnObject is a load of nonsense: I can't do anything about the help file but I'll try to fix the version in the wiki!


  • DarthGizka gefällt das

#10
MerAnne

MerAnne
  • Members
  • 1.157 Beiträge

UT_AddItemToInventory(); also adds an item to the inventory.  and can be used to replace CreateItemOnObject with equal lack of success ;)

 

This seems an odd question, but no harm, I guess.  Why does the item need to be placed into inventory and then equipped?

 

And, this may or may not be related.  During the 'rescue the queen' quest, the 're-equip' did not work after they were discovered.  I had 4 naked Dwarves.  My GW (was wearing custom armor) and three added Companions (were wearing vanilla armor and the material had leveled).  I quickly dressed them, but I'm wondering if this is a related issue.  This occurred months ago, I was told 'that happens sometimes' and didn't worry about it.



#11
luna1124

luna1124
  • Members
  • 7.649 Beiträge

^^MerAnne, during 'rescue the queen' this just happened to me, and not with your dwarfs.^^ All 4 party members were naked, Alistair had vanilla armor and so did Morrigan. My warden had on TMP's retex of the Shadow of the Empire, Backhands, Silverhammer's Tackmasters (which are vanilla armors, he just reskinned them). Leliana had on Phoenix armor. This has never happened with the whole party before. It only happened when I had Ser Gilmore NPC installed, and only to him.



#12
DarthGizka

DarthGizka
  • Members
  • 867 Beiträge

UT_AddItemToInventory(); also adds an item to the inventory.  and can be used to replace CreateItemOnObject with equal lack of success ;)

 

UT_AddItemToInventory() is a convenience wrapper around CreateItemOnObject()...

 

If I remember correctly, items do not exist outside containers. They can only be created in a container (inventory), moved between containers, and destroyed.



#13
MerAnne

MerAnne
  • Members
  • 1.157 Beiträge

Thanks DarthGizka, I suspected something like that....

 

Luna, I have a suspicion about the Rescue the Queen quest and the 'nude bug'.  The only time I've ever seen that bug was when I was doing a 'quick playthrough' to test my mod.  I was playing on 'easy' when I usually play on Nightmare so I was almost running through the game.  When I got to the 'rescue the Queen' quest, I think the Companions were all wearing steel - or even iron - equipment. Disguises were put on, disguises taken off, nude Companions and GW, and in the inventory... all of the equipment (that could) had leveled up.  My suspicion was that the armor had been taken off as 'iron dwarf helmet' when it was time to re-equip, there was no 'iron dwarf helmet', there was a 'veridium dwarf helmet'.  But that wasn't what I was working on so I just laughed and put all of the equipment back on without doing any testing to try to confirm my suspicion.

 

Solution:

It just suddenly started working.  I had commented out whole sections of the script that I needed to look at 'later' - this section being one of them.  In frustration  over something else, I removed the 'group' comments and was commenting out lines one by one.  I suddenly realized that Moira was wearing armor even though I had removed the block comment statements around that section.

 

I 'cleaned it up' (since it was working) and got it down to two lines of script to remove the old equipment and replace it with new.  I also moved it closer to the end of the program that it was in.

 

UnequipItem(oFollower, GetItemInEquipSlot(INVENTORY_SLOT_CHEST,oFollower));

EquipItem(oFollower,CreateItemOnObject(R"drm_moira_armor_chest.uti", oFollower, 1) , INVENTORY_SLOT_CHEST);

 

Sunjammer, Thanks for the reminder that there are shorter ways to achieve the same result, :D


  • luna1124 gefällt das

#14
luna1124

luna1124
  • Members
  • 7.649 Beiträge

 

Luna, I have a suspicion about the Rescue the Queen quest and the 'nude bug'.  The only time I've ever seen that bug was when I was doing a 'quick playthrough' to test my mod.  I was playing on 'easy' when I usually play on Nightmare so I was almost running through the game.  When I got to the 'rescue the Queen' quest, I think the Companions were all wearing steel - or even iron - equipment. Disguises were put on, disguises taken off, nude Companions and GW, and in the inventory... all of the equipment (that could) had leveled up.  My suspicion was that the armor had been taken off as 'iron dwarf helmet' when it was time to re-equip, there was no 'iron dwarf helmet', there was a 'veridium dwarf helmet'.  But that wasn't what I was working on so I just laughed and put all of the equipment back on without doing any testing to try to confirm my suspicion.


 

I can check this, but I am pretty sure they were wearing vanilla named armor (except for Leliana). I too was rushing through the rescue for testing. Playing still on nightmare though.

 

I'm glad you got it working!! I knew you would figure it out :D



#15
MerAnne

MerAnne
  • Members
  • 1.157 Beiträge

when I was doing testing (naked dwarves), everyone except the GW was wearing vanilla equipment...  That is what made me wonder if the material leveling and the nudity bug were related. :D

 

Although I will say that the sudden nudity did cause me to nearly laugh myself senseless :lol:   When under attack, distract your opponent by stripping! :lol:


  • luna1124 gefällt das

#16
luna1124

luna1124
  • Members
  • 7.649 Beiträge

It was pretty funny for me too the first time with Ser Gilmore. I was like..whoa..why is he naked :D