Aller au contenu

Photo

Why do my modded items crash the game in transitions?


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

#1
rdr99

rdr99
  • Members
  • 32 messages
Ok... I admit I'm no pro at modding with the toolset.  I have managed, by following various tutorials, to create some new weapons and armor using standard items in Dragon Age Origins from the toolset.  I am merely adding properties and such, not changing textures and so on.  I wrote a script which puts the stuff in the game into my inventory.  My items showed up in the game, and I can use them from almost the beginning, through Ostagar, and on into Lothering until I get to the tavern there.  I can enter the tavern, kill Logain's minions there, trade with the merchant in the tavern and get his quest for poison and so on.   Then things go badly!  I cannot leave the tavern without crashing the game.  If I remove my items from myself and my companions (I spawn several of each item and give them to various of my companions as well), then I can leave the tavern... though I am naked and so are some of my companions.  Once outside I can re-equip my items and proceed, even doing battle and so on.  If I try to enter the Chantry in Lothering, the same thing occurs.  I must un-equip all items created from myself and my companions to enter the building (go through a transition) whereupon I can complete a quest, ask the Rev. Mother to free Sten etc.  I can then leave, re-equip, kill the darkspawn on the road out of town, talk to Bohden and so on, only to crash again when transitioning to the next scene, which would be the first party camp I believe.

My question is WHY IS THIS HAPPENING?  I played though several levels previous to Lothering with no problem, and indeed had equipped myself and Alaister and even Morrigan with some of my items... but then WHAM!  NO JOY once I enter the tavern at Lothering and get Lilliana in the party instead of the hound.  What gives?  True... they are relatively powerful items... but still, I have played the game through perhaps 8-9 timese before, and a couple of those times with "God Items" developed by someone else and they didnt crash the game.  So it's not that.  What makes Lothering so touchy and why was I able to use everything before that?  What can I do to fix this... I really like my items.  Please give me some hints.

I am using Vista64, the 1.01 release of the toolset, and have vers. 1.03 of the game from Steam.  The folder is the main folder (\\).  The items are created in the "core game resources" module using my module name as the "owner", and the script as my script name as the "Script" and the extended Module as "Single Player" as the most recent tutorials I could find suggest.  If any other information is needed that I can provide I would certainly do so to help me solve this vexing problem.  Oh... and I played Awakening once but my items never did show up in there... so I dont understand that either... but then... a lot of things dont show up in Awakening, and in fact I got robbed of the armor I did have in the Silverite mine, never to see it again, though my companions regained their stuff.  But I digress... Please tell me what is happening in Origins and I will deal with Awakening later!
:blush:

Modifié par rdr99, 18 mai 2010 - 11:29 .


#2
tmp7704

tmp7704
  • Members
  • 11 156 messages
edit: on second thought nvm. If you're just adding extra properties to existing templates then this likely doesn't apply.

Modifié par tmp7704, 18 mai 2010 - 02:12 .


#3
rdr99

rdr99
  • Members
  • 32 messages
Since no one has answered yet, I thought I would include the script I am using to see if it rings a bell for anyone...

