Jump to content

How to Create Gift Items that Become Usable/Wearable


Recommended Posts

Hi everybody! I've currently more or less mastered creating custom items in the Toolset and am working my way up to more advanced things, but there is something that I have been unable to find in the wiki: How to create a gift item that becomes a "real" item in the game (e.g., Duncan's shield; Antivan leather boots) that a companion can use/wear. Also how does one create an item for a companion that appears under specific conditions? For instance, when a certain level of approval/stage in romance is reached? Does anyone have any info on how to do this or know of any good tutorials that cover this? Also, would the script for this that is entered be the same as the one in the wiki's custom item tutorial, or does it require different commands? Thanks to anyone who can help!

 

 

Best regards,

 

FIREFLY11

Link to comment
Share on other sites

Firstly, as far as turning 'virtual' gifts into usable/equippable items, have you looked at how the vanilla game handles gift items like Duncan's Shield or Zev's boots?

 

Second, not sure if it's the BEST way, but the method/script I always used for giving items at milestones was a modified version of weriKK's Custom Item tutorial, from old!BSN... though depending on what your needs are it may not be useful.

 

example (the script from my A Ring from Alistair mod):

 

 

 

// ---- SCRIPT STARTS HERE ----

// Later on in this script, we will use the UT_AddItemToInventory()
// function to add an item to the player's inventory.
// But before we could use it, we have to tell the toolset where
// to look for it. The function is in the "utility_h" script file
// under _Core Includes, we will include this file at the top of
// our script file, above the main function.

#include "utility_h"
#include "plt_tsm_alistair_plot"
#include "plt_denpt_alistair"
#include "plt_genpt_alistair_defined"
void main()
{
// If our plot flag is set to TRUE, that means we have already
// given the items to the player, there is no need to continue
// running this script.
if (WR_GetPlotFlag( PLT_TSM_ALISTAIR_PLOT, TSM_ITEM_CHECK_FLAG ) == TRUE )
return;

// Alistair and the Warden are engaged, so continue to give ring
if( WR_GetPlotFlag(PLT_DPT_ALISTAIR, DEN_ALISTAIR_MARRYING_PLAYER)
== FALSE )
return;

// Alistair is or has been romanced, so continue to give ring
if( WR_GetPlotFlag( PLT_GENPT_ALISTAIR_DEFINED, ALISTAIR_DEFINED_ROMANCE_ACTIVE_OR_STILL_IN_LOVE )
== FALSE )
return;

event ev = GetCurrentEvent();
int nEventType = GetEventType(ev);

// We will watch for every event type and if the one we need
// appears we will handle it as a special case. We will ignore the rest
// of the events
switch ( nEventType )
{
// This event happenes every time the module loads
// This usually happenes when creating a new game
// or loading a savegame
case EVENT_TYPE_MODULE_LOAD:
{
// The UT_AddItemToInventory function adds various resources to a
// creature's inventory. Here we add Alistair's ring.
UT_AddItemToInventory(R"tsm_alistairs_ring.uti", 1);


// Set our plot flag to TRUE, so the next time this script tries
// to run it will not add extra items to the player's inventory
WR_SetPlotFlag( PLT_TSM_ALISTAIR_PLOT, TSM_ITEM_CHECK_FLAG, TRUE );

// We have dealt with the event we were waiting for.
// At this point we can stop looking for other events
break;
}
default:
break;
}
}
// ---- SCRIPT ENDS HERE ----

 

 

 

If you compared that to weriKK's, you see they are very similar. I also used the same template for several other released mods (i.e., The Kings Shield, & A Stylish Uniform) and a number of personal, unreleased projects... if you pull apart the mods and extract the files from the ERFs, the uncompiled *.nss files should be included; you can open them in a txt reader like Notepad. (If they aren't in the archives, I can probably track down my text files and post them.)

 

And I should also note that I believe I also looked for guidance at the scripts used by rak72 for her milestone-triggered companion items... credit where credit is due! and that would be another modder's similar work at which you could look.

 

The downside to the method I used is that the item is not added to inventory immediately, but rather it shows up on first load after the specified conditions have been met.

Edited by theskymoves
Link to comment
Share on other sites

