Jump to content

How to transfer items between creatures?


argent77

Recommended Posts

I'm planning to use a player-initiated dialog which allows my character to transfer a specific number of healing potions to my familiar-type creature.

 

TakePartyItemNum() is the only command I've found so far which takes a specific number of a stackable item from the party. However, it doesn't work when using it from the familiar's script or dialog. The item is taken, but it is placed in the inventory of Player1 instead.

 

My next idea was to use a helper creature which takes the number of items from the party and transfers it to the familiar. It does take the item as expected but I haven't found a way to safely transfer it to my familiar yet.

GiveItem() doesn't work because TakePartyItemNum() places the item into the "Magical Item" slot of the helper creature and a subsequent GiveItem() ignores this slot completely.

GiveItemCreate() shows an even stranger behaviour: It places the number of items in the inventory of the target creature, but it also places the same number of items in the inventory of Player1.

I have thought about using ActionOverride("FamiliarName", CreateItem()) from the helper creature script, but it also places the item into the "Magical Item" slot which is problematic in my case.

 

Now I'm running out of ideas how to accomplish this simple task.

Link to comment

I would have thought that using the "GiveItem" command would work, like it is used in one of the scripts for automatic transfer of e.g. healing potions. This means you need a script for Player1 that executes this command, of course.

Example taken from BALMONK.bcs:

 

IF
Heard(NearestMyGroupOfType,HEALME)
HPPercentGT(Myself,75)
See(LastHeardBy(Myself))
Range(LastHeardBy(Myself),10)
!Range(NearestMyGroupOfType([0.0.0.CLERIC_ALL]),30)
!NumItemsGT("POTN55",LastHeardBy(Myself),0) // Potion of Superior Healing
NumItemsGT("POTN55",Myself,1) // Potion of Superior Healing
!GlobalTimerNotExpired("GaveAwayPotion","LOCALS")
THEN
RESPONSE #100
 SetGlobalTimer("GaveAwayPotion","LOCALS",12)
 DisplayStringHead(Myself,72809) // Here! Catch!
 GiveItem("POTN55",LastHeardBy(Myself)) // Potion of Superior Healing
 Continue()
END

Link to comment

Unfortunately GiveItem() doesn't work either in conjunction with familiars. The action shows the same strange behaviour as GiveItemCreate() by placing the item in both the familiar's and Player1's inventory, effectively doubling the number of items.

 

For now I'm using an ugly hack to accomplish the task by creating and destroying a dummy item in the familiar's inventory to occupy the "Magical Item" slot temporarily. Something like this:

// Script block of the helper creature: Transfer 3 extra healing potions
IF
 Global("GiveExtraHealingPotion", "LOCALS", 3)
THEN RESPONSE #100
 SetGlobal("GiveExtraHealingPotion", "LOCALS", 0)
 TakePartyItemNum("POTN52", 3)
 DestroyItem("POTN52")
 ActionOverride("MyFamiliar", CreateItem("DUMMY", 1, 0, 0))
 ActionOverride("MyFamiliar", CreateItem("POTN52", 3, 0, 0))
 ActionOverride("MyFamiliar", DestroyItem("DUMMY"))
 DisplayString("MyFamiliar", @1503)   // received three extra healing potions
 DestroySelf()
END

I'd prefer to find a better solution though.

Link to comment

Archived

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

×
×
  • Create New...