// 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();
            int iItemCount = CountItemsByTag(oPlayer,"rdr_trigger_ring_01");
            if(iItemCount ==  1)
            break;

            object oTrigger = GetObjectByTag("rdr_trigger_ring_01");
            if(!IsObjectValid(oTrigger))
                UT_AddItemToInventory(R"rdr_amulet_01.uti",4);
                UT_AddItemToInventory(R"rdr_armor_01.uti",2);
                UT_AddItemToInventory(R"rdr_belt_01.uti",4);
                UT_AddItemToInventory(R"rdr_boots_01.uti",2);
                UT_AddItemToInventory(R"rdr_bow_01.uti",2);
                UT_AddItemToInventory(R"rdr_gloves_01.uti",2);
                UT_AddItemToInventory(R"rdr_helm_01.uti",2);
                UT_AddItemToInventory(R"rdr_magestaff_01.uti",2);
                UT_AddItemToInventory(R"rdr_ring_01.uti",4);
                UT_AddItemToInventory(R"rdr_ring_02.uti",4);
                UT_AddItemToInventory(R"rdr_sword_01.uti",2);
                UT_AddItemToInventory(R"rdr_sword_02.uti",2);
                UT_AddItemToInventory(R"rdr_trigger_ring_01.uti",1);

            //object oAttribbook = GetObjectByTag("cdon_book_attrib");
            //if(!IsObjectValid(oAttribbook))
            //UT_AddItemToInventory(R"cdon_book_attrib.uti",99);

            //object oSkillbook = GetObjectByTag("cdon_book_skill");
            //if(!IsObjectValid(oSkillbook))
                //UT_AddItemToInventory(R"cdon_book_skill.uti",99);

            //object oTalentmbook = GetObjectByTag("cdon_book_talentm");
            //if(!IsObjectValid(oTalentmbook))
                //UT_AddItemToInventory(R"cdon_book_talentm.uti",99);

            //object oTalentwbook = GetObjectByTag("cdon_book_talentw");
            //if(!IsObjectValid(oTalentwbook))
                //UT_AddItemToInventory(R"cdon_book_talentw.uti",99);
            break;
        }
        default:
        {
            break;
        }
    }
}

The commented items have never been used as I commented them out before the script was run in the game, but thought I might try to add them later if everything else was working.  One thing at a time and all that!
Hopefully someone will find a glaring error and say...  "Oh yeah... just do this and you're good to go!"
Anyone???

:blink:

#4
nezroy

nezroy
  • Members
  • 99 messages
Nothing looks particularly wrong. As general things I would drop Log_Events, unless you're explicitly using logs, and then simplify your initial check down to:

