Aller au contenu

Photo

need script for adding items to Bodahn merchant in party camp


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

#1
darkshadow136

darkshadow136
  • Members
  • 1 796 messages
Is there anyone that can help me with this I have created alot of items I want to add to bodahn in the party camp versus having them spawn in my inventory. Can anyone provide me with a script I could use to add these items to his inventory.

I really don't want to go through making a custom merchant when he is already there.


Thanks in advance for any help you can provide. :)

#2
nezroy

nezroy
  • Members
  • 99 messages
// All module events
#include "utility_h"
#include "plt_nez_bodahn_shd_plot"

void main()
{
    if ( WR_GetPlotFlag( PLT_NEZ_BODAHN_SHD_PLOT, NEZ_BODAHN_CHECK_FLAG ) == TRUE )
        return;

    int nEvent = GetEventType(GetCurrentEvent());

    if (nEvent == EVENT_TYPE_MODULE_LOAD || nEvent == 2000)
    {
        object oBodahn = GetObjectByTag("store_camp_bodahn");
        if (IsObjectValid(oBodahn))
        {
            object oShield = CreateItemOnObject(R"nez_im_arm_shd_twr_wrd.uti", oBodahn, 1, "", TRUE);
            WR_SetPlotFlag( PLT_NEZ_BODAHN_SHD_PLOT, NEZ_BODAHN_CHECK_FLAG, TRUE );
        }
    }        
}

This code uses a check flag in the plot "nez_bodahn_shd_plot" in order to verify that the item is only added once per game. You must create an equivalent plot and insert a main flag before writing the script. The plot name and flag constant in the script should match whatever you call your plot/main flag.

I found the hardest part with this was that the
GetObjectByTag("store_camp_bodahn")
call only works if you are actually in the Party Camp area; otherwise he is not an active asset and you cannot add the item. After some trial and error and a lot of floaty messages, I found that event # 2000 seems to fire reliably upon entering a new area. This may be the EVENT_TYPE_FINISH_TRAVEL event that is listed on the wiki but is missing from the toolset constants (though it does have EVENT_TYPE_BEGIN_TRAVEL).

Regardless, when event # 2000 fires, the area the player was traveling to appears to be loaded by that point. This script simply tries to get Bodahn's store on every such event, which will eventually work once the player travels to the party camp. At that point it adds the item and sets the plot flag to prevent it from activating again.

Modifié par nezroy, 28 janvier 2010 - 01:07 .


#3
Lotion Soronarr

Lotion Soronarr
  • Members
  • 14 481 messages
You could have just used a PRCSCR to make sure the script fires on camp area load.

#4
libbykino

libbykino
  • Members
  • 4 messages
Quick bump... I tried altering the script from Nezroy, but it doesn't seem to be working properly, the items show up in my inventory instead of Bodahn's. Perhaps Lotion Soronnar or someone else can give me an example of what the script would look like with the PRCSCR he mentioned?

All I'm looking for is a script that will add N number of items X Y and Z to Bodahn's inventory.

Modifié par libbykino, 30 janvier 2010 - 11:59 .


#5
Baracuda6977

Baracuda6977
  • Members
  • 353 messages
#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");
//this is varathorns tag, open up bodahns resource and find his tag to insert
            int iAmtToAdd = (40 - CountItemsByTag(oMerc, "my_item"));
//40 is total amount in store wanted, havent tested this part yet
            CreateItemOnObject(R"my_item.uti", oMerc, iAmtToAdd, "my_item", FALSE);
            break;
        }
        default:
        {
            break;
        }
     }
}

3 days of hard work for this
hope it helps

#6
libbykino

libbykino
  • Members
  • 4 messages
Thank you! One quick question... is "my_item" different from "my_item.uti" in your script? What I mean is, should I put the .uti in all 3 places, or just the one you have the .uti after?

...if that question makes sense at all...

What I'm thinking my script is going to look like is this:

#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_camp_bodahn");
            //Bodahn's tag
            int iAmtToAdd = (4 - CountItemsByTag(oMerc, "allset_tank_sword"));
            //4 is total amount in store wanted
            CreateItemOnObject(R"allset_tank_sword.uti", oMerc, iAmtToAdd, "allset_tank_sword", FALSE);

            object oMerc = GetObjectByTag("store_camp_bodahn");
            //Bodahn's tag
            int iAmtToAdd = (4 - CountItemsByTag(oMerc, "allset_tank_shield"));
            //4 is total amount in store wanted
            CreateItemOnObject(R"allset_tank_shield.uti", oMerc, iAmtToAdd, "allset_tank_shield", FALSE);

            break;
        }
        default:
        {
            break;
        }
     }
}


Is that correct?  Do I repeat the whole script for each item I want to add?

Modifié par libbykino, 31 janvier 2010 - 06:37 .


#7
libbykino

libbykino
  • Members
  • 4 messages
:/ I tried using the code I posted above, but I'm still having the same issue... the items appear in my inventory instead of Bodahn's, albeit in the correct number, at least.



Not sure what I'm doing wrong.

#8
Craig Graff

