Aller au contenu

Photo

Limitations to CreateItemOnObject? [solved]


1 réponse à ce sujet

#1
BillHoyt

BillHoyt
  • Members
  • 109 messages
This question is going to sound rather silly, but I'm kind of at my wits' end here.

I have a 0-cost merchant called store_jenna that I stock with treasure items from numerous quests rather than giving them directly to the PC. The first time the PC speaks with Jenna (the proprietor), they can upgrade her store by paying her to become their permanent archivist. I run a script (included below) which adds a bunch of books to her inventory, some of which are gifts, some of which increase skills, most of which are junk. This first script (called first_restock) works swimmingly. It is run from Jenna's dialogue.

// -----------------------------------------------------------------------------
// first_restock script
// Owner: Bill Hoyt
// -----------------------------------------------------------------------------
/*
  This script will upgrade Jenna's Bookstore (first time)
*/
//------------------------------------------------------------------------------

#include "utility_h"
#include "wrappers_h"
#include "plot_h"
#include "plt_store_restock"

// ---------- Script Starts Here ----------
void main()
{
    // Take 20 gold from PC
    object oPC = GetHero();
    UT_MoneyTakeFromObject(oPC,0,0,20);

    object  oStore = GetObjectByTag("store_jenna");

    CreateItemOnObject  (R"book_breathing.uti",oStore, 1);
    CreateItemOnObject  (R"book_dogma.uti",oStore, 1);
    CreateItemOnObject  (R"book_hist_circle.uti",oStore, 1);
    CreateItemOnObject  (R"book_stone.uti",oStore, 1);
    CreateItemOnObject  (R"diary_sanga.uti",oStore, 1);
    CreateItemOnObject  (R"tome_fade.uti",oStore, 1);
    CreateItemOnObject  (R"tome_flame.uti",oStore, 1);
    CreateItemOnObject  (R"tome_menace.uti",oStore, 1);
    CreateItemOnObject  (R"tome_undead.uti",oStore, 1);
    CreateItemOnObject  (R"book_execution.uti",oStore, 1);
    CreateItemOnObject  (R"book_methods.uti",oStore, 1);
    CreateItemOnObject  (R"book_music.uti",oStore, 1);
    CreateItemOnObject  (R"tome_lapidary.uti",oStore, 1);
    CreateItemOnObject  (R"tome_frostbacks.uti",oStore, 1);
    WR_SetPlotFlag("store_restock", FIRST_RESTOCK, TRUE);

}
// ---------- Script Ends Here ----------

Jenna has an assistant named Brother Maynard, for whom the PC can retrieve an item. As payment for the quest, I would like to add more books to store_jenna. However, even though the script (second_restock, run from Brother Maynard's dialogue) is running, the books never appear in store_jenna.

// -----------------------------------------------------------------------------
// second_restock script
// Owner: Bill Hoyt
// -----------------------------------------------------------------------------
/*
  This script will upgrade Jenna's Bookstore (second time)
*/
//------------------------------------------------------------------------------

#include "utility_h"
#include "wrappers_h"
#include "plot_h"
#include "plt_store_restock"

// ---------- Script Starts Here ----------
void main()
{
    object  oStore = GetObjectByTag("store_jenna");
    CreateItemOnObject  (R"book_elf_music.uti",oStore, 1);
    CreateItemOnObject  (R"book_unchain.uti",oStore, 1);
    CreateItemOnObject  (R"tome_dwarf_children.uti",oStore, 1);
    CreateItemOnObject  (R"tome_dentistry.uti",oStore, 1);
    CreateItemOnObject  (R"tome_rime.uti",oStore, 1);
    WR_SetPlotFlag("store_restock", SECOND_RESTOCK, TRUE);

    object oMaynard = GetObjectByTag("brother_maynard");
    DisplayFloatyMessage(oMaynard,"Books Added");
}
// ---------- Script Ends Here ----------

I would tend to think there is something wrong with the script, but I originally tried to re-stock Jenna's store multiple times through her dialogue but could never make it work twice.  So I deleted all that, then created the Brother Maynard re-stock from scratch, and that seems not to work a second time (to get this quest, you must have already completed first_restock).

So is there an iteration limit on external store updates? On how many times you can CreatItemOnObject? Or is there something in the script that I'm missing?  Any insight would be greatly appreciated.

Modifié par BillHoyt, 07 mai 2010 - 02:57 .


#2
DavidSims

DavidSims
  • BioWare Employees
  • 196 messages
Export with dependant resources only exports resources that the toolset knows are dependant, such as creatures placed in the level, conversations atatched to those creatures, plots used in those conversations, scripts atatched to those plots and so on down the line. If you are only referencing an item in script, the toolset has no way of knowing the item appears in the level, therefore it's not considered a dependant resource. To be safe, I almost always export without dependant resources, and export whole folders when I want to cover everything.