jastey Posted August 11, 2007 Share Posted August 11, 2007 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
Rabain Posted August 12, 2007 Share Posted August 12, 2007 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
cmorgan Posted August 12, 2007 Share Posted August 12, 2007 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
CamDawg Posted August 12, 2007 Share Posted August 12, 2007 Yeah, I don't know any non-destructive ways to do it. Via spell, you can use opcode 143. If you know the current item in the belt slot, you could do TakeItemReplace. Otherwise I think you're SOL. Link to comment
cmorgan Posted August 12, 2007 Share Posted August 12, 2007 *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
jastey Posted August 12, 2007 Author Share Posted August 12, 2007 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
Rabain Posted August 12, 2007 Share Posted August 12, 2007 Nice, I guess the FillSlot() series could be used to dress NPC's quickly if they've just been Resurrected for example. See slots.ids for the full list of FillSlot() identifiers.. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.