Craig Graff
  • Members
  • 608 messages
Are you in the camp area when the module is loading? Even if you are it is possible that the store object isn't loaded when the above script fires. You would be better off using a PRCSCR script. For the contents of the script, just take everything you have between the brackets of EVENT_TYPE_MODULE_LOAD and move it directly into the void main() like so:
[dascript]
void main()
{
object oMerc = GetObjectByTag("store_camp_bodahn");
//Bodahn's tag
int iAmtToAdd = (4 - CountItemsByTag(oMerc, "allset_tank_sword"));
//4 is total amount in store wanted
CreateItemOnObject(R"allset_tank_sword.uti", oMerc, iAmtToAdd, "allset_tank_sword", FALSE);
}
[/dascript]

Follow the adding new content to existing areas links in my .sig for more info on PRCSCR files.

Modifié par Craig Graff, 31 janvier 2010 - 09:01 .


#9
Baracuda6977

Baracuda6977
  • Members
  • 353 messages
for the record, with my iAmtToAdd line, it makes it stay at x number of items in his inventory, did you load a load where you had already loaded the module? i think it might only be running the second+ time and not the first



i need to look into this PRCSCR though

#10
nezroy

nezroy
  • Members
  • 99 messages
Thanks Lotion & Craig, the PRCSCR is definitely a much easier way to fire off that code. Don't know how I missed that while going through the various tutorials :)

#11
darrenr22

darrenr22
  • Members
  • 138 messages
Apologies for resurrecting a five month old thread but I am interested in adding items to Bodahn's inventory. I thought there would be a lot of information floating around on the net with easy instructions as to how to do this but that does not seem to be the case.



Is Craig Graff's script earlier in this thread the finished script for adding an item to Bodahn's inventory (changing the "allset_tank_sword" to the relevant item to be added)? I am a little unclear as to whether he is suggesting a change to libbykino's script or is giving a complete finished script.



If it is not the finished complete script would someone quickly be able to provide the complete script. Lots of people seem to be creating mods which add items to that inventory so it must be fairly common knowledge.




#12
midnightgeek

midnightgeek
  • Members
  • 30 messages
I assume you already have your module created with your custom items.  If not there are plenty of tutorials around which can get you to that point.  Once you have your module and items created you can come back here.

This may seem overly complicated at first, but doing it this way ensures that it will be compatible with any DLC or fan made modules.

Step 1: Create the plot file
File -> New -> Plot. I named mine "tmg_bodahn_plot".
Right click -> Insert -> Main flag.  Give it a name, I called it "TMG_ITEMS_GIVEN".  Default value=Not set
The purpose of the plot flag is to limit the code execution to only the first time the player enters the area.

Step 2: Write the script
File -> New -> Script.  I named mine "tmg_bodahn".
I used the one from here:
http://social.biowar...existing_Vendor

Below is the script using my resource names from step 1:

#include "wrappers_h"
#include "plt_tmg_bodahn_plot"  // include your custom plot

void main()
{
  if ( WR_GetPlotFlag( PLT_TMG_BODAHN_PLOT, TMG_ITEMS_GIVEN ) == TRUE ) return;

  object oStore = GetObjectByTag("store_camp_bodahn");        // use this one for Bodahn/Origins

  if (IsObjectValid(oStore))
  {
    CreateItemOnObject(R"magus_staff.uti", oStore, 1, "", TRUE); // repeat this for each item

    WR_SetPlotFlag( PLT_TMG_BODAHN_PLOT, TMG_ITEMS_GIVEN, TRUE );
  }
}

Step 3: Create the custom PRCSCR file
Open Excel and create a new file like the one shown here:
http://social.biowar....php/PRCSCR.xls

The value in the "script name" should be the name of the script you created in step 2 in my case "tmg_bodahn"

Complile the 2da by using the ExcelProcessor as illustrated here:
http://social.biowar.../Compiling_2DAs

Name it "PRCSCR_whatever.2DA" and drop it into your module's override directory
(Documents/BioWare/Dragon Age/AddIns/yourModuleName/core/override)

Load the game, go to party camp and Bodahn should have your item(s) for sale.

Note that there are more than one party camp (some are used for cutscenes) so if your items are not there, travel somewhere and then go back to camp and they should be there.

Modifié par midnightgeek, 19 juin 2010 - 02:27 .


#13
darrenr22

darrenr22
  • Members
  • 138 messages
After one or two teething troubles, I have got this working thanks to your splendid advice. Thank you very much, midnightgeek. Your help is much appreciated.

Modifié par darrenr22, 19 juin 2010 - 06:45 .


#14
Ael

Ael
  • Members
  • 36 messages
I hate to reopen a 3 month old thread but i have a question as I am just now beginning to use the toolset:

When i create the plot file under "module" do I select My custom content module or Core game resources

Maybe a silly question for you experienced ppl but I'm a noob at this toolset thing

Thank You Timelord

Modifié par Ael, 16 septembre 2010 - 04:21 .


#15
TimelordDC

TimelordDC
  • Members
  • 923 messages
Your module