Server Totals
Wilderness - (2)
Deglos - (1)
Le'Or - (1)
Mikona - (1)
Ferrell - (1)
Elysia - (1)
M'Chek - (0)
Underdark - (0)
Visimontium - (0)
Total players: 7
Gallery

Links Menu

Merchant Scripting

Moderators: Nighthawk4, Dungeon Masters

Merchant Scripting

PostAuthor: 4x4_Ender » Fri Oct 29, 2004 2:40 pm

From the Subcontractor Forum:

Krator wrote:
4x4_Ender wrote:One more question:

Is it possible for the store to identify a PC's plot guild item and, if that PC posesses one, open a different store inventory for them??


That will be quite easy to include in the conversation that opens the store.


I dont know where to begin to do this. Im guessing you use the GetItemPossesedby() command to determine if the PCis carrying the necessary item. But, do you have to create two different stores? Or, does the store need to be created from the script itself and have one of two scripted inventories based on if the PC has the item or not?

Im a horrible coder, but i think this should be pretty basic so some help here would be appreciated. 8) [/quote]
"Many make a trade of delusions and false miracles, deceiving the stupid multitude." -Leonardo Da Vinci
User avatar
4x4_Ender
Sage
 
Posts: 1782
Joined: Wed Jun 04, 2003 11:26 pm
Location: Woodbury, MN (GMT -6)

PostAuthor: Krator » Fri Oct 29, 2004 2:48 pm

Your conversation needs to look like this: (And yes, you need two stores)
Code: Select all
NPC Hello!
    PC Open Store
         NPC You have the item so you get 1337 items (Text Appears When Script, see below, and Actions Taken Script from scriptwizard to open store 1)
         NPC Ok. (Actions Taken Script from scriptwizard to open store 2!)



For the script: Use this (Not the best way, but it works :P)
This goes into the Text Appears When of the conversation part that opens the store for PCs that have the item. Place the appropiate script in Actions Taken.
Tip: Use Lilac Soul script generator, it sucks, but you can learn much from it. It was my first scripting too.
(This is a part of a script I had somewhere, some things might be useless)
Code: Select all
int StartingConditional()
{
object oPC = GetPCSpeaker();
object oItem = GetFirstItemInInventory(oPC);
int nObjectCount;
while (GetIsObjectValid(oItem))
{
  if(GetTag(oItem)=="/*tag of item goes here*/")
        nObjectCount++;

  oItem = GetNextItemInInventory(oPC);
}
if (nObjectCount==1)
return TRUE;
else
return FALSE;
}
Playing as: Sir Douglas Hope of Gorethar, old school paladin | Krator Blackfist, gold mage | Warren, half nymph barbarian
User avatar
Krator
Elder Sage
 
Posts: 4947
Joined: Thu Jun 10, 2004 6:44 pm
Location: Amsterdam
Timezone: GMT

PostAuthor: Mistcaller » Fri Oct 29, 2004 2:58 pm

I have done the same before with the Scholar's innkeeper in deglos. Here is some generic script to use in the ActionTaken tab when the PC asks to see the store (you should have already created 2 store objects):

Code: Select all
void main()
{
object oPC = GetPCSpeaker();
object oItem = GetItemPossessedBy(oPC, "YourItemTag");
object oStore1 = GetNearestObjectByTag("INV_YourStoreA");
object oStore2 = GetNearestObjectByTag("INV_YourStoreB");

if (GetIsObjectValid(oItem))
   OpenStore(oStore1, oPC);
else
   OpenStore(oStore2, oPC);
}


You'd like perhaps to take a look in the OpenStore command description for more details.
User avatar
Mistcaller
Team Member; Retired with Honors
 
Posts: 5481
Joined: Sun Feb 09, 2003 3:42 pm
Location: Athens, Greece (GMT +2)

PostAuthor: Krator » Fri Oct 29, 2004 3:00 pm

