Jump to content

How to equip a belt automatically? [SOLVED]


jastey

Recommended Posts

I want my NPC to equip a belt by his own.

I didn't succeed in coding this. EquipItem() only works for weapons (or so, at least it doesn't work for the belt).

Anyone having a good idea for a workaround? The NPC is already a member of the PC's group (so no workaround with equipping the .cre..), and the belt would be unremovable.

 

I would be very thankful.

Link to comment

Does FillSlot(SLOT_BELT) work? According to IESDP it will destroy whatever is in the slot when it Fills.

 

Might want to use in conjunction with HasItemEquiped(S:ResRef*,O:Object*) though that could get long if you list all the different belts (thankfully there aren't a lot of belts!).

 

edit: gah...this just searches inventory for a belt and fills the slot with the first one found.

Link to comment

I just know Andyr pointed me to an answer to this awhile ago (a long while) - try a search using his username and "bracelet". I think he created a mundane nonremovable bracelet, then created a script that swapped the nonrempovable bracelet for a magical one at the right time... (? Erranon?)

 

I hate being oldover 39... I keep forgetting things, and pretty young girls no longer look my direction (wait a minute - they didn't do that before, either - hmmm. Logical fallicies cropping up...

Link to comment

*THAT* was it - TakeItemReplace()!!!!

 

The swap was a non-magical for magical, scripted via TakeItemReplace(). Started with the patching of a xustom non-droppable mundane item into the .cre, for ease of swap.

Link to comment

Destroying of another item/belt would be no problem as the NPC does DropInventory() before it happens. That also means that TakeItemReplace() Won't work; Plus I do not want to put another belt onto the NPC for which the new one could be replaced: As far as I understood, I would have to equip the NPC from the start with another, non-removable belt to make sure he is wearing it in that special moment? (As mentioned, the NPC is group member for quite a while then, and the incident is an incident, not a main plot/quest.)

 

So, TakeItemReplace() won't work for me, I'm afraid (unless I didn't understand it correctly in which case I would be thankful if you would point it out, cmorgan.)

 

I'll have a closer look at FillSlot(SLOT_BELT)

"searches inventory for a belt and fills the slot with the first one found" sounds perfect for my purpose.

 

If that won't do I'll come running crying to CamDawg, since using spells and opcodes is something that I never seem to get to work on my own.

 

Thank you very much for your ideas. The world looks much lighter this morning. ;)

 

EDIT: Yes, FillSlot works perfect for my purpose! This is awesome. Thank you! (And, again, I was searching with the wrong search words in IESDP.)

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...