Altering an existing merchant's inventory.
#1
Posté 22 novembre 2009 - 10:31
On a similar note - having trouble adding new crafting recipes. I extended the 2DA as outlined in a tutorial, compiled it into GDA, then dropped the new GDA into the override folder; the toolset refuses to read it, so I can't make a new, purchaseable item which would actually teach how to make these new recipes. I'd be fine letting players automatically know the recipe, but I don't know how to do that, either. This was my original plan for obtaining the arrows, until I realized nothing besides liferoot and deathroot was really cheap enough...
#2
Posté 23 novembre 2009 - 01:50
#3
Posté 25 novembre 2009 - 12:08
Not that I intend to rip off your work or anything, I'm just at a loss on what I need to do script wise.
#4
Posté 25 novembre 2009 - 12:30
basicaly you figure out the tag of the merchant-object (either by browsing through the game-files with the toolset looking for a .utm file) or by just getting all in the area with GetAllObjectsInArea of type Merchant and print the tags to your screen using a Floaty.
then use GetObjectByTag to get the spezific Merchant you want.
After that ist quite simple - CreateItemOnObject - only thing we can't do this way is setting something to an infinite stack-size - at last i don't know of any way.
#5
Posté 26 novembre 2009 - 02:03
#6
Posté 26 novembre 2009 - 02:10
#7
Posté 26 novembre 2009 - 02:41
Although tbh, it seems they included that merchant in Warden's Keep >
#8
Posté 14 décembre 2009 - 06:25
AND04 wrote...
ok, well let me outline what we did:
basicaly you figure out the tag of the merchant-object (either by browsing through the game-files with the toolset looking for a .utm file) or by just getting all in the area with GetAllObjectsInArea of type Merchant and print the tags to your screen using a Floaty.
then use GetObjectByTag to get the spezific Merchant you want.
After that ist quite simple - CreateItemOnObject - only thing we can't do this way is setting something to an infinite stack-size - at last i don't know of any way.
Sorry to dig up an old thread, but I have questions.
How did you make sure that you only run the script once? Wouldn't the script run everytime it's loaded and therefore add items everytime you load the game?
Also the merchant would only be loaded (Object valid) while in the area right? Does that mean script is loaded at all times, but only does something when in the correct area? If that's the case, the script will have to fire everytime we get to a new area?
Lastly, what else can you do with a merchant object besides adding an item? Possible to change attributes like markup and markdown?
Thanks in advance.
#9
Posté 14 décembre 2009 - 07:01
My question remain as to how to make sure it only runs once, and at the right time :|
Modifié par SuperD-710, 14 décembre 2009 - 07:02 .
#10
Posté 14 décembre 2009 - 12:19
1) Use a plot flag like everything else you want the game to have a persistent memory about.
2) Add the items during an event that only runs once per area load and only adds the items if they do not exist on the merchant already. This method has the feature/bug of restocking items that have been purchased previously.
#11
Posté 14 décembre 2009 - 04:15
sillyrobot wrote...
I can think of two ways off the top of my head:
1) Use a plot flag like everything else you want the game to have a persistent memory about.
2) Add the items during an event that only runs once per area load and only adds the items if they do not exist on the merchant already. This method has the feature/bug of restocking items that have been purchased previously.
Thanks for your response, I will look into both ways.
A question on triggering script on area load: If I use a PRCSCR file, there would be no need for using events right? That script will only run while loading the particular area. Or am I misunderstanding something wrong?
#12
Posté 23 janvier 2010 - 04:48
I have this script below, and I'm wanting to add to it, so that the items I'm placing in my inventory I can also purchase from Bodhan (say if I want an additional copy or something)...please help to show me how I should do that....
Thank you in advance!!
// All module events
#include "utility_h"
#include "wrappers_h"
#include "events_h"
void main()
{
event ev = GetCurrentEvent();
int nEvent = GetEventType(ev);
Log_Events("", ev);
switch (nEvent)
{
case EVENT_TYPE_MODULE_LOAD:
{
// get the object which contains the player
object oPlayer = GetHero();
object oRobe = GetObjectByTag("scm_resduskrobes");
if (!IsObjectValid(oRobe))
UT_AddItemToInventory(R"scm_resduskrobes.uti",1);
object oStaff = GetObjectByTag("scm_duskstaff");
if (!IsObjectValid(oStaff))
UT_AddItemToInventory(R"scm_duskstaff.uti",1);
object oGlove = GetObjectByTag("scm_duskgloves");
if (!IsObjectValid(oGlove))
UT_AddItemToInventory(R"scm_duskgloves.uti",1);
object oBoot = GetObjectByTag("scm_duskboots");
if (!IsObjectValid(oBoot))
UT_AddItemToInventory(R"scm_duskboots.uti",1);
object oHelm = GetObjectByTag("scm_duskhelm");
if (!IsObjectValid(oHelm))
UT_AddItemToInventory(R"scm_duskhelm.uti",1);
GetObjectByTag("store_camp_bodhan.utm")
CreateItemOnObject(R"scm_duskrobes.uti",3,"scm_resduskrobes")
break;
}
default:
{
break;
}
}
}
Right before the break, where the "GetObjectByTag("store_camp_bodhan.utm")" is....I don't know what to do there....I don't know the syntax or proper way to go about doing this portion...I added those last two lines, but I do not think they are right. Could someone please just show me how to add the robe to the merchant, like what I need to type there exactly, and I can copy that for the rest of my items.
Sorry I'm just not a coder and this is the first toolset I've ever messed with...
Thanks again!!
#13
Posté 25 janvier 2010 - 04:24
#14
Posté 27 janvier 2010 - 12:59
edit:
http://social.biowar...ateItemOnObject
i believe this will give you your syntax
i pulled this script out of my ass, and am afraid to implement it of fear of breaking my DA, does this look like it would work? :
edit 2:
scratch that, here is a slightly more debugged version:
#include "wrappers_h"
#include "utility_h"
#include "events_h"
void main()
{
event ev = GetCurrentEvent();
int nEvent = GetEventType(ev);
Log_Events("", ev);
switch (nEvent)
{
case EVENT_TYPE_MODULE_LOAD:
{
object oMerc = GetObjectByTag("store_ntb100cr_varathorn",1);
int iAmtToAdd = (40 - CountItemsByTag(oMerc, "My_Item"));
CreateItemOnObject(R"My_Item.uti", oMerc, iAmtToAdd, "My_Item", FALSE);
break;
}
default:
{
break;
}
}
}
this works for adding my item to varathorns inventory
Modifié par Baracuda6977, 29 janvier 2010 - 02:57 .
#15
Posté 02 février 2010 - 05:32
#16
Posté 03 février 2010 - 12:43
object oPlayer = GetHero();
iAmtToAdd...
UT_AddItemToInventory(R"my_item.uti",iAmtToAdd);
break;
not 100% sure though, for a cheat just leave those lines in the void?





Retour en haut