Hey Sky, thanks for the info as always (esp. for the Ring from Alistair example)! At the risk of being laughed at by all those reading this (I'm still a lowly newbie to modding for those wondering!), when you say look at the way the vanilla game handles the gift items like Duncan's shield & Zev's boots do you mean look at those items in the Toolset? As an experiment I tried using the Antivan boots gift model with the standard custom item creation method, but gave them my own description, name & stats. The specs I installed appeared in the game when the gift item showed up in my inventory; the usual cutscene played when I gave them to Zev, but after they were equipped on him everything reverted back to the Antivan boots, so I guess I can't make an equippable gift item that way.

 

So far, I've been using the console commands and the method laid out in the Toolset wiki to get the items I've made into the game. Can I still use it with the method you outlined? If it's not too much trouble, yeah, it would be great if you could chase down those text files you mentioned for the other released mods. I'll definitely check out rak72's work as well. Thanks so much for the help again. On another note, I've begun learning how to create new areas with the wiki, but one of the things I've noticed about it is that it will tell you how to make things, but not give scripting advice on how to get them into the game. Do you think it would be worthwhile to learn some C++ since that language is similar to the one DA uses? Anyway, many thanks again & sorry if this sounds a little off right now--it's late & the brain is about to go down for the night! :tongue:

 

Best always,

 

FIREFLY11

Link to comment
Share on other sites

Firstly, I apologize for the delay in replying; we were without electricity for three days this week after a freak windstorm took down a tree and some power lines.

 

Secondly, I'm confused as to what your 'end goal' is... do you want to add a completely new companion gift that becomes an equippable/use able item? Or just change the stats on one that already exists in-game? :confused:

 

If the former, then yes, I suggest tracking down the various files used by the game to implement those gifts and look at the scripts and dialogue: off the top of my head, at the bare minimum it should be two UTI files (one for the 'Gift' placeholder, and another for the wearable item), a dialogue exchange triggered by giving the gift, and a script that adds the wearable item after the dialogue. Oh and probably some plot flags.)

 

On the other hand, if all you want to do is change something about an existing item, then all you need to do is make your edits to the usable/equippable version and export that UTI without changing the file name... editing the 'Gift' item will not affect the second, equippable item. (I.e, don't edit the initial 'gen_im_gift_antivan_boots' version. Instead, make your edits to 'gen_im_arm_bot_lgt_ant', which is the item that can actually be equipped.)

 

Finally, you can certainly use the console to spawn items, even if you have an 'automatic' plot-driven spawn method... most of my mods include both scripts, in fact.

 

I just checked and all the NSS files are included in The King's Shield and A Stylish Uniform mods.

 

I've never done any work with area creation for DAO... that's far beyond the capabilities of this stupid old woman. And since my scripting needs were always pretty basic, I've never scripted anything from scratch, so no idea on whether learning C++ would be useful. :ermm:

Link to comment
Share on other sites

if your goal is to create a useable gift for an existing follower, i don't *think* it will be too difficult to do, but...In my opinion, working with the approval system is the hardest and most confusing part of creating a new follower, especially if you want something special to happen when you give it them. if this is for a vanilla follower, I suggest you take a look at the sp_module_item_acq script and look specifically at the EVENT_TYPE_MODULE_HANDLE_GIFT parts. don't edit the actual script. instead, in your own module script add:

case EVENT_TYPE_MODULE_HANDLE_GIFT:
{
     whatever your want your special functions to be;
     break;
}

Still, I recommend working a little more with easier scripts (like prcscr scripts) until you feel more comfortable with scripting. messing with gifts can be a pain in the butt.

Link to comment
Share on other sites

Hi guys, thanks a lot for the info! Sky, don't worry about the delayed reply--unfortunately, I'm about to share your experience of going w/o power for several days in the near future because my evil power company is going to be shutting off the juice to my city & several others claiming high fire risk (even though we're not in the zone! :wallbash:). For clarification, my end goal is to create a completely new gift item that would be equippable once given (something for Alistair; haven't decided what yet). I'd also like to eventually create a mod where Alistair surprises the Warden with a picture of her family/parents that he bought from a merchant along their travels, seeing how it would be likely that Howe's thugs would have looted Highever Castle, but first things first!

 

Even with you guys being good enough to point me in the right direction, I'm REALLY going to have to read some tutorials on scripting, as I sadly have no background of any kind in that area. I found a great PDF file when I was Googling the Toolset & from what I've seen, it has lots of useful info on scripting, so hopefully that will help. Just need to find the time to learn everything. I also reached out to Rak72. She said she hasn't done anything for a while but offered to walk me through some things if she can. And I'll definitely start familiarizing myself w/ prcscr, but at least I understand the explanation regarding the Antivan boots example. As for the area creation, the Toolset seems pretty straightforward from what I've learned so far; again I seem to do fine learning how to create things--it's the scripting where I need work. Thanks so much again for the help & try to stay cool wherever you guys are! I'll keep you posted on how things turn out.

 

Best always,

 

FIREFLY11

Link to comment
Share on other sites

  • 4 weeks later...

Piggybacking on the conversation!

 

From what I understand, if I go and make changes to items I've created, all I need to do it re-export?

 

In more details: I created some items following the article on Fextralife (https://fextralife.com/forums/t264474/custom-player-items-in-single-player/), which at the end has us Export Without Dependent Resources, then Generate Module XLM, and Generate Manifest XLM.

 

If I go back into my module and either edit items I had created, or make new one and add them to the script, do I need to re-export / gen module / gen manifest? Or do I simply need to save?

 

(Also, will it still remember if it gave me the item?)

 

I could, of course, simply create a whole new module to host new items, but I like to keep things tidy, if I can have them all into the one Custom Items module :teehee:

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...