{
object oTrigger = GetObjectByTag("rdr_trigger_ring_01");
if (IsObjectValid(oTrigger)) return;

UT_AddItem... etc.


Also, I always just use CreateItemOnObject directly, at which point you'd be able to get rid of #utility_h. Also you should be able to get rid of #wrappers_h, since you aren't using anything from that in this code.

Modifié par nezroy, 19 mai 2010 - 02:12 .


#5
rdr99

rdr99
  • Members
  • 32 messages
Hi Nezroy... Thanks for your observations. I have some questions though because I am a newbie to using the toolset.



I simply use the "Log_Events", and "#wrappers_h" code only because others did and not knowing better I kept it in rather than leave it out and perhaps not have things work. From what you are saying though, it seems even with my code as written I would only need the #events_h and #utility_h parts. Good to know!



You seem to have dropped the player object which I can see may not be necessary given the use of the tag coding... I understand that. I am not familiar with using "return" after if(isObjectValid(oTrigger)) return; instead of using a positive item count and "break" to stop the script from loading more stuff if the ring is present. If you could explain that a little it would be appreciated.



Also, you mention CreateItemOnObject... does that put an item directly on a character instead of in the inventory? Sorry if this seems like a trivial question, but I am unfamiliar with that code statement and have never seen it before or had it explained to me. As you can tell... I am NOT a "C" programmer... I'm just winging it here!



Again... thanks for your comments and taking the time to give my little script a look over.

#6
nezroy

nezroy
  • Members
  • 99 messages
Hey.. sorry so slow to answer, was out of town for a while...

CreateItemOnObject is a more direct function that UT_AddItemToInventory wraps. There's nothing wrong with using UT_AddItemToInventory, I just don't typically because it's one more include file you have to use (utility_h) that you might not have to use otherwise, plus UT_AddItem is one of the least necessary wrappers in existence as it simplifies almost nothing :) Generally when troubleshooting this kind of stuff, it's helpful to be able to
remove everything you don't absolutely need to rule out potential issues.

In your case the CreateItemOnObject lines would look like this, which you can see isn't really any more complex:

CreateItemOnObject(R"rdr_amulet_01.uti", GetHero(), 4);

(or just leave in the object oPlayer = GetHero() line and then use oPlayer for the 2nd argument)

As for return vs. break: "return" exits the function entirely, while "break" just ends that case statement and leaves the switch block. In your specific code it doesn't matter because you don't have anything happening after the switch block anyway. I didn't actually change it on purpose, I just wrote it that way out of habit because whenever I have a "should I do anything?" type of check I almost always just exit the function if the answer is "no". The scripting overview is a good resource to check out if you have not already looked at it.

As for the change to the checks in general, I'm simply attempting to get the trigger ring object. If the object is valid then we know at least one trigger ring exists somewhere nearby, so we exit the function (do nothing). If it's not valid then we attempt to spawn the items. Because you were already doing this anyway (more or less), there isn't much point in ALSO counting the number of trigger rings on the player explicitly. If there is at least one trigger ring on the player, then when we get the object by tag it will be valid and we'll just exit the function.

However, you usually want to use plot flags to control spawning stuff like that. And in fact with the changes in v1.03 and the issues surrounding spawning stuff on player inventory (e.g. dwarf origins), it's actually much more preferable (in my opinion) to stick custom items on Bodahn so you can buy them at the party camp (or Yuriah for Awakening) via PRCSCR. And I believe it's also simpler/easier to get that working than trying to get a MODULE_LOAD thing working

For troubleshooting it is also helpful to have a script that spawns your items in response to a runscript call instead of trying to spawn stuff directly on player load. This is good for troubleshooting because you can also put in all kinds of debug functions, etc. It's also good if you ever plan to release the mod, since it becomes a fall-back option in case your Bodahn/Yuriah spawning code ever fails for some reason. In that case people can still just use the console to get your items as a last resort.

Modifié par nezroy, 27 mai 2010 - 03:27 .


#7
nezroy

nezroy
  • Members
  • 99 messages
While I'm thinking of it I went ahead and added a PCRSCR script template for adding items to the existing merchants (Bodahn or Yuriah).

#8
rdr99

rdr99
  • Members
  • 32 messages
Hi Nezroy... good to hear from you and thanks for your response! Here's the thing... I deliberately did NOT use a plot flag because of two reasons. One, in the previous version of the toolset plot flags were supposedly broken and I did not trust them. Two, I wanted a way to load stuff into the game MORE THAN ONCE if necessary. True, I could have merely given myself one of everything each time, but since several "characters" would use some stuff and not others and I knew from previous play through experience who those would be, I did it this way (Cue Frank Sinatra singing "My Way"!). And 2a, I didn't know how to make a plot flag "false" again even if after the 1.01 vers. of the toolset was released the plot flags worked as per specification (which they seemingly now so do) so I could re-load stuff if I wanted to.



As to having vendors sell me the stuff instead, although it LOOKS like a good idea, have you seen the prices my stuff brings??? Sheesh! Even if I create the item and tell the toolset it should cost like, 100, (that is one silver if I'm not terribly mistaken), when I equip the item and look at what a vendor will pay me for it (and they are only giving me 1/4 of its actual worth) I am sure that I could wander the length and breadth of Ferelden and never accumulate that much cash. So no... buying is out!



However, now that you have explained the changes you made to the coding I can see how the use of "return" and: CreateItemOnObject(R"rdr_amulet_01.uti", GetHero(), 4); could be a good thing to do. Using these hints of yours I will try to write another script which I will use to try to add to the Awakening extension... But there's the rub!



Using an editor and copying and pasting the data in the "manifest.xml" file and then editing the second "Additem UID" line to:

<AddInItem UID="rdr_stuff_01" Name="rdr stuff 01" ExtendedModuleUID="DAO_PRC_EP_1" Priority="100" Enabled="1" State="2" Format="1"> instead of the usual "Single Player" reference used for Origins gets me nothing in Awakening. Zip... ziltch... nada! Well... I take that back... it gets me the trigger ring back, but none of my actual "go smite the bad guys" items. Regrettable! So now I am looking for an "absolutely, positively, will never fail even if the Archdemon shows up" way to put stuff into Awakening without corrupting the core game. In other words... I want to put it in the extended module, not the core module. If you have a sure fire suggestion for that I'm all ears and I promise to use CreateItemOnObject and "return" too... cross my heart!



I will now grumble about the first time I entered the Silverite mine and did not do a "major" save but merely a quick save only to discover that the game did a save as soon as I had been left naked upon entering the blasted place and I had to fight my out, recovering my COMPANIONS stuff, but never my own, and leaving there wearing rather tattered gear which I would otherwise not be caught dead in (but nearly WAS dead in!) only to further discover you could never re-enter the mine! What's up with that? Had I the time to tie to a chair the developer who designed THAT particular gem, I would have a brief but somewhat violent discussion about the negatives foisted on me in the mine. And then... then finding out I could NOT reload my lovely items... well... I quit playing for a while after that. My brain still hurts when I think about it. So please... if you have a sure fire way for someone like me to make a script that will load stuff into Awakening with no drama and very little XML editing I'm all for it. P.S. I do not own Excel... I do own Wordperfect Office but it seems to want to make all the columns kinda narrow and I don't EVEN know what to do next when that happens. I await without...



And thanks again for the help Nezroy. You're a trooper!

#9
nezroy

nezroy
  • Members
  • 99 messages

Using an editor and copying and pasting the data in the "manifest.xml" file and then editing the second "Additem UID" line to:
instead of the usual "Single Player" reference used for Origins gets me nothing in Awakening. Zip... ziltch... nada! Well... I take that back... it gets me the trigger ring back, but none of my actual "go smite the bad guys" items. Regrettable! So now I am looking for an "absolutely, positively, will never fail even if the Archdemon shows up" way to put stuff into Awakening without corrupting the core game. In other words... I want to put it in the extended module, not the core module. If you have a sure fire suggestion for that I'm all ears and I promise to use CreateItemOnObject and "return" too... cross my heart!


The best guaranteed way to get stuff in game w/o any problems, multiple times, for multiple characters, etc. is to write a simple script that just gives you the items directly to inventory, and then execute the script via the console using the "runscript" command. It's not particularly clean if you want to deploy the mod, but if it's just for your own purposes it is bar-none the most fail-safe method. 

For instance, create a script called "yourmod_gimme.nss" that looks something like:

void main() {
  object oPlayer = GetHero();
  DisplayFloatyMessage(oPlayer, "give me stuff", FLOATY_MESSAGE, 1677215, 5.0);
  CreateItemOnObject(R"item.uti", oPlayer);
}

In-game use the developer console (~) and enter "runscript yourmod_gimme". This will execute the above script which just directly adds stuff to your inventory (and prints a floaty message above your head so you know it ran correctly).

This should work fine for both Origins and Awakening, though you will still need to do the XML edit for the Awakening version. The only way to avoid that XML edit is to make a module that extends core game resources instead of single player, but that's more complicated to setup.

Course, none of this really addresses the issues with your game crashing during loads. But I was just guessing that it might be the custom module event code that was causing problems which is why I started down this whole road :)

I will now grumble about the first time I entered the Silverite mine and did not do a "major" save but merely a quick save only to discover that the game did a save as soon as I had been left naked upon entering the blasted place and I had to fight my out, recovering my COMPANIONS stuff, but never my own


Yeah a lot of custom items cause the default code for that to break.
Spoiler
, but most custom items cause that to break and your items just disappear. For future reference, the "fix" is to unequip all of your stuff to inventory first (so go into the mine naked). Anything that is not equipped will just be moved to a storage chest
Spoiler
, so custom items don't break that.
Spoiler


#10
rdr99

rdr99
  • Members
  • 32 messages
Hi again Nezroy...

Uhm... yeah, I figured that out about entering the Silverite mine without my stuff on after the first time. Now I do a full save from the menu, put on junk armor and go in the mine. I could go naked I suppose if I didnt have any junk armor in my inventory... and I suppose it would be good to make the whole party naked (Party... NAKED?? sounds kinda festive!) and they wouldnt have to fight those clowns with the good armor on. Might be a plan! My party members who were wearing the "Amy Outfits", which take the properties from whatever armor they have on and put the women in cute little dresses, worked fine in the mine and everywhere else for that matter. Heck, I might just spawn one set of armor from now on and change the women into it and then spawn the Amy set, take back mine and presto... more good armor. It only works for female party members though... you cant put guys in dresses (not that I would want to anyway!). Wish I could see what scripting HE was using to do all that.



About the console thing. I have the Steam version of the game. For some reason I can't see anything when I type in stuff in the console, and have never been able to make any codes work from there. I read somewhere that there are "fonts" you can add that make typing visible, but the place I saw that escapes me now. However, there is still this... I am NOT changing a DAZIP file by editing the manifest.xml. I was trying to do it to the manifest.xml file that the toolset puts into the addin folder and that didn't seem to work for me. I did read your explanation in another forum on how to do this, but neglected the part about editing a dazip file. I would probably not have the proper tool to extract and edit it anyway. I could not seem to find a tool in my poor arsenal to actually look inside the dazip file before extraction, nor find it after extraction... sigh! I still say Bioware owes us a toolset update to be able to add stuff to Awakening directly like the Single Player module. But I guess enough people aren't complaining about it yet. I created a bunch of new stuff last night and this evening and I'm about to use some of your code ideas to write a new script and start a new game with the stuff. My old stuff DID work and did load but I think one helmet didn't get created correctly or something, because if someone was wearing that second helm things went wrong in transitions. Without that it seemed to work. But, I had more ideas for putting different properties on different stuff anyway so I made new ones and will try the scripting when I'm done here. If I can find a way to make the console work in the Steam version and actually see what I am typing then I will try that too, but there is still the matter of editing the manifest.xml which I did before with no joy. Any more suggestions along that line would be appreciated. I did look at the things you linked and saw Angel's method. I don't know what she was editing (dazip or the toolset manifest file??) or what tools she used to do it... but it seems like that could work if I had a bit more knowledge and the tools.



Thanks again for bearing with me and helping me so much. I wish I had the ability to help you somehow as well. And now... back to coding... I hope it works!

#11
nezroy

nezroy
  • Members
  • 99 messages
To get the font for the console to be able to see what you type, just grab this mod from DA Nexus; has the font and instructions for where to install it: Make CONSOLE commands visible mod. I use the Steam version as well with that and it works great.

The .DAZIP file is actually just a .ZIP file. If you rename it to .ZIP then you can use any zip tool to get the XML manifest out of it (windows built-in or something like 7-zip). I can't actually say why that wouldn't have worked if you already tried the XML edit though... I've never actually changed a mod to extend Awakening, my item mods all just extend core game. There are a lot of places it could go wrong though which is why it's so helpful to be able to use the console for debug stuff. It could be the XML edit was incorrect and the mod wasn't being loaded into Awakening at all. Or it could be changes related to the v1.03 stuff that seem to randomly break people's MODULE_LOAD init scripts for putting items in inventory. Or it could be that the items aren't in the right module scope and just aren't being recognized as valid items for Awakening.

#12
rdr99

rdr99
  • Members
  • 32 messages
Good to hear from you again Nesroy...

I was about to go to bed but thought I would post the new script and perhaps you could tell me why it isn't loading. As you can see I tried to use some of your suggestions, but perhaps I missed something... Here it is:



// 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:

{



object oTrigger = GetObjectByTag("rdr_mighttrigger_01");

if(IsObjectValid(oTrigger))return;



CreateItemOnObject(R"rdr_robe_02.uti",GetHero(),2);

CreateItemOnObject(R"rdr_magestaff_02.uti",GetHero(),2);

CreateItemOnObject(R"rdr_amulet_02.uti",GetHero(),4);

CreateItemOnObject(R"rdr_mightring_01.uti",GetHero(),4);

CreateItemOnObject(R"rdr_mightring_02.uti",GetHero(),4);

CreateItemOnObject(R"rdr_mightbelt_01.uti",GetHero(),4);

CreateItemOnObject(R"rdr_mightbow_01.uti",GetHero(),2);

CreateItemOnObject(R"rdr_mushmace_01.uti",GetHero(),2);

CreateItemOnObject(R"rdr_shankshiv_01.uti",GetHero(),2);

CreateItemOnObject(R"rdr_mightarmor_01.uti",GetHero(),2);

CreateItemOnObject(R"rdr_mightboots_01.uti",GetHero(),2);

CreateItemOnObject(R"rdr_mightgloves_01.uti",GetHero(),2);

CreateItemOnObject(R"rdr_mighttrigger_01.uti",GetHero(),1);



break;

}

default:

{

break;

}

}

}

