Aller au contenu

Photo

Inventory question


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

#1
andysks

andysks
  • Members
  • 1 650 messages

I have created some items, which are liked by the companions. You can give them to them, and gain some influence. The system is inspired by DA:O. And here come the problems... so to say, on how I will handle this.

 

When the item gets looted, if it's on a companion's inventory, it wouldn't make sense to then talk to this companion and say "I got something for you", since he already has it. Is there a way I can force an item using tag based scripting to the PC's inventory when it gets looted, or when the player tries to move it from his inventory to a companion's?

Or even better.

Can I even skip the conversation and force the item when looted, but then allow the move from inventory to inventory scripting the influence gain if it's moved in the correct companion's inventory?

 

If that's all not possible, I guess I can do it in conversation after all, checking for the item in all inventories and be OK with it since it's a game after all. Can't have it all perfectly making sense. But thought I'd ask anyway :).



#2
Claudius33

Claudius33
  • Members
  • 258 messages

I did something like that in Sarmates! The gifts had to be bought after a quest completion though. So I just checked items presence on the whole party.

 

To make it more realistic :

In your i_tagofgift_aq tag based script, I'd check the owner (GetItemPossesor) : If the owner is not the PC, destroy the item and create it into the PC's inventory.

If the player later tries to move it from the PC to a companion out of the conversation 'I got something for you', the script just fires again.

 

Have a flag attached to each gift in order to :

  • prevent the tag based script to delete the object when the transfer is done through the convo
  • avoid  any exploit (player taking back the given item then giving it again and again) . 

 

Have the gifts blueprints and the tag based script in the campaign folder if the convo can be played from another module.



#3
Dann-J

Dann-J
  • Members
  • 3 161 messages

I have a lot of quest-related items in the module I'm currently working on that use tag-based OnAcquire scripts. Below is an example of how you might do it.

 

I tend to 'curse' certain items once in the player's inventory, so they can only be transferred via a conversation (un-curse the item, transfer it, then re-curse it). The conversation node in question would only check for the presence of the item in the player's inventory alone.

// i_itemtag_aq

#include "ginc_item_script"

void main()
{
object oPC = GetModuleItemAcquiredBy();
object oFirstPC = GetFirstPC(TRUE);
object oItem = GetModuleItemAcquired();

// Only run this script once per individual item
if (IsItemMarkedAsDone(oItem, SCRIPT_MODULE_ON_ACQUIRE_ITEM)) return;

// Only run this script if acquired by a party member		
if (!IsItemAcquiredByPartyMember()) return;

if (oPC != oFirstPC) TransferItem(oPC, oFirstPC, oItem);
DelayCommand(1.0, SetItemCursedFlag(oItem, 1));

MarkItemAsDone(oItem, SCRIPT_MODULE_ON_ACQUIRE_ITEM);
}



#4
andysks

andysks
  • Members
  • 1 650 messages

Both interesting. The second a bit easier. All you do there Dann, is see if a companion looted it, and if he did then you transfer it to the main PC and curse it. Will the ga_destroy_item or ga_take_item work with cursed flags? Or do I need to remove the flag while giving away the item? And does a tag script also work if the item is bought from a merchant?



#5
Dann-J

Dann-J
  • Members
  • 3 161 messages

Ga_destroy_item shouldn't care about a cursed item, but ga_take_item might have problems. I usually copy the item to the destination inventory, destroy the original, then use my own ga_curse_item script to curse the copy.

 

I'm not convinced that OnAcquire scripts fire when you buy things (although I could be wrong). They certainly don't fire if you spawn an item directly into an inventory.



#6
andysks

andysks
  • Members
  • 1 650 messages

Good to know. I think I will destroy the items so that I avoid exploits, and because they don't actually serve any other purpose than gaining some influence. Although it might be nice to see them collected in a companion's inventory. About the bought, I'll have to test it.



#7
Dann-J

Dann-J
  • Members
  • 3 161 messages

I've got several items in a module I'm working on that you have to give to companions in order for them to stay in the party permanently. Many of them are equippable items which the companion will want to use until they find something better. Cursing and plotting the item makes sure you can't take it back from them or sell it.

 

Sometimes companions will express an interest in a unique replacement item. If you agree to let them keep the new item, the old item is un-cursed and un-plotted, allowing the player to do what they want with it.

 

For non-party members who are plot-related NPCs I usually just destroy items that are 'given' to them, since you'll never get to see into their inventories. The only exceptions are NPCs who you might get a chance to kill later, if you want the player to be able to loot their corpses and take back all the cool stuff you gave to them during earlier quests.



#8
Tchos

Tchos
  • Members
  • 5 054 messages

If items are valuable or gold, I like to put them into the NPC's inventory, even if the NPC is not hostile or likely to be fought, because of pickpocketing.


  • GCoyote aime ceci

#9
Dann-J

Dann-J
  • Members
  • 3 161 messages

If items are valuable or gold, I like to put them into the NPC's inventory, even if the NPC is not hostile or likely to be fought, because of pickpocketing.

 

That could offer rogues a way to make unlimited money, if an NPC agreed to buy as many of a particular type of item as you can find. You could hand in the same items over and over again.

 

One way to short-circuit that exploit would be to set the items to 'stolen' once they've been transferred to the NPC's inventory, and setting their store object to not buy stolen goods. It'd still be handy for usable items though. You'd make some money handing them in, then get to use them anyway.



#10
Tchos

Tchos
  • Members
  • 5 054 messages

I do have one NPC who does that, but in her case I do actually destroy the items.



#11
andysks

andysks
  • Members
  • 1 650 messages

Stores work by the way. Buying an item triggers its tag based script :). Good stuff. Thanks a lot for the help.



#12
Dann-J

Dann-J
  • Members
  • 3 161 messages

Stores work by the way. Buying an item triggers its tag based script :). Good stuff. Thanks a lot for the help.

 

That's good to know. Thanks for testing it.