A little help, please…

Home page Forums Dragon Age: Origins Fixpack Forum A little help, please…

This topic contains 15 replies, has 2 voices, and was last updated by Portucally Portucally 1 month ago.

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #1028
    Portucally
    Portucally
    Participant

    I don’t know if this is something that someone can help but I’m trying to learn how to give an item to my hero in certain circunstances.

    Like, I want to give him/her a certain uniform when arrives at Ostagar. But I want to give it according to if its a mage, warrior or rogue.

    I have the Of Ferelden mods by TommyIrianto and when my warden do the Joining, the armour and weapons are suit up accordingly.
    I want to make something like that but if it goes into player inventory would be ok too.

    What I need help: Everything! I have no idea where to start or how it can be done.

    I need to know how to do it or where can I find any tutorial I can read about it.

    So far I’ve been reading:

    PRCSCR Script Templates
    adding items to Bodahns store
    A Better Way to Check for Existing Items Before Spawning

    It’s like I’m reading chinese or greek. I have no clue where to start…

    OH, I’m not a modder. So far I only edited some uti files to changes icons, some utc files to change some faces and clothing, and some utp to add some items to chests and dead bodies. Only for my personal game experience, nothing too complicated.

    #1029
    Qwinn
    Qwinn
    Keymaster

    Those are the right tutorials to look at, actually, if you want to be compatible with 100% of mods instead of 99.9% of mods.

    You said you want to add them when the player arrives at Ostagar. The way the game does things the first time you enter Ostagar is in the Ostagar area file script: pre100ar_kings_camp.nss. You would add your script to add the items in the EVENT_TYPE_AREALOAD_PRELOADEXIT case.

    Coincidentally enough, if you just added the code to add your items to the inventory THERE, in the Run-Only-Once portion of the Ostagar area script, and released the mod as your version of the Ostagar area script (along with your new item files, if there are any), it would be compatible with the existing v3.3 of my mod, but not the upcoming v3.4. I’d managed to avoid touching the Ostagar area file this long, but the new fix for dwarf nobles getting partially treated like human nobles in the Mabari Hound quest requires changing it. You could put out vanilla compatible and my-Fixpack compatible versions of that script easily enough.

    Doing it that way, the only other mods you’d be incompatible with are ones that add or change something about the Ostagar area (daytime version only). Are there others that do so? I dunno. But I’d guesstimate it’s not many.

    #1030
    Qwinn
    Qwinn
    Keymaster

    Actually – I’m incorrect. That script doesn’t have a run-only-once case.

    You could achieve the same effect without having to create your own plot file by conditioning the add of your items on:

    if(WR_GetPlotFlag(PLT_COD_CHA_CAILAN, COD_CHA_CAILAN_MAIN) == FALSE)

    and place it just before the UT_Talk(oCailan,OPC) command.

    #1031
    Portucally
    Portucally
    Participant

    Something like this?

    //include utility_h for the UT_AddItemToInventory() function.
    #include "utility_h"
    //include the custom made plot file
    //#include "plt_$plot_file_name$" This line wont be needed, right?
     
    void main()
    {
        // If plot flag is TRUE then item already given.
        // Otherwise add item to inventory.
        if (WR_GetPlotFlag(PLT_COD_CHA_CAILAN, COD_CHA_CAILAN_MAIN) == FALSE)
        {
            UT_AddItemToInventory(R"$item_file_name$.uti"); // Can I duplicate this line to add multiple items?
            //Set the plot flag to TRUE to indicate that the item was given.
            WR_SetPlotFlag( PLT_COD_CHA_CAILAN, COD_CHA_CAILAN_MAIN, TRUE );
        }
    }

    But this:

    and place it just before the UT_Talk(oCailan,OPC) command.

    Where should it be placed? In the script or in the GDA (PRCSCR)?

    I’ve played around with GDA files but those were for DA2. I’m assuming DAO it’s similar…
    But like I said, I have no clue where to start or how to do write it. The tutorials only give an idea about what to do but I couldn’t find any that explain so I could understand…

    #1032
    Qwinn
    Qwinn
    Keymaster

    The PRCSCR and GDA stuff are only necessary if you need your mod to be 100% compatible with every possible mod out there. If you do not do that stuff, and just modify the area file I listed directly, you’ll still be compatible with 99.9% of mods, including my v3.3 (though not my v3.4, but that problem can be dealt with easily later).

    Is this change you’re making to be deployed to the world as a mod, or just for your own use? If just for your own use, and you don’t have another mod touching that area script, then just add your code to the area script (where you’ll find that UT_Talk to Cailan) and be done with it.

    #1033
    Portucally
    Portucally
    Participant

    Is this change you’re making to be deployed to the world as a mod, or just for your own use?

    At the moment, it’s for my own use. Like I said, I’m no modder just a curious trying to learn.
    But I want to learn how to do it compatible with any other mods that I might want to play with.
    I have some mods that add mementos (items) upon arriving at Ostagar from some Origins (Human and Dalish), and I was wondering if I could make something along those lines for other Origins… It’s a long way ahead of what I know at this moment, but maybe one day…

    At this moment, I’m happy if I can add something into the player’s inventory. 😀

    Anyway, You already help a lot more than the tutorials I was reading. Thank You. 🙂

    EDIT: I made it work!!! Yay! 😀

    But I had to write it like this:

    //include utility_h for the UT_AddItemToInventory() function.
    #include "utility_h"
    //include the custom made plot file
    #include "plt_pre100pt_find_wardens"
     
    void main()
    {
        // If plot flag is TRUE then item already given.
        // Otherwise add item to inventory.
        if ( WR_GetPlotFlag( PLT_PRE100PT_FIND_WARDENS, PRE_WARDENS_PLOT_ACTIVE ) == FALSE )
        {
            UT_AddItemToInventory(R"item1.uti"); 
            UT_AddItemToInventory(R"item2.uti");
            UT_AddItemToInventory(R"item3.uti");
            UT_AddItemToInventory(R"item4.uti");  
        //Set the plot flag to TRUE to indicate that the item was given.
            WR_SetPlotFlag( PLT_PRE100PT_FIND_WARDENS, PRE_WARDENS_PLOT_ACTIVE, TRUE );
        }
    }

    I realized that the PlotFlag must be on CAPS to work, and I had to find a plot and flag that could work.
    With a bit of trial and error (that’s how I teach myself HTML, CSS and Javascript most of the times. LOL), I manage to add some items into the player’s inventory.
    Now I hope that don’t conflit with anything else… :/

    Still don’t know why the Cailan plot didn’t work, tho… maybe one of those mementos mods confliting…

    Oh, and I used the PRCSCR. That was easy, it’s the almost the same as the ones I edited for DA2.

    Again, Many Thanks. I really aprecciated your help. 🙂

    Next step, learn how to give item accordingly with player class. I’ll get there… 😉

    • This reply was modified 1 month ago by Portucally Portucally.
    • This reply was modified 1 month ago by Portucally Portucally.
    • This reply was modified 1 month ago by Portucally Portucally.
    #1037
    Qwinn
    Qwinn
    Keymaster

    Oh cool, the PRCSCR stuff is the part I’m not familiar with, so we’ll get this down.

    You should not be setting those flags yourself. You want to pick a flag that the game will set early on *anyway*, and just check it before that set happens to do your thing. You want to let the game keep setting the flag whenever it wanted to – the timing on the sets of flags like that can be uber-critical. If you *can’t* find a flag being set at the point you need your thing to happen, then you have to create your own plot file, but I bet we can find a good existing one to base it off and avoid that.

    You definitely shouldn’t be setting that PLT_PRE100PT_FIND_WARDENS, PRE_WARDENS_PLOT_ACTIVE flag yourself. Pretty sure that triggers a bunch of plot events, and you’re probably *not* setting it at the point the rest of the quest needs it to.

    It IS odd that checking the codex entry didn’t work. It should have. Using that PRCSCR stuff, does your script run before or after the area script runs? I would’ve thought before, but if it’s after, that would explain why the check fails. Do any of those tutorials mention the order?

    Either way, even if we do get the codex entry flag check working, you shouldn’t be setting that yourself either – probably harmless to do so, but, still, bad form. You can GetPlotFlag all you want… SetPlotFlag with extreme care, unless you created the plot file yourself.

    • This reply was modified 1 month ago by Qwinn Qwinn.
    #1039
    Qwinn
    Qwinn
    Keymaster

    Here, check this flag instead:

    if ( WR_GetPlotFlag( WR_PREPT_GENERIC_ACTIONS, PRE_GA_END_CAILAN_CONVERSATION) == FALSE )

    That one can’t be TRUE when the area script first runs (and I assume your script is running *somewhere* around the same time), and it has to be TRUE the next time the area loads, because it gets set at the end of Cailan’s dialogue and is unavoidable. That should always be *after* your script runs, I would think. Don’t do SetPlotFlag on it – let the game do that itself at the end of Cailan’s conversation as it always did, it’s good enough for your purpose of making sure it only runs once.

    #1040
    Qwinn
    Qwinn
    Keymaster

    Next step, learn how to give item accordingly with player class. I’ll get there…

    Here’s the relevant portion from how I restored the Shaperate’s Blessing rewards. From my developer’s readme for fix IR1010:

    if (WR_GetPlotFlag( PLT_GEN00PT_CLASS_RACE_GEND, GEN_CLASS_MAGE))
       { UT_AddItemToInventory(R"gen_im_wep_mag_sta_shp.uti",1); }
    if (WR_GetPlotFlag( PLT_GEN00PT_CLASS_RACE_GEND, GEN_CLASS_ROGUE))
       { UT_AddItemToInventory(R"gen_im_wep_mel_mac_shp.uti",1); }
    if (WR_GetPlotFlag( PLT_GEN00PT_CLASS_RACE_GEND, GEN_CLASS_WARRIOR))
       { UT_AddItemToInventory(R"gen_im_wep_mel_gsw_shp.uti",1); }
    
    • This reply was modified 1 month ago by Qwinn Qwinn.
    • This reply was modified 1 month ago by Qwinn Qwinn.
    • This reply was modified 1 month ago by Qwinn Qwinn.
    #1044
    Portucally
    Portucally
    Participant

    That worked.

    I supose you meant:

    #include “plt_prept_generic_actions”
    #include “plt_gen00pt_class_race_gend”

    I couldn’t make it work with WR_PREPT_GENERIC_ACTIONS, but look into the scripts and found the one I quote and it worked.
    The solution you gave me for each class also perfect.

    It IS odd that checking the codex entry didn’t work. It should have. Using that PRCSCR stuff, does your script run before or after the area script runs? I would’ve thought before, but if it’s after, that would explain why the check fails. Do any of those tutorials mention the order?

    I have no idea. I never read anything about any order, just that we can use to select an event or location to add something into the game.
    I used in DA2 to give some rewards to my player when finishing some quests. So now I was interested in learning the scripting as DAO needs that more to make some things work.

    I have to learn more about how to create my own plot files as how you put it, I can’t rely always on vanilla plots as that might damage some things further into the game.

    There’s a lot to learn but its fun.

    About the codex entry not working as supossed to, I’m thinking that might have something else confliting with it. I had the Warden Recruit Mod installed, the one that gives the player a warden recruit armour at that same point and was erratic. Didn’t always worked for all Origins. Since I never liked that armour anyway, I uninstalled it and that was my motivation to learn how it could be done better and more stable.

    Now, I’m thinking about the possibilities to add some specific item for every Origin and class, maybe as a memento from a lost love or family…

    I don’t know… Right now, I’m just happy learning how to make things happen. 😀

    #1045
    Qwinn
    Qwinn
    Keymaster

    Er, sorry, yeah, dunno how that extraneous WR_ got in the variable name I posted, sorry. Glad you figured it out and got it working though!

    #1046
    Qwinn
    Qwinn
    Keymaster

    Actually, if you wouldn’t mind, could you post the final script you came up with? Something I wanna check.

    #1048
    Portucally
    Portucally
    Participant

    Sure. Here it is:

    //include utility_h for the UT_AddItemToInventory() function.
    #include "utility_h"
    //include the custom made plot file
    #include "plt_prept_generic_actions"
    #include "plt_gen00pt_class_race_gend"
    
    void main()
    {
        // If plot flag is TRUE then item already given.
        // Otherwise add item to inventory.
        if ( WR_GetPlotFlag( PLT_PREPT_GENERIC_ACTIONS, PRE_GA_END_CAILAN_CONVERSATION ) == FALSE )
        {
            if (WR_GetPlotFlag( PLT_GEN00PT_CLASS_RACE_GEND, GEN_CLASS_MAGE))
             { 
                UT_AddItemToInventory(R"mage_armor.uti",1);
                UT_AddItemToInventory(R"mage_boots.uti",1);
                UT_AddItemToInventory(R"mage_gloves.uti",1);
                UT_AddItemToInventory(R"mage_helm.uti",1);
             }
            if (WR_GetPlotFlag( PLT_GEN00PT_CLASS_RACE_GEND, GEN_CLASS_ROGUE))
             { 
                UT_AddItemToInventory(R"rogue_armor.uti",1);
                UT_AddItemToInventory(R"rogue_boots.uti",1);
                UT_AddItemToInventory(R"rogue_gloves.uti",1);
                UT_AddItemToInventory(R"rogue_helm.uti",1);
             }
            if (WR_GetPlotFlag( PLT_GEN00PT_CLASS_RACE_GEND, GEN_CLASS_WARRIOR))
             {   
                 UT_AddItemToInventory(R"warrior_armour.uti",1);
                 UT_AddItemToInventory(R"warrior_boots.uti",1);
                 UT_AddItemToInventory(R"warrior_gloves.uti",1);
                 UT_AddItemToInventory(R"warrior_helm.uti",1);
              }
            //Set the plot flag to TRUE to indicate that the item was given.
            WR_SetPlotFlag( PLT_PREPT_GENERIC_ACTIONS, PRE_GA_END_CAILAN_CONVERSATION, TRUE );
        }
    }

    and then I use the PRCSCR to make it work, that’s the easy part as I just need to set the AreaListName and the Script.

    I figured out that the #include plot part must be written in lowercase and the PlotFlag part need to be uppercase. Otherwise the script don’t compile.
    That is one thing I never read in any tutorial I found.

    Right now I’m want to use this script to give my hero a recruit armour of sorts until he goes through the Joining ritual. So far it looks like it’s working, I tested it with Rogue and Warrior but I assume the Mage will work too.

    If you think this script wont damage anything, I’m gonna keep using it for awhile…

    #1049
    Qwinn
    Qwinn
    Keymaster

    That all looks fine except for this (and it’s the reason I asked you to post it, since I was pretty sure I failed to get what I was trying to impart across):

    //Set the plot flag to TRUE to indicate that the item was given.
    WR_SetPlotFlag( PLT_PREPT_GENERIC_ACTIONS, PRE_GA_END_CAILAN_CONVERSATION, TRUE );

    You need to remove this altogether. You would do this if you were using a plot flag you created yourself for that very purpose, but here you are using an existing flag that has the virtue of being FALSE the first time you load the area, and TRUE every subsequent time. That’s all you need, and setting it yourself is both unnecessary and dangerous.

    Reread my previous posts about this, maybe it’ll make more sense now.

    In this case, you should let the end of Cailan’s conversation set the END_CAILAN_CONVERSATION flag. Your script runs every time you enter the Ostagar area, and your IF checks that that flag hasn’t been set yet. That can only be true the first time you enter Ostagar, because Cailan’s dialogue will always set it. That’s all you really need to make sure that your items are only added the one time, so you’re “borrowing” the flag for that purpose by checking it’s value, but you shouldn’t ever change when an existing flag gets set yourself.

    So earlier, when you said:

    I have to learn more about how to create my own plot files as how you put it, I can’t rely always on vanilla plots as that might damage some things further into the game.

    If you can find a flag that always gets set when you need it to be, such as this one that I provided you, there’s no harm in reading it and no possible damage you can do UNLESS you change its value by running WR_SetPlotFlag on it. Getting the value of a flag is always harmless. Setting the value of the flag is potentially very dangerous and should only be done to plot files you’ve created yourself, or if you are, well, fixing a bug.

    EDIT: An additional tidbit that may make this clearer:

    All plot flags are initially set to FALSE until something in game – a script or a dialogue, generally – sets it to TRUE, which is why the Cailan flag is FALSE the first time you enter Ostagar. Cailan’s dialogue always sets it to TRUE, and nothing would ever set it back to FALSE, so it serves your purpose.

    In terms of a regular programming language, think of a plot flag as the only kind of variable you can declare, and the only values it can have are TRUE and FALSE. WR_GetPlotFlag reads your variable (which is harmless), and WR_SetPlotFlag sets it to whichever of those two values you tell it to (potentially very dangerous, as other parts of the code may behave differently if you change the *timing* of when that flag gets set).

    Another potential danger of setting the flag yourself is that setting some flags will run a script that should only ever run once. With your code as it is, that flag will get set twice. What might a flag that gets set at the end of Cailan’s conversation actually do? It could move or remove Cailan and his guards from the area, initiate your subsequent conversation with Duncan where he tells you to go find Alistair, set some other plot critical flags that *themselves* run scripts that should only run once, lots of stuff. If that flag did those things, and your script set it when you first entered the area, Cailan could be prematurely removed (and you might even wind up talking to a disembodied Cailan), or Duncan’s post-Cailan conversation could start immediately, rather than the Cailan dialogue. Make sense?

    • This reply was modified 1 month ago by Qwinn Qwinn.
    • This reply was modified 1 month ago by Qwinn Qwinn.
    • This reply was modified 1 month ago by Qwinn Qwinn.
    #1053
    Qwinn
    Qwinn
    Keymaster

    Oh, and by the way…

    I figured out that the #include plot part must be written in lowercase and the PlotFlag part need to be uppercase. Otherwise the script don’t compile.
    That is one thing I never read in any tutorial I found.

    DA:O’s scripting language is C++, which is *very* case sensitive.

    • This reply was modified 1 month ago by Qwinn Qwinn.
Viewing 15 posts - 1 through 15 (of 16 total)

You must be logged in to reply to this topic.