#13
rdr99

rdr99
  • Members
  • 32 messages
And oh... I did download the fonts to but forgot to try them out because I've been up all night writing a new module and getting my character into Lothering to see if stuff would load then... but noooooo!
I had one other problem that may be getting in the way.  The first time I exported the script I forgot to change the "Script" catagory in the module manager to the script I had just written and the default is "core game resources" instead I believe.  When it didn't run I looked things over and changed it to the name of my script and re-exported it creating a new module xml and manifest xml.  However, I dont know where to look to remove the older manifest xml and module xml from the game.  Is that getting in the way?  Is that why it won't run?  Should I start over and write a new module?  Can I still use my items I created and somehow transfer them to the new module?  How?  They are supposedly core items but you can only view them if you select the module they are currently attached to.  This is very confusing, but I mean to put it right.
So now here's my problem... if I do change the code what the heck do I have to do to make sure it all wipes out the OLD code and gets a fresh try. You can't really delete a module and last time I tried to change some code it never seemed to make any difference to the game... that is it still loaded the old items instead of the new ones. So about that I am at a loss. I will try you suggestions about the console as well, when I solve this other mystery of why the new script is not loading stuff. I guess I have to write another script to make the console thing work anyway... and I will try what you suggested about changing a dazip to a zip and poking around that way. What editor would you use for that? I use a thing called Ultra Edit which even has an xml code reader and editor in it... but if there is a better tool I would try it. Notepad also seems to work to change the text passages.

