Jump to content

Equipping a ring


Kish

Recommended Posts

Is there a way, by script, to have a character automatically equip a ring (not just hold it) during play, i.e., before a conversation Edwin doesn't have any rings on, after the conversation he has this particular ring on?

Link to comment

You can use this action:

 

FillSlot(SLOT_RING_LEFT)

 

The slot needs to be empty though, and the specified ring needs to be referenced in the block, i.e.

 

IF
!HasItemSlot(Myself,SLOT_RING_LEFT)
!HasItem("ringxyz",Myself)
Global("giveringxyz","LOCALS",0) //This line is probably redundant, but better to be safe
THEN
RESPONSE #100
GiveItemCreate("ringxyz",Myself)
FillSlot(SLOT_RING_LEFT)
SetGlobal("giveringxyz","LOCALS",1)
END

 

If the character already wears a ring, they need to de-equip it somehow. As an example

 

GiveItem("ring09",Myself)

 

should shift it from equipped to their inventory.

Link to comment

Thanks. Is there a way to automatically dump whatever rings the character is wearing beforehand to the inventory? (Ideally without also removing the rest of their equipment.)

Link to comment

It appears that a creature won't GiveItem() to themselves, but this block seems to work:

 

IF
Allegiance(Myself,PC)
HasItemEquiped("ring09",Myself) // Ring of Free Action
HasItemSlot(Myself,SLOT_RING_LEFT)
THEN
RESPONSE #100
GiveItem("ring09",Player1) // Move it out of their inventory
Continue()
END

IF
!HasItemSlot(Myself,SLOT_RING_LEFT)
!HasItem("ring18",Myself) // Fire Opal Ring, just as an example
Global("giveringxyz","LOCALS",0)
THEN
RESPONSE #100
GiveItemCreate("ring18",Myself,1,0,0) // Need to specify charges with GiveItemCreate() command, even if item doesn't have limited use ability
FillSlot(SLOT_RING_LEFT)
SetGlobal("giveringxyz","LOCALS",1)
END

 

You'd need to repeat this for every magic ring in game though, at least by checking HasItemSlot() you can ensure that the creature won't try equipping the new ring if another unlisted (mod-added) ring is on their left hand.

Link to comment

Archived

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

×
×
  • Create New...