Mistcaller pwns me. Use his thing.
Playing as: Sir Douglas Hope of Gorethar, old school paladin | Krator Blackfist, gold mage | Warren, half nymph barbarian
User avatar
Krator
Elder Sage
 
Posts: 4947
Joined: Thu Jun 10, 2004 6:44 pm
Location: Amsterdam
Timezone: GMT

PostAuthor: 4x4_Ender » Fri Oct 29, 2004 3:24 pm

Krator wrote:Mistcaller pwns me. Use his thing.


LOL, he pwns eveyone, so dont feel bad. Thans for the help both of you.
"Many make a trade of delusions and false miracles, deceiving the stupid multitude." -Leonardo Da Vinci
User avatar
4x4_Ender
Sage
 
Posts: 1782
Joined: Wed Jun 04, 2003 11:26 pm
Location: Woodbury, MN (GMT -6)

PostAuthor: Mistcaller » Fri Oct 29, 2004 3:31 pm

4x4_Ender wrote:
Krator wrote:Mistcaller pwns me. Use his thing.


LOL, he pwns eveyone, so dont feel bad. Thans for the help both of you.


Hehe.. Bah.. I'm still a "whiney peasant" in scripting.. :)
User avatar
Mistcaller
Team Member; Retired with Honors
 
Posts: 5481
Joined: Sun Feb 09, 2003 3:42 pm
Location: Athens, Greece (GMT +2)

PostAuthor: 4x4_Ender » Sun Oct 31, 2004 11:12 pm

Ok, i got midnight's method to work. But, i want to change how this works slightly. Under the current method, the script activates all at once after a single PC quote in the conversation is clicked on, causing the appropriate store to open immediatly after the script checks for the item tag.

But, what i want to have happen is for the script to check for the item tag, and have the conversation move to 1 of 2 different lines of NPC quote based on the result of checking for the item. After the NPC finishes this line of conversation, THEN the appropriate store opens.

What i think needs to be done for this modification is to move the script to the "Text appears when..." tabs for each of the two different lines of conversation, and move the OpenStore() lines in the script to the "Actions Taken" tab as a seperate script.

The problem is the "Text appears when..." script needs to be in this form apparently, which is what is in the blank script rather than void main:

Code: Select all
int StartingConditional()
{
    int iResult;

    iResult = <<PLACE THE CONDITIONAL HERE>>;
    return iResult;
}


So, how do i use this to activate the text based on whether the object the original script got is valid or not?
"Many make a trade of delusions and false miracles, deceiving the stupid multitude." -Leonardo Da Vinci
User avatar
4x4_Ender
Sage
 
Posts: 1782
Joined: Wed Jun 04, 2003 11:26 pm
Location: Woodbury, MN (GMT -6)

PostAuthor: 4x4_Ender » Mon Nov 01, 2004 12:08 am

Nevermind, i figured it out. :oops:
"Many make a trade of delusions and false miracles, deceiving the stupid multitude." -Leonardo Da Vinci
User avatar
4x4_Ender
Sage
 
Posts: 1782
Joined: Wed Jun 04, 2003 11:26 pm
Location: Woodbury, MN (GMT -6)

PostAuthor: Drakuul » Mon Nov 01, 2004 1:07 am

Bunny with a pancake on his head! I love you 4x4!
Image
User avatar
Drakuul
Sage
 
Posts: 2379
Joined: Tue May 20, 2003 3:17 pm
Location: UK, South Wales

PostAuthor: 4x4_Ender » Mon Nov 01, 2004 1:26 am

Drakuul wrote:Bunny with a pancake on his head! I love you 4x4!


:P
"Many make a trade of delusions and false miracles, deceiving the stupid multitude." -Leonardo Da Vinci
User avatar
4x4_Ender
Sage
 
Posts: 1782
Joined: Wed Jun 04, 2003 11:26 pm
Location: Woodbury, MN (GMT -6)


Return to NWN Scripting

Who is online

Registered users: Bing [Bot], Google [Bot]