Modifié par rdr99, 30 mai 2010 - 05:52 .


#14
rdr99

rdr99
  • Members
  • 32 messages
One more thing... I got the console to work in that I can now see what I am typing. So now I have a few more questions. 1) You say create a script that runs from the console. I tried to look that up to no avail. Do you make a new module for that? Where do you put it... Using the module manager how do you add it to the game... for instance is the extended module still "single player" and so on... like making a standard script? You must have to add it to the game somewhere? Remember, you are talking to a complete dunce as far as this goes.

The toolset seems always to make both an .nss and .ncs file in the same directory as the manifest.xml file is in.  Is it possible to just call that with the console?

Modifié par rdr99, 30 mai 2010 - 06:43 .


#15
nezroy

nezroy
  • Members
  • 99 messages
Each time you export items, scripts, manifest/module XML, etc., it overwrites the previously exported stuff in your module directory. All exported resources for your module will be under {my docs}/BioWare/Dragon Age/AddIns/{mod} in various toolsetexport child directories. I'll just be calling that the mod directory from now on.

You shouldn't ever have to create a new mod or port stuff over, etc. You can always go to "tools -> export -> empty export directories" to clean up everything that has been exported for your mod from the toolset, and then re-export all your custom items, scripts, module/manifest XML, talk tables, etc. You might do this if you deleted/renamed some items/scripts, for instance, since deleting them from the toolset does not actually remove the exported file on disk. (Or alternatively you could just go into your mod directory and remove the specific files you deleted).

