Larian Banner: Baldur's Gate Patch 9
Previous Thread
Next Thread
Print Thread
#575361 14/11/15 01:57 AM
Joined: Nov 2015
M
MrWoof Offline OP
stranger
OP Offline
stranger
M
Joined: Nov 2015
I was wondering if it were possible to create new items. Now, I will say that I've already successfully changed item combos for crafting by modifying ItemCombos.txt and ItemComboPreviews.lsx. I can make a pre-existing skillbook be created from wool and water if I want. But this is only modifying based off existing items (whether they be consumables or books_scrolls (which both have their separate .lsf files).

When I attempt to create an item, using a template from a currently existing item but changed to be my new item, it doesn't really work. I can set it up to be created in the crafting, and indeed I get a non-existant "Unknown Item" combo. The best clue I can find is that in the .lsx files for items (Books_Scrolls.lsf for example), they all have unique "MapKey"s.

Example
This is the Man-At-Arms Inspire/Encourage skillbook
Code
<attribute id="MapKey" value="6db02a85-14a3-4ada-8247-74014e045aeb" type="22" />


This is the Man-At-Arms Shackles of Pain skillbook
Code
<attribute id="MapKey" value="99fa47fa-a40a-4dc1-b34b-ec3c987ab3d5" type="22" />


That's just two examples, but needless to say every type of item has a unique mapkey. The strings convert into bits of decimal, as they look to be Hex, but there isn't a pattern that I know of, so I'm not sure where the game is creating/originating these numbers from. I've tried changing the mapkey to be a new random number, same length, just off a few numbers, but that doesn't work either.

So yeah, anyone have any idea? Like I said, I can add new recipes to use existing items to create existing items, but the recipe fails when attempt to combine into an item I've created. Which actually means, most likely, that I'm failing to create an item correctly and the issue isn't the recipe combos.

I've been using the .lsf files in the RootTemplates to attempt to create new items, since those files house all the things like consumables, tools, etc. The only thing is that I've been copying existing mapkey IDs and that just doesn't work, so I'm pretty sure that's why I can't make new ones. Any help would be lovely, thank you!

Edit: From what I can tell, I also need an entry in something like object.txt or armor.txt. I've inserted a new one, which changed how far I've gotten. Now, instead of getting an unknown item, the game crashes on item combination. It dings like it made it but just before the icon shows up and it finishes, the game crashes. This was with the mapkey ID being a duplicate number from a real item, so I tried changing the mapkey to a different number by a few digits, the game crashes differently - right as the bar fills up but before the ding, the game crashes. I'm convinced that the mapkey is important and I just can't figure it out.

Edit: I tried taking a valid mapkey from a different item and putting in my new item (in the .lsf roottemplate file) and then deleting the real item's mapkey (in otherwords transplanting) as a temporary test. The game created a blank item but then as soon as I clicked the invisible item in the crafting window the game crashed. So yeah, whatever is up with mapkey, it isn't as simple as "steal some other item's mapkey". Oh well, stumped again!

Last edited by MrWoof; 14/11/15 02:40 AM.
Joined: Aug 2014
old hand
Offline
old hand
Joined: Aug 2014
I was able to steal other objects map keys and make new weapons and armor, at least in the original. Didn't delete the original mapkey (just. Don't know if you're modding the EE or the original. Didn't try it with crafting myself (entered things into treasure table), but my friend got crafting ones to work.

Not entirely sure why you're working in the LSFs. Should be able to do everything with the stat text files. You're defining, say, a piece of armor in armor.txt in the data folder, and then adding a link to a root template in the armor.txt the links folder, and then inputting that into the ItemCombos.txt? Or try adding your object to a treasure table (for say a crate) to see if it works, though you might have to start a new game since treasure tables are set on map load I believe (testing stuff without the editor is obnoxious.)

Joined: Nov 2015
M
MrWoof Offline OP
stranger
OP Offline
stranger
M
Joined: Nov 2015
Oops yes, sorry, trying to get it working for EE. Well, I checked out a couple of crafting mods for the original DOS, and from what I saw, for crafting, they changed the ItemComboPreviews.lsx and the ItemCombos.txt (in /Data/Public/Shared/Stats). That was to alter crafting recipes, and indeed I got that to work in EE. Works flawlessly except that the game whines about "your mods are whack" popup box when loading up the program (it used to do this for the crafting mods when I played DOS though, so whatever), but altering or creating new recipes works just fine.

So I decided to add something new; I've been trying to get the Feather Fall/Drop spell back to a skill book like it was in the original. The spell still exists (more or less) in the SkillData.txt file as "Teleportation_EnemyFeatherFall" (this is what monsters use) and "Teleportation_FeatherFallBySummon" (this is what the Air Elemental summon pet has). I've tried using the pet's skill as a template to just make a basic FeatherFall, though I can't tell if that works or not yet (since I can't get the book to craft correctly). Since the book doesn't exist, I've tried to mod one and that's where this post is talking about.

I can create a recipe for the new skillbook, and it works (well, it combines then crashes) and the same method works flawlessly when I try to make recipes for pre-existing items, so I feel that part is fine. Thus, I look at the next part - what is the game trying to make via that recipe? Well, once again using the idea of all the skillbooks as a reference (how they are made not only via recipe, but how the skillbook itself is in the data files). There are two places that skillbooks seem to exist.

One is Object.txt (in /Data/Public/Shared/Stats/Generated/Data) which has a very simple entry for skillbooks. This is the first entry for skillbooks that sets up the skillbook template that all others reference:
Code
new entry "_Skillbooks"
type "Object"
data "ModifierType" "Item"
data "Act" "1"
data "UseAPCost" "0"
data "Value" "5"
data "Weight" "500"
data "Requirements" "Level 3"
data "InventoryTab" "Magical"


And then all skillbooks look like this:
Code
new entry "SKILLBOOK_Ranger_Shout_RangedPowerStance"
type "Object"
using "_Skillbooks"
data "Act part" "2"
data "Requirements" "Level 1"


So I created an entry for my new skillbook. Attemping to craft it still crashes the game on completion. So I looked deeper. Since I knew that ItemComboPreviews.lsx can be modded and works, and the Run Speed Mod is a change of the player.lsx, I knew these files sometimes need to be altered.

The only place I can find skillbooks is in the RootTemplate/Books_Scrolls.lsf file. There you find entries like:
Code
				<node id="GameObjects">
					<attribute id="CanBeMoved" value="True" type="19" />
					<attribute id="CanBePickedUp" value="True" type="19" />
					<attribute id="CanSeeThrough" value="True" type="19" />
					<attribute id="CanShootThrough" value="True" type="19" />
					<attribute id="CastShadow" value="False" type="19" />
					<attribute id="Description" value="Expert Marksman skills are skills for archers and rangers. High dexterity improves these skills. Read this book to learn this skill." type="28" handle="h8a265339ga358g4ae4ga309g439615cc79b1" />
					<attribute id="DropSound" value="c6a52c42-baa1-4090-aa42-7ef06760c067" type="22" />
					<attribute id="Flag" value="0" type="4" />
					<attribute id="GroupID" value="0" type="5" />
					<attribute id="Icon" value="Item_BOOK_Spellbook_Ranger_A" type="22" />
					<attribute id="IsSurfaceCloudInteractable" value="True" type="19" />
					<attribute id="IsSurfaceInteractable" value="True" type="19" />
					<attribute id="LevelName" value="" type="22" />
					<attribute id="MapKey" value="1e754971-4ae6-49dd-8798-9c4febee16a3" type="22" />
					<attribute id="Name" value="BOOK_Skill_Ranger_Projectile_Ricochet" type="23" />
					<attribute id="Opacity" value="0.225" type="6" />
					<attribute id="PhysicsTemplate" value="d2c39c90-8c3c-45e4-8c58-a877bc160877" type="22" />
					<attribute id="PickupSound" value="7b9b54b6-0ac8-48c2-ac7d-e31196256d88" type="22" />
					<attribute id="RecieveDecal" value="False" type="19" />
					<attribute id="Scale" value="1" type="6" />
					<attribute id="Stats" value="SKILLBOOK_Ranger_Projectile_Ricochet" type="22" />
					<attribute id="Tooltip" value="2" type="1" />
					<attribute id="Type" value="item" type="22" />
					<attribute id="VisualTemplate" value="f1349d23-301d-435e-a32a-747c6e8e5692" type="22" />
					<attribute id="WalkThrough" value="True" type="19" />
					<attribute id="maxStackAmount" value="50" type="4" />
					<children>
						<node id="AIBounds">
							<attribute id="AIType" value="1" type="1" />
							<attribute id="Height" value="0.178634" type="6" />
							<attribute id="Max" value="0.255247 0.177119 0.270117" type="12" />
							<attribute id="Min" value="-0.270443 -0.00151443 -0.392645" type="12" />
							<attribute id="Radius" value="0.216147" type="6" />
						</node>
						<node id="Equipment">
							<children>
								<node id="CustomBodyMaterials">
									<attribute id="Object" value="" type="22" />
								</node>
								<node id="CustomBodyMaterials">
									<attribute id="Object" value="" type="22" />
								</node>
								<node id="CustomBodyMaterials">
									<attribute id="Object" value="" type="22" />
								</node>
								<node id="VisualResources">
									<attribute id="Object" value="" type="22" />
								</node>
								<node id="VisualResources">
									<attribute id="Object" value="" type="22" />
								</node>
								<node id="VisualResources">
									<attribute id="Object" value="" type="22" />
								</node>
							</children>
						</node>
						<node id="InventoryList" />
						<node id="OnDestroyActions" />
						<node id="OnUsePeaceActions">
							<children>
								<node id="Action">
									<attribute id="ActionType" value="13" type="4" />
									<children>
										<node id="Attributes">
											<attribute id="Consume" value="True" type="19" />
											<attribute id="SkillID" value="Projectile_Ricochet" type="22" />
										</node>
									</children>
								</node>
							</children>
						</node>


Once again I used multiple pre-existing items (such as the teleportation skillbook) as a template to try to make my own new item. Doing so still makes the game crash. Using a text-compare webpage, I repeatedly checked my code vs template code as I went along. I could change things with ease and made sure that things were named correctly. Since it still doesn't work, I'm suspecting the only remaining thing is that all the items in the RootTemplate folder (like Consumables.lsf and Books_Scrolls.lsx) have unique "mapkey" values (a long string of hex code), I figure that's what's jacking me up in creating a new item.

Now, I'm not saying I'm right. I could be way, way off on this. But I'm trying to narrow down the possibilities. The player.lsf files exist in both the MainLSF.pak and the Main.pak, but the Run Speed Mod only uses the copies from the MainLSF.pak (I know for sure since it was my forum thread here in which a player posted the mod and what he did and another user verified it was just from the MainLSF.pak).

Knowing this I've tried to use the files from the MainLSF when I can, but for whatever reason that .pak doesn't have the /Generated/Etc in the /Stats folder, so you are forced to go to the Main.pak for those (this is the location where all the text files are).

I hope this makes sense. I know I have a whole bunch of crap written up, but I make sure to do it in case it helps me or someone else for future efforts in getting this to work. I appreciate your reply! I'm not sure if you know how to make it work or how to make sense of all this, but either way, thanks for the interest.

Edit: I meant to say .LSB not .LSF all those times. Oops!

Last edited by MrWoof; 14/11/15 06:20 AM.
Joined: Apr 2013
N
addict
Offline
addict
N
Joined: Apr 2013
Quote

That's just two examples, but needless to say every type of item has a unique mapkey. The strings convert into bits of decimal, as they look to be Hex, but there isn't a pattern that I know of, so I'm not sure where the game is creating/originating these numbers from. I've tried changing the mapkey to be a new random number, same length, just off a few numbers, but that doesn't work either.


Do _not_ steal or reuse MapKey-s! They are UUID-s (https://en.wikipedia.org/wiki/Universally_unique_identifier), and each one is complete unique, as the name implies. AFAIK none of the bits mean anything, so you can use any v4 UUID generator (like this one: https://www.uuidgenerator.net/) to generate your ID-s. Also make sure that you use unique names for the objects, as the game checks those at a few places as well.

Joined: Aug 2014
old hand
Offline
old hand
Joined: Aug 2014
Any progress? Have you looked at the link stat files in the Links folder?I believe that's where you connect items with the proper root template and define object categories, player level needed for them to appear, etc.
Code
object itemstat "SKILLBOOK_ExplodeSelf","71ca015c-df88-43b2-893b-2aaace71b0ed","",0,0,"SkillbookFire",1,1,2,0,8,20


But I'm a bit confused about the ID: 71ca015c-df88-43b2-893b-2aaace71b0ed

It appears that these ARE reused to a certain degree in the links file for nearly identical items. For example, a breastplate might have 8 versions that all have the same ID, but there will only be one reference in the armor.lsx to that ID. Somehow these are used for level-mapping certain stats and requirements, but I'm not entirely sure how. That doesn't really matter for skillbooks, since there's only one version per each skillbook. But maybe you just need to copy the teleport skillbook info in the LSX, make the proper stat references, create a new ID with a generator, and then create a link in the links file.

Joined: Aug 2014
old hand
Offline
old hand
Joined: Aug 2014
Yup, got it working that way! So stoked! Telekinesis requirement works, so I'm all set to add skills to all the skill trees. These are the steps I used (some steps will be much easier when the editor comes out, but you have to do everything manually now):

1. Define Skillbook in object.txt in the public/shared/stats/generated/data folder. (Note that you may be able to make a new text file as long as its in own folder to keep track of your changes, but I'm not sure if that still works. Safest to just keep everything in the existing folders, but put things you add at the bottom so you can easily find things you add.):

Code
new entry "SKILLBOOK_FeatherFall"
type "Object"
using "_Skillbooks"
data "Act part" "6"
data "Requirements" "Level 3; Telekinesis 2"


2. Define link to root template in the object.txt links folder in public/shared/stats/generated/data. Generate a UUID with a site like the one Norbyte linked:

Code
object itemstat "SKILLBOOK_FeatherFall","72aab2f8-8cc8-11e5-8994-feff819cdc9f","",0,0,"SkillbookAir",1,1,2,0,1,20


Note that SkillbookAir defines the object category for loot tables. The last two numbers define the levels you'll find the item (in traders or loot).

3. Define or use an existing skill in the skilldata.txt

4. Define the root template in a lsb. Haven't tested yet, but I'm pretty sure you can just make your own lsb instead of inserting the data into an existing one, but I inserted the following into the Books_Scrolls.lsb (after unpacking with Norbyte's tool of course, and repacking afterwards.) Put the root template in Public/shared/RootTemplates folder in your game directory.

Use an existing root template you want the skillbook to be most similar to, and then insert the UUID you put the links in the MapKey part, and the stats name from the object.txt in the data folder, and the skillname in the skilldata folder.

Code
<node id="GameObjects">
					<attribute id="CanBeMoved" value="True" type="19" />
					<attribute id="CanBePickedUp" value="True" type="19" />
					<attribute id="CanSeeThrough" value="True" type="19" />
					<attribute id="CanShootThrough" value="True" type="19" />
					<attribute id="CastShadow" value="False" type="19" />
					<attribute id="Description" value="Telekinesis spells are kinetic spells. Read this book to learn this spell." type="28" handle="hd9bfb323g2f59g48c2gbd9dg906a8374a223" />
					<attribute id="DropSound" value="c6a52c42-baa1-4090-aa42-7ef06760c067" type="22" />
					<attribute id="Flag" value="0" type="4" />
					<attribute id="GroupID" value="0" type="5" />
					<attribute id="Icon" value="Item_BOOK_Spellbook_Air_A" type="22" />
					<attribute id="IsSurfaceCloudInteractable" value="True" type="19" />
					<attribute id="IsSurfaceInteractable" value="True" type="19" />
					<attribute id="LevelName" value="" type="22" />
					<attribute id="MapKey" value="72aab2f8-8cc8-11e5-8994-feff819cdc9f" type="22" />
					<attribute id="Name" value="BOOK_Skill_Air_Teleportation" type="23" />
					<attribute id="Opacity" value="0.225" type="6" />
					<attribute id="PhysicsTemplate" value="d2c39c90-8c3c-45e4-8c58-a877bc160877" type="22" />
					<attribute id="PickupSound" value="7b9b54b6-0ac8-48c2-ac7d-e31196256d88" type="22" />
					<attribute id="RecieveDecal" value="False" type="19" />
					<attribute id="Scale" value="1" type="6" />
					<attribute id="Stats" value="SKILLBOOK_FeatherFall" type="22" />
					<attribute id="Tooltip" value="2" type="1" />
					<attribute id="Type" value="item" type="22" />
					<attribute id="VisualTemplate" value="d9e49a21-8bfe-44a9-89ec-a5ae2ed12bfa" type="22" />
					<attribute id="WalkThrough" value="True" type="19" />
					<attribute id="maxStackAmount" value="50" type="4" />
					<children>
						<node id="AIBounds">
							<attribute id="AIType" value="1" type="1" />
							<attribute id="Height" value="0.178634" type="6" />
							<attribute id="Max" value="0.255247 0.177119 0.270117" type="12" />
							<attribute id="Min" value="-0.270443 -0.00151443 -0.392645" type="12" />
							<attribute id="Radius" value="0.216147" type="6" />
						</node>
						<node id="Equipment">
							<children>
								<node id="CustomBodyMaterials">
									<attribute id="Object" value="" type="22" />
								</node>
								<node id="CustomBodyMaterials">
									<attribute id="Object" value="" type="22" />
								</node>
								<node id="CustomBodyMaterials">
									<attribute id="Object" value="" type="22" />
								</node>
								<node id="VisualResources">
									<attribute id="Object" value="" type="22" />
								</node>
								<node id="VisualResources">
									<attribute id="Object" value="" type="22" />
								</node>
								<node id="VisualResources">
									<attribute id="Object" value="" type="22" />
								</node>
							</children>
						</node>
						<node id="InventoryList" />
						<node id="OnDestroyActions" />
						<node id="OnUsePeaceActions">
							<children>
								<node id="Action">
									<attribute id="ActionType" value="13" type="4" />
									<children>
										<node id="Attributes">
											<attribute id="Consume" value="True" type="19" />
											<attribute id="SkillID" value="Teleportation_FeatherFallBySummon" type="22" />
										</node>
									</children>
								</node>
							</children>
						</node>
						<node id="Scripts" />
						<node id="Tag">
							<attribute id="Object" value="Book" type="22" />
						</node>
					</children>
				</node>


6. Define your crafting combination in ItemCombo.txt, if only to test things:

Code
use object WPN_ArrowShaft_A on object LOOT_Essence_Air_A with transform code Destroy2Transform1 parameters SKILLBOOK_FeatherFall,0,0,0,0,0,1,1 requires Crafting 0 autolevel 1 autoValue 0


5. If you want to make custom stat/name descriptions, I think you'll have to input them into an lsb in the localizations folder. Haven't tested it yet, and not entirely sure how you generate the "handle," which is kind of like a UUID but with no dashes and always starts with an h.


6. Finally, rename the MainLSF.pak to Main.LSF.pak.original to disable it, just like for the speed mod. (I think if you use your own named lsb you might not have to do this, will check.)

Yeah, it's a lot to do for one skill, but it'll get easier. Good luck!







Last edited by Baardvark; 17/11/15 03:43 AM.

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.5