Aller au contenu

Photo

Help with Container Tagbased Script...


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

#1
Genisys

Genisys
  • Members
  • 525 messages
Ok, I have this container, which will store Undroppable Items, which the PC will place in the Container by another Tagbased Scripted Item, however, I need to script for the Container to do something..

Basically I need the Container to do this...

When the PC goes to pull an Undroppable item from the Container, I need the item they are trying to pull from the Container to be copied to the PC Inventory (including Variables) and the original item in the Bag needs to be destroyed..

How do I go about doing this?

I know I'm so close to finishing this system, just need a hint / tip to do finish...

Thanks for the help guys..

#2
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
Nwnx may be able to do it.



The only way without nwnx that i can think of would be to make a widget to use on the item in order to move it out of the bag. Sounds like what you did to get the item itno the bag in the first place.. .





I dont know about destroying the item and recreating it. You can lose tracking on items that way. At least if you are tracking items.

#3
Genisys

Genisys
  • Members
  • 525 messages
Tracking items... hhmmm



I wish there was someway to target the items in the bag with another item.. but that's no go...



Therefore, when the player uses the same widget, they will empty the bag, more or less...



Thanks Lightfoot8 nice tip XD

#4
420

420
  • Members
  • 190 messages
Start a conversation when the PC uses the bag and list the contents as custom tokens. That way PCs can just choose which item they want from the list. This will limit the total number of items the bag can contain to the total number of custom tokens/conversation nodes you wish to make.



-420

#5
Genisys

Genisys
  • Members
  • 525 messages
Custom Tokens, with GetName(object oObject) of item I presume?

#6
420

420
  • Members
  • 190 messages

Genisys wrote...

Custom Tokens, with GetName(object oObject) of item I presume?

Yup, and use a "Text Appears When..." script to see if the object is valid.

-420

#7
Genisys

Genisys
  • Members
  • 525 messages
Text Appears When, for what though? I'm lost here, why are we adding this too?



I'm assuming you set the tokens when the PC Uses the bag right? (e.g. the script fires to the conv.)



Another thing, by starting a conversation, are they going to still be able to view the contents of the bag?



I don't know how to set the Cast Spell: Unique Power (Self Only) on a container, any tips?




#8
420

420
  • Members
  • 190 messages
Assuming the container is a placeable you'd put the script in the OnUsed event of the placeable. The script would then cycle through the contents of the container, setting custom tokens, then it would start the conversation. The PC would never see the contents of the container directly, only a list of the contents in conversation.



-420

#9
Genisys

Genisys
  • Members
  • 525 messages
I'm using a bag/container in the PC's inventory...

#10
420

420
  • Members
  • 190 messages

Genisys wrote...

I'm using a bag/container in the PC's inventory...

Ugh, unfortunately there is little you can do with the container items. I don't know why BioWare didn't just allow miscellaneous items to have the "enhanced container" item property but container items are very limited in their functionality.

-420

#11
Daybringer

Daybringer
  • Members
  • 14 messages
The only way I can see to do this is with a wand item for pulling things from said bag, or alternatively you could have the non-movable item have its own activate so that when used it removes itself from the bag and then copies itself from inventory:



Wand should look like this (kinda sorta, you need to set up the if and then do whatever how it should be)...



void main()

{

object oItem = GetItemActivatedTarget();

object oPC = GetItemActivator();



if (GetTag(oItem) == "PickMe") /*Put in the check for whatever variables the item should have or the tag which is already kinda sorta scripted for*/

{

CopyItem(oItem, oPC, TRUE);

DestroyObject(oItem);

}

else

{

SendMessageToPC(oPC, "This is a no no, use this on the item in the bag");

}

}



If however you want to go with the whole use the item itself to move it over... that is a lot more difficult and may interrupt your system (especially given that the item will have to have a specific tag for such, or again you could probably check for the variable with a custom module on use script to run the script with items with the variables yours have

#12
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
Good suggestion Daybringer,



Except It has already been mentioned that an Item In a Bag can not be targeted by a wand. So a more complex system will be needed. Or just dump all the Items out of the bag like the OP suggested when he nentioned the limited on the wand use.

#13
Daybringer

Daybringer
  • Members
  • 14 messages
Oh silly me ^^; well then... the other way to do that is to check the items in the container via using a wand on it.... then put in a script that opens a dialogue listing the items in said container dynamically of course, then having that dynamically made dialogue listing all the lil parts and pieces in the container have it so you can copy over items ...



Though there's probably something easier if you care to mention what you want done with the items... fun examples of dynamically done things are in shayan's subraces, and the DMFI dm inventory check widget (from before nwn allowed dms to open someones inventory)


#14
Genisys

Genisys
  • Members
  • 525 messages
I just had an idea, how about I just target the bag with the same wand that targets the items that are put in the bag... An if the PC targets the bag, all the items are taken out, so they can reload the bag...



Of course, I've run into one more problem...



I need to know how to check to see if the bag is full BEFORE I put an item in there, because in truth, there is no way for me to tell if what I'm going to copy into the bag will copy into it or not...

#15
Daybringer

Daybringer
  • Members
  • 14 messages
That would be a complicated script, that there are no base functions for however you could have the script add the copy to the bag... check if that item is still in the bag after its been supposedly put in, and if the item isn't in the bag then leave the original and if the item does register as being in there then remove the original - or just check if the copied object is still in existence IE:
//this may or may not work depending on how nwn works in game
object oItemTwo = CopyItem(oItem, oBAG, TRUE);
if (oItemTwo != OBJECT_INVALID)
{
DestroyObject(oItem);
}


(the base script x0_s3_prayer has a lot of bag functions if you need to figure out how to do this)

(If the item drops on the ground I think they can pick it up again, if not just use the wand on that grounded item too to pick it up)

Modifié par Daybringer, 16 août 2010 - 07:20 .


#16
Genisys

Genisys
  • Members
  • 525 messages
I got it worked out, I made a custom function...



CheckCopy(string sTag, object oPC, object oOriginal);



Which verifies the PC has the copy in the bag, if so, then it destroys the original item..

(That was the only way I could think of how to ensure that items don't get lost by accident)