However one thing to keep an eye out for is when you export custom scripts or export your talk tables. In those cases the toolset also exports a bunch of other core game stuff that it shouldn't. This stuff gets exported to {my docs}/BioWare/Dragon Age/packages/core/override/toolsetexport. You want to make sure to clear everything out of that location as the core game resources that the toolset exports can be out of date and can break the game. Usually you won't notice during testing, but it's a good habit to just clear that out every time or else you might forget. Nothing for your custom mod ever gets exported there, and no installed mods should ever put anything there, so it's safe to just delete everything in that directory.

Make sure that you are compiling and exporting your custom scripts. The .nss is the script source, and it gets compiled into the .ncs which is what the game will run. Both of these will export to the mod directory, though really only the .ncs is necessary and I don't know why it exports the .nss too. As with items, etc., "export without dependent resources" is usually the option you want.

You can have many scripts in a single module and they can have any name you want. If you have a script named rdr_mod_script1 (.nss/.ncs), then to execute that from the console you would do "runscript rdr_mod_script1". A script that you expect to run from the console would not have any of the event stuff... it would basically just be "void main() {" followed directly by all the "CreateItemOnOjbect" lines.

A module can have only one module event script. This is the script that is written to handle the events that are sent to your module (such as the MODULE_LOAD_EVENT), and that is the script you set in the "manage modules->properties->script" setting. But it's typical to have other scripts that do other things; PCRSCR scripts, console scripts, event override scripts, scripts attached to objects/people/plots, etc. These are all configured/called from different places. If you don't need to manage any module events, then you would set the "manage modules->properties->script" setting to "(None)".

