Aller au contenu

Photo

script : Transfer all Items (done ...)


  • Veuillez vous connecter pour répondre
19 réponses à ce sujet

#1
kevL

kevL
  • Members
  • 4 061 messages
here's a conversation script that's been working for me in tests. It transfers all equipment & items from an object-inventory to another object-inventory ( need unique tags on both objects ). handles Bags by transfering any items that are inside first, then copies the empty bag over w/ a DelayCommand,

ga_kl_transferitems <- updated to handle cursed items, ownedPC, and 'modes'


- no checks are done for possible overload, though

Modifié par kevL, 23 août 2012 - 05:07 .


#2
I_Raps

I_Raps
  • Members
  • 1 262 messages
Does it get around the visual mis-matching that happens when characters hand bags to each other?

#3
kevL

kevL
  • Members
  • 4 061 messages
not sure what you mean ..

multiplayer? It's really not a 'hand the bag' type thing, Raps. In fact it dumps the bag out completely and then all the items plus bag just appear in the Target inventory.


It can be used for, like, strip the character and put all his goodies in a chest someplace. Or, a companion gets arrested and thrown in jail, so pass all his goods to his daughter and have her join the party in his stead ( so all the cool stuff that ya gave him doesn't disappear from play )

#4
I_Raps

I_Raps
  • Members
  • 1 262 messages
Well, that's too bad. I immediately thought of making a bag-handling item with a couple lines to grab the right tags and shoot 'er over.

The problem I referred to is where character A has a couple bags of stuff and hands one to character B; character B will often adopt (visually only) character A's gear. You get oddities like your wizard suddenly sporting full plate and yielding his bow in one hand and a shield in the other.

I think it's related to the custom items losing their appearance on level-up, but aggravated by Tony K's (both the light version (minor increase) and the full version (major increase in frequency)). Just a bit of silliness, but worth a tryout of a few lines of code to avoid.

#5
kevL

kevL
  • Members
  • 4 061 messages
holy cat i never seen that! The icons going a bit haywire sure, but not the character model.

my Script uses CopyItem( ) for behind-the-scene, long distance, instant transfer; you'd likely be looking at these functions, instead:


// Give oItem to oGiveTo
// If oItem is not a valid item, or oGiveTo is not a valid object, nothing will
// happen.
void ActionGiveItem(object oItem, object oGiveTo, int bDisplayFeedback=TRUE);

// Take oItem from oTakeFrom
// If oItem is not a valid item, or oTakeFrom is not a valid object, nothing
// will happen.
void ActionTakeItem(object oItem, object oTakeFrom, int bDisplayFeedback=TRUE);

Now, I have no idea how those treat bags full of goodies, and imagine it would be a heck of a time managing the input and target in a realtime, non-immersion-breaking manner ...

another prospect is to unequip/reequip all slotted gear from & to the same slots ( if that corrects the vis .. ), which pseudo-ironically is a utility script i'd like, to fix disappearing icons on levelup.

#6
bealzebub

bealzebub
  • Members
  • 352 messages
Thanks for the script KevL, I'll try it out in my project. I never thought about magic bags.

#7
kevL

kevL
  • Members
  • 4 061 messages
ya ..
give a heads up if it throws any unexpected behavior

#8
kevL

kevL
  • Members
  • 4 061 messages
heh / cursed items / heh


[ edit ] updating script to disregard CursedItems, and changing things to use GetTarget( ) so that ownedPC can be victimized easier.

[ edit2 ] updated OP.

Modifié par kevL, 23 août 2012 - 05:05 .


#9
bealzebub

bealzebub
  • Members
  • 352 messages
Hey KevL,
I was looking at your revised script, and I like your additions. I don't however quite understand the whole sSource/sSource_def, sTarget/sTarget_def part. Could you explain it in terms my paltry, self taught scripting skills might understand?

#10
kevL

kevL
  • Members
  • 4 061 messages
yeh its sort of confusing but quite powerful once ya get the hang of it


The #include 'ginc_param_const' file contains the actual code. It sets out a number of string constants

"$OBJECT_SELF"  // OBJECT_SELF
"$OWNER"        // OBJECT_SELF (conversation owner)
"$OWNED_CHAR"   // GetOwnedCharacter
"$PC"           // PCSpeaker
"$PC_LEADER"    // FactionLeader (of first PC)
"$PC_NEAREST"   // NearestPC (owned and alive)
"$PC_SPEAKER"   // PCSpeaker

"$MODULE"
"$LASTSPEAKER"


that are used by the function GetTarget( ). What GetTarget does is, it takes two string variables, but only uses one of them; that is if the first is blank it uses the second, simple as that. The first is meant to take a Tag, but say the object doesn't have a tag or has a generic tag or you just don't want to fool around with tags atm: then leave the first string blank and put in one of the "$" constants above (if applicable). The scripts call this 2nd string "default" but its not really ....

it does have a default in the sense that if both string fields are left blank ( i've done them in pairs btw, 2targets x 2stringfields; consider each object separately ) then GetTarget 'defaults' to TARGET_OWNER, or "$OBJECT_SELF". The main reason I did it, though, is for use w/ "$PC" or "$PC_SPEAKER", which are supposedly the same thing here.

#11
kevL

kevL
  • Members
  • 4 061 messages
eg. To transfer items from the PC speaker to the conversation owner

sSource = ""
sSource_def = "$PC"
sTarget = ""
sTarget_def = "$OBJECT_SELF"


( note if there is a Tag spec'd in the non_def slot(s), that will get used instead of the constants )

- no quotation marks, ofc

#12
bealzebub

bealzebub
  • Members
  • 352 messages
Oooh k.
I thought that was it, but other scripts that use the 'ginc_param_const' don't have seperate entries for it, so I thought I was mis-reading. I'll give it a shot, and let you know if any thing unexpected happens.

#13
kevL

kevL
  • Members
  • 4 061 messages
ok

it got me thinking, it could have been done internal to the function GetTarget. If it did a check for the "$" assume constant, else Tag ... but, backward compatibility & all that ;|

#14
kevL

kevL
  • Members
  • 4 061 messages
okay ..

i looked more closely at GetTarget( ) and it turns out you *can* specify a $constant in the first field. Or a tag ofc


- don't know why they didn't just declare it:

object GetTarget(string sTarget = TARGET_OWNER);

and have done with it :\\ But it should work either way, beal : either use a tag in the first field, or leave the first field blank and use a $constant in the 2nd field ... or use a $constant in the first field and it overrides the 2nd field. Or leave both fields blank and it uses OBJECT_SELF ....... gah.

#15
I_Raps

I_Raps
  • Members
  • 1 262 messages

kevL wrote...

holy cat i never seen that! The icons going a bit haywire sure, but not the character model.



This gap in your experience is about to be filled: 

Posted Image
Uploaded with ImageShack.us

Modifié par I_Raps, 03 septembre 2012 - 06:26 .


#16
I_Raps

I_Raps
  • Members
  • 1 262 messages
The only things that are real, there, are the helmet, armor, shield, arrows and top ring; everything else is equipped by Safiya (including the crossbow).

Modifié par I_Raps, 03 septembre 2012 - 06:24 .


#17
kevL

kevL
  • Members
  • 4 061 messages
so, uh, what's the workaround? save&reload, hit a zone? keep playing??

Have you tried different methods of moving the bag? Like drag&drop on portrait, drag&drop on charactermodel, even put it on the ground?

#18
I_Raps

I_Raps
  • Members
  • 1 262 messages
The easiest workaround is to just swap out stuff - replace A with B then back to A. Not hard for a packrat like me. Loading new area works, but resting doesn't.

I haven't really tried any other methods - d&d on the portrait 99%+ is the only choice for me (I have very rarely used d&d on the model for other items, but I wouldn't be surprised if the record showed I have never done it for a container, it's that rare).

This particular episode took me completely by surprise. I passed an empty Bag of Holding to Safiya, switched over to her, dumped a Lesser Magic Bag with about a dozen items (rings, amulets, an armor and a spear for any new adventurers we might happen to run into, ahem) and passed the LMB bag to Piwien to sell and voila'.

I would have sworn it requires more complexity than that. I guess I just won the lottery.

#19
I_Raps

I_Raps
  • Members
  • 1 262 messages
One thing is ...

It happens all the time in combat IF you use Tony K's full version AND you leave "Automatic Weapon Switching" turned on for your main PC. And it's not just me - this used to get posted all the time back on the old forum.

#20
kevL

kevL
  • Members
  • 4 061 messages
hm, well, hm

i'll keep my eyes open when digging through Tony's addon. (amidst the glassy eyed blur)

was idly trying to think of a way to use ActionTakeItem or somesuch, but suspect a solution would be cumbersome ... something like a wand that can be clicked on the bag and then clicked on the recipient. Personally i'd try dropping the bag on the ground to pass off, and refraining from passing bags during combat (ie, take the item to transfer out and pass that by itself)


Take heart Raps. I have a companion that has all items except two sheaths of arrows destroyed when she gets whacked from full health to dead in a single flurry. At first i thought it was tied to my script above, but there are distinct reasons to discount that,