Aller au contenu

Photo

Copy item into store?


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

#1
Shadooow

Shadooow
  • Members
  • 4 470 messages

Got a little problem trying to copy item from PC into store inventory.

 

I tried both CopyItem and CopyObject, I verified the oStore is valid, I even tried to put some item into store first and disable "buy restrictions" but with no effect.

 

 

object oBazar = GetObjectByTag("sh_bazar_obchod");
object item = CopyItem(oItem,oBazar,TRUE);

both oBazar and oItem are valid, but instead of the item being created in store inventory its created on the ground under store position in area.

 

Is this a know bug? Couldnt find anything in lexicon.



#2
Tarot Redhand

Tarot Redhand
  • Members
  • 2 687 messages

Did you try

 

void ActionGiveItem(
    object oItem,
    object oGiveTo
);

 

TR



#3
Shadooow

Shadooow
  • Members
  • 4 470 messages

Did you try

 

void ActionGiveItem(
    object oItem,
    object oGiveTo
);

 

TR

didnt work

 

but I was sure I was doing this kind of stuff before and it worked so I made a chat command test which took axe from ground and copied it into store and it worked so there is something wrong here

 

my script is conditional script running on plot npc without any AI scripts, item is in players inventory, but I tried to copy it twice, once into npc inventory first then store with same result item appeared under store position, I dont know...


  • WhiteTiger aime ceci

#4
Shadooow

Shadooow
  • Members
  • 4 470 messages

So I found the problem!

 

It looks that any item with Plot flag fails to get copied into store, instead it will be created on the ground under store location.

 

To workaround this you need to remove Plot flag before copying and restore it later (if needed).

 

sample code

 

 object oItem = GetObjectByTag("testaxe");
 object oStore = GetObjectByTag("teststore");
 int bPlot = GetPlotFlag(oItem);
  if(bPlot)
  {
  SetPlotFlag(oItem,FALSE);
  }
 oItem = CopyItem(oItem,oStore,TRUE);
  if(bPlot)
  {
  SetPlotFlag(oItem,TRUE);
  }

Anyone wants to update lexicon about this?


  • MrZork, Squatting Monk, henesua et 1 autre aiment ceci

#5
Squatting Monk

Squatting Monk
  • Members
  • 446 messages

Updated and included your example. Thanks!



#6
Proleric

Proleric
  • Members
  • 2 354 messages
...Anyone wants to update lexicon about this?

 

Done.

 

Possibly "expected behavior" for the game engine, since you can't sell plot items to a store, but since the toolset allows plot items in a store inventory, this nuance is worth recording.

 

Correction : Squatting Monk got there first. I won't split hairs about whether it's a bug.


  • Squatting Monk et WhiteTiger aiment ceci

#7
Shadooow

Shadooow
  • Members
  • 4 470 messages

its weird since toolset allows to sell plot items in store (and wasnt there in OC actually a store selling all plot items player lost?)


  • Squatting Monk aime ceci

#8
Squatting Monk

Squatting Monk
  • Members
  • 446 messages

Possibly "expected behavior" for the game engine, since you can't sell plot items to a store, but since the toolset allows plot items in a store inventory, this nuance is worth recording.

 

For sure. I expect if this were pointed out to developers they would have fixed it in a patch. I added this comment as a note to both articles.


  • Proleric aime ceci

#9
WhiteTiger

WhiteTiger
  • Members
  • 479 messages

Look into this one... the ideal point for those who are having problems with it!!! Everybody please thanks Shadooow and enjoy the code.