To create scripts in the toolset you just use the palette window on the right hand side, right-click on blank space, and select "new -> script". For the resource name enter the new script name (e.g. rdr_mod_fancyscript). For the folder I suggest using your mod uid (e.g. rdr_mod). The folder is where the script will show up when you are using the toolset palette window to help keep things organized. It doesn't actually affect any on-disk location. If you use the same unique top-level folder for ALL of your assets (items, scripts, plots, etc.), then all of your custom stuff will be visible when you click on the "ALL" filter on the palette window and select your folder. This is handy for keeping your stuff easy to find as well as being able to export that entire folder all at once (and you can always use sub-folders to keep things further organized if you have an extremely complex mod).

For the typical single player module, scripts and just about everything except custom items will have a "module" and "owner module" that are both set to your custom mod. Custom items are typically the only thing that might get a "module" of "core game resources" instead (though always the "owner module" is your mod) -- however even with a "module" of your custom mod they will still work and the difference gets rather technical. This is the common setup that works for extending single player (and extending Awakening with the XML edit).

Your specific event handling scripts looks OK. If you attached it to "manage modules -> properties -> script", re-exported your manifest/module XML, and are exporting the custom script, then it SHOULD be working from what I can see. However there are all sorts of oddities that pop up in v1.3 with item scripts that attempt to do stuff with MODULE_LOAD_EVENT. There are a lot of theories as to what's going on there but I'm not going to speculate on that just yet. The first step is to try and get a console script working that gives you all the items direct to inventory so that you can at least verify that the items do work in-game properly, etc.

Modifié par nezroy, 01 juin 2010 - 03:54 .


#16
rdr99

rdr99
  • Members
  • 32 messages
Hi again Nezroy...

I did make some progress since last we "spoke" (if writing can be thought of as speaking!). I did manage to get two different mods running of mine using code similar to the one waaaayyyy up there at the beginning of this string. I also managed to make some changes and re-export those to the various mods without difficulty.

I think I understand about the "no event" code necessary to write a console only script. That will be my next project. I take it that a console script would be set to "none" in the "manage module, properties, script setting as well. I will try that.

I thought it should be possible to use more than one script per mod, and your explanation that only one could be an event script for each mod makes sense. Once the module is loaded then it stands to reason that any script INSIDE that module would load too. Now I am curious about loading other items with triggers of some sort or from the console to sort of "fill in" when I equip various party members with stuff I made. I also want to make stuff "stackable" if that is possible for weapons and such, as inventory slots are very valuable and holding even a few items that won't be used for a while is burdensome. I'm sure it can be done, but I have not noticed a "stack property" when creating an item... but then, I was so concentrated on just getting things to work I may have missed it.

I am aware of the toolset's miscreant behavior as to larding up the "packages\\core\\override\\toolsetexport" directory, and I do delete everything in there each time I export a module. I am also aware of creating everything "without dependent resources" as you specify. I even wrote myself a step by step tutorial recently so I would not forget anything as I go along... thus the last two mods have run smoothly and I haven't crashed once in several days of playing with two of them activated. I did manage to make some changes to both mod's items and re-export them with no problems. I will now go back over the previous two that I more or less abandoned, knowing it can be done even If I have to delete all the script code, export the empty one, clear the toolset folder, and then write a new one and export it. I did that to one that was giving me grief by giving me compile errors (unknown error). Upon deleting the code, exporting the empty, re-typing the code and re-exporting everything worked... even though the code was exactly the same. I have become aware that the script window is not too happy about copy and pasted code I might create somewhere else... even in another module. At least that is my impression to date.

I can't thank you enough for all the guidance you have given me so far. Life is made out of time, and for you to share yours with me is a very generous act. I appreciate it!

Now I'm more curious than ever about what my poor understanding can produce. For instance, since the items I make are saved to "core" but the owner is whatever mod I've written, is it possible, knowing the tag of the item, to use it in another module script and call it from there? Like... can I call one of my previous items in a new module script without having to re-create the item in that particular mod? Where is the list of ALL the tags of ALL the items in the game for instance? That would be good to know!

Once again thank you for your time and assistance. Hopefully others here will also benefit from this, though to most I'm sure this is so basic that they are far beyond it's need. We all have to start somewhere though, and this has been invaluable to me, and perhaps others as well.

#17
nezroy

nezroy
  • Members
  • 99 messages

I also want to make stuff "stackable" if that is possible for weapons and such, as inventory slots are very valuable and holding even a few items that won't be used for a while is burdensome. I'm sure it can be done, but I have not noticed a "stack property" when creating an item... but then, I was so concentrated on just getting things to work I may have missed it.


The maximum stack size for an item is defined by the overall type of the item. As far as I know you can't override this for a specific item but only change it for every item of that type (i.e. all chest armor) by changing the definition for that type in BITM_base. Alternately you could create a whole new item type just for your item that has a custom stack size, but that runs into all sorts of other complications (have to specify where it can be equipped, might start breaking item set and other calculations, etc.)

Now I'm more curious than ever about what my poor understanding can produce. For instance, since the items I make are saved to "core" but the owner is whatever mod I've written, is it possible, knowing the tag of the item, to use it in another module script and call it from there? Like... can I call one of my previous items in a new module script without having to re-create the item in that particular mod? Where is the list of ALL the tags of ALL the items in the game for instance? That would be good to know!


It is possible to get references to an item from another mod just by its tag. So you could look for/move/modify these items by tag. However I don't think it's possible to actually CREATE a new item only by tag, since all of the creation stuff requires an actual resource reference (which are the bits in the form R"some_item.uti"). And the only way your code will compile when you have one of those resource strings is if that uti file exists in your mod (as far as I know, anyhow.. I haven't experimented with this much). One cheat is that you can get the resource ref of an existing item using GetResRef, so if at least one item exists (that you can get by tag), then you can create more copies of the item from any mod (get the item by tag, call GetResRef on it, and then use that res ref to create the item). Pretty sure this is what the Winter Forge does a lot of, for instance.