Wasteland 2: now with improved modding capabilities!

For community content (fan-art, fanfic, etcetera) for Wasteland 2.
Post Reply
Executor_
Explorer
Posts: 313
Joined: August 11th, 2014, 5:38 am

I'd look for a textures/materials/images folder near where the FBX file is stored. If you can't find anything, then maybe there's a way to save the textures separately from inside Blender. But I really don't have a clue.

Regarding the positions of the bullet/case/mod mounts, I'll try to implement a way of editing them via MSON soon.
Shadow Jack
Acolyte
Posts: 89
Joined: October 25th, 2017, 7:53 am

That would be awesome? thanks a lot!
It seems however that I cannot import texture to the game. I've downloaded this asset with textures :
https://www.turbosquid.com/3d-models/re ... ree/853459
But even if I put its textures in C:\GOG Games\Wasteland 2 Director's Cut\WL2_Data\Mods\Import\Texture\Weapon
and edit mson in such way texture is not applied. I have a strong feeling that I am missing out something because it has two additional texture files(AKMS_Gloss.png, AKMS_Spec.png ) and I have no idea how to edit mson to import them to make them work.
{
// diffuse (main) texture settings
overrideDiffuse : true
diffuseFilename : "AKMS_Diff"
diffuseScale : { x : 0.005, y : 0.005 }
diffuseOffset : { x : 0.0, y : 0.0 }
diffuseColor : { r : 1.0, g : 1.0, b : 1.0, a : 1.0 }

// normal (bump) map texture settings
overrideNormal : true
normalFilename : "AKMS_Norm"
normalScale : { x : 0.005, y : 0.005 }
normalOffset : { x : 0.0, y : 0.0 }
normalColor : { r : 0.0, g : 0.0, b : 0.0, a : 0.0 }

// cube (environment/reflection) map texture settings
overrideCube : false
cubeFilename : ""
cubeScale : { x : 0.0, y : 0.0 }
cubeOffset : { x : 0.0, y : 0.0 }
cubeColor : { r : 0.0, g : 0.0, b : 0.0, a : 0.0 }
}
Executor_
Explorer
Posts: 313
Joined: August 11th, 2014, 5:38 am

Try setting the 'scale' fields to

Code: Select all

diffuseScale : { x : 1, y : 1 }
normalScale : { x : 1, y : 1 }
 
Shadow Jack
Acolyte
Posts: 89
Joined: October 25th, 2017, 7:53 am

Executor_ wrote: April 24th, 2021, 5:25 pm Try setting the 'scale' fields to

Code: Select all

diffuseScale : { x : 1, y : 1 }
normalScale : { x : 1, y : 1 }
 
Yeah those were the initial values I used with no result - model was totally black. Then I tried to rescale textures to match the scale I used in a object. Can you try to import some model for e.g. melee weapon (https://www.turbosquid.com/3d-models/3d ... el-1713435)without scaling and rotating just to confirm that it is possible to attach texture to the imported model? Also I've read in some old Unity manuals that Unity at those time could accept model formats other than obj. Is Wasteland 2 explicitly tied only to obj? Also maybe it still necessary to attach texture to the material when edit obj and only after that it will be able to attach textures from import folder to the mesh?
Executor_
Explorer
Posts: 313
Joined: August 11th, 2014, 5:38 am

Open the debug_import.txt file. There'll be a line like

Code: Select all

.../Mods/Import/Mesh/Weapon/kp1.obj - found 4371 vertices, 2055 normals, 4695 uvs, 24348 triangles
And if you check the output_log.txt in the ".../Wasteland 2 Director's Cut/Build/WL2_Data/" directory, you'll see some errors.

Code: Select all

Mesh.uv is out of bounds. The supplied array needs to be the same size as the Mesh.vertices array. 
(Filename:  Line: 948)

Mesh.normals is out of bounds. The supplied array needs to be the same size as the Mesh.vertices array. 
(Filename:  Line: 889)
Unity requires meshes to have the same number of vertices, normals, and uvs. You can Google those errors. Here's one thread about it:
https://forum.unity.com/threads/mesh-uv ... nds.91157/

Regarding Unity accepting model formats besides OBJ: the runtime build can't load any models outside those stored in the "WL2_Data" folder in a custom format. Support for loading FBX/OBJ/DAE/etc. is exclusive to the Unity Editor. The reason you can import new meshes is because I stumbled across the code for reading OBJ files and added it to the game.
Shadow Jack
Acolyte
Posts: 89
Joined: October 25th, 2017, 7:53 am

Ok thanks for the explanation. So that is the problem with the number of vertices matching the number of normals you've mentioned earlier.
Executor_
Explorer
Posts: 313
Joined: August 11th, 2014, 5:38 am

0.9.4.062 now available here

MODDING
  • can edit/create weapon prefab GameObjects; located in "Prefab" folder
    • limited to melee and basic ranged, no energy or AoE weapons because they're much more complex
    • if creating a new prefab, you need to fill in the 'template' field, which is the name of a pre-existing prefab that will be cloned
  • can edit/create FireFX, which handles the effects displayed when a bullet is fired from a ranged weapon
Shadow Jack
Acolyte
Posts: 89
Joined: October 25th, 2017, 7:53 am

Thanks a lot for the new functionality, Executor!
Let me summarize necessary steps for importing new 3d model to the game please correct me if I am missing out something:
You'd likely have to load up the model and make some adjustments.
Model has to be saved as an OBJ file with the number of vertices matching the number of normals.
Also have to make sure the model is properly sized and rotated, which you find out via trial and error(Blender or similar tool).
though there'd still be the issue of correctly positioning the bullet, casing, muzzle flash, and mod mounts. Melee weapons would be the easiest.(Edit Prefab.mson)
The game's engine only supports up to 65k triangles per mesh. For more than that, I believe you need to create additional meshes, which you then place in child GameObjects.
Personally, I'd just avoid anything really high-poly.
As for the process, I'd first start by trying to edit an existing weapon.
Pick one from the "ItemTemplate_WeaponRanged" directory and open its MSON file.
Near the top you'll see the prefab field.
Go to the "Export/Mesh/Weapon/" folder and find the corresponding file.
Copy it to the "Import/Mesh/Weapon/" directory.
Move the OBJ model file containing the mesh into that folder too, then edit the MSON and set overrideMesh to true and change meshFilename to match the OBJ's (but excluding the file extension).
Repeat those steps with the MSON file from "Export/Texture/Weapon/". The texture files need to be in PNG/BMP/JPG format.
Afterwards, run the game, check the debug_import.txt file for any issues, and equip the weapon on a character to see if it worked.
Unity requires meshes to have the same number of vertices, normals, and uvs. You can Google those errors. Here's one thread about it:
https://forum.unity.com/threads/mesh-uv ... nds.91157/
Shadow Jack
Acolyte
Posts: 89
Joined: October 25th, 2017, 7:53 am

Hi again Executor. I have an issue: when I try to fieldstrip weapon only two top items are shown as possible outcomes of stripping in strip menu. However other items are dropped too(which is correct behaviour, they are dropped according to the values in fieldstrip.mson). Is it a bug in representation of the strip menu or is it something wrong with formatting of my mson? Please find below example of my mson.

{
associatedSkill : DropSkills.FIELDSTRIPPING // skill level determined by 'minSkill' in a Drop object

drops : [


{minSkill :10,maxSkill :-1,chanceToDrop :2,minRolls :1,maxRolls :1,dropClass : 1,dropItems : [{type : DropType.ITEM,itemTemplate :AK47_Mag_Huge_75,dropSet :null,percent :100,min :1,max :1}]}
{minSkill :8,maxSkill:-1,chanceToDrop :100,minRolls :1,maxRolls :1,dropClass : 0,dropItems : [{type : DropType.ITEM,itemTemplate :AK47_Good_Barrel,dropSet :null,percent :100,min :1,max :1}]}
{minSkill :8,maxSkill :-1,chanceToDrop :9,minRolls :1,maxRolls :1,dropClass : 1,dropItems : [{type : DropType.ITEM,itemTemplate :AK47_Flash_Suppressor,dropSet :null,percent :100,min :1,max :1}]}
{minSkill :8,maxSkill :-1,chanceToDrop :9,minRolls :1,maxRolls :1,dropClass : 1,dropItems : [{type : DropType.ITEM,itemTemplate :Mod_UnderBarrel_Laser,dropSet :null,percent :100,min :1,max :1}]}
{minSkill :7,maxSkill :-1,chanceToDrop :10,minRolls :1,maxRolls :1,dropClass : 1,dropItems : [{type : DropType.ITEM,itemTemplate :Magazine_Coupler,dropSet :null,percent :100,min :1,max :1}]}
{minSkill :7,maxSkill :-1,chanceToDrop :10,minRolls :1,maxRolls :1,dropClass : 1,dropItems : [{type : DropType.ITEM,itemTemplate :AK47_Mag_Sturdy_Extended_40,dropSet :null,percent :100,min :1,max :1}]}
{minSkill :6,maxSkill :7,chanceToDrop :100,minRolls :1,maxRolls :1,dropClass : 0,dropItems : [{type : DropType.ITEM,itemTemplate :AK47_Used_Barrel,dropSet :null,percent :100,min :1,max :1}]}
{minSkill :6,maxSkill :-1,chanceToDrop :10,minRolls :1,maxRolls :1,dropClass : 1,dropItems : [{type : DropType.ITEM,itemTemplate :AK47_Silencer,dropSet :null,percent :100,min :1,max :1}]}
{minSkill :5,maxSkill :-1,chanceToDrop :9,minRolls :1,maxRolls :1,dropClass : 1,dropItems : [{type : DropType.ITEM,itemTemplate :Mod_Foregrip_Angled,dropSet :null,percent :100,min :1,max :1}]}
{minSkill :5,maxSkill :-1,chanceToDrop :9,minRolls :1,maxRolls :1,dropClass : 1,dropItems : [{type : DropType.ITEM,itemTemplate :GunBelt,dropSet :null,percent :100,min :1,max :1}]}
{minSkill :5,maxSkill :-1,chanceToDrop :9,minRolls :1,maxRolls :1,dropClass : 1,dropItems : [{type : DropType.ITEM,itemTemplate :Mod_Foregrip_Vertical,dropSet :null,percent :100,min :1,max :1}]}
{minSkill :4,maxSkill :5,chanceToDrop :100,minRolls :1,maxRolls :1,dropClass : 0,dropItems : [{type : DropType.ITEM,itemTemplate :AK47_Worn_Barrel,dropSet :null,percent :100,min :1,max :1}]}
{minSkill :4,maxSkill :-1,chanceToDrop :8,minRolls :1,maxRolls :1,dropClass : 1,dropItems : [{type : DropType.ITEM,itemTemplate :AK47_Mag_Extended_40,dropSet :null,percent :100,min :1,max :1}]}
{minSkill :3,maxSkill :-1,chanceToDrop :7,minRolls :1,maxRolls :1,dropClass : 1,dropItems : [{type : DropType.ITEM,itemTemplate :Mod_Scope_Small,dropSet :null,percent :100,min :1,max :1}]}
{minSkill :2,maxSkill :3,chanceToDrop :100,minRolls :1,maxRolls :1,dropClass : 0,dropItems : [{type : DropType.ITEM,itemTemplate :AK47_Old_Barrel,dropSet :null,percent :100,min :1,max :1}]}
{minSkill :2,maxSkill :-1,chanceToDrop :6,minRolls :1,maxRolls :1,dropClass : 1,dropItems : [{type : DropType.ITEM,itemTemplate :Mod_UnderBarrel_Flashlight,dropSet :null,percent :100,min :1,max :1}]}
{minSkill :1,maxSkill :-1,chanceToDrop :5,minRolls :1,maxRolls :1,dropClass : 1,dropItems : [{type : DropType.ITEM,itemTemplate :AK47_Mag_Sturdy_30,dropSet :null,percent :100,min :1,max :1}]}
{minSkill :1,maxSkill :-1,chanceToDrop :5,minRolls :1,maxRolls :1,dropClass : 1,dropItems : [{type : DropType.ITEM,itemTemplate :GunSling,dropSet :null,percent :100,min :1,max :1}]}
{minSkill :1,maxSkill :-1,chanceToDrop :5,minRolls :1,maxRolls :1,dropClass : 1,dropItems : [{type : DropType.DROPSET,itemTemplate :null,dropSet :FieldStripping_Generic,percent :100,min :1,max :1}]}
]
}
Shadow Jack
Acolyte
Posts: 89
Joined: October 25th, 2017, 7:53 am

Hi again Executor, there is a bug in the game: several maps are loaded as AZ_RandomMap_01 and since they all are using same spawner coordinates from time to time mobs are spawned in unreachable area.
Executor_
Explorer
Posts: 313
Joined: August 11th, 2014, 5:38 am

0.9.4.063 now available here

BASE GAME BUG FIXES
  • game should do a better job of showing drop percentages when field stripping

______________________________________
Shadow Jack wrote: May 6th, 2021, 2:26 pm Hi again Executor, there is a bug in the game: several maps are loaded as AZ_RandomMap_01 and since they all are using same spawner coordinates from time to time mobs are spawned in unreachable area.
I ran around Arizona for a while on 0.9.4.062 triggering random encounters, and I was getting a variety of maps and I didn't notice any problems with NPC positioning. I did do some code adjustments related to random encounters while testing one of the earlier patches, but I double-checked and all that code was definitely commented out. Are you sure you haven't modded the game?
Shadow Jack
Acolyte
Posts: 89
Joined: October 25th, 2017, 7:53 am

Executor_ wrote: May 6th, 2021, 4:59 pm 0.9.4.063 now available here

BASE GAME BUG FIXES
  • game should do a better job of showing drop percentages when field stripping

______________________________________
Shadow Jack wrote: May 6th, 2021, 2:26 pm Hi again Executor, there is a bug in the game: several maps are loaded as AZ_RandomMap_01 and since they all are using same spawner coordinates from time to time mobs are spawned in unreachable area.
I ran around Arizona for a while on 0.9.4.062 triggering random encounters, and I was getting a variety of maps and I didn't notice any problems with NPC positioning. I did do some code adjustments related to random encounters while testing one of the earlier patches, but I double-checked and all that code was definitely commented out. Are you sure you haven't modded the game?
Well if by modding you mean altering dll than no - not this time. If you mean using your framework - hell yeah) When you first rolled out random encounter functionality I started exploring map to store all possible random encounter maps, taking screenshot of a map and storing it in my excel with a corresponding name that I took from debug file. Then I've noticed that different maps can be loaded under same name(e.g. AZ_RandomMap_01 can be shown in debug for several maps) . Other maps are more stable they always load same map under same name. When I first encountered this bug with mobs being out of reach I thought it was caused by me getting greedy and adding more spawnpoints than game can handle. Now I think this bug is caused that spawn coordinates for AZ_RandomMap_01 are stable while map to which those coordinates are applied vary from time to time. I can send my msons if necessary.
Executor_
Explorer
Posts: 313
Joined: August 11th, 2014, 5:38 am

You said there's multiple maps under the same name (AZ_RandomMap_01), and as far as I can tell, that's not the case. Each random encounter map has at least two RandomEncounterSpawnerSets. Each spawner set has three possible starting positions for the squad, although sometimes those starting positions are the same across multiple spawner sets. Since you mentioned AZ_RandomMap_01 specifically, it has four spawner sets, but if you check the randomEncounter.mson, the 'OLD' ones are not in use by the base game. There's no guarantee the Spawners used by the 'OLD' spawner sets are correctly placed, which might result in NPCs appearing in unreachable areas if you started using them.

The player start position is determined by the outdoorsmanRequiredToSkip field in WorldMapRandomEncounters and the highest character's Outdoorsman Skill. If highest skill level is outdoorsmanRequiredToSkip + 2, you get middlePlayerStart. If skill level is outdoorsmanRequiredToSkip + 3 or higher, then farPlayerStart. Otherwise, squad ends up at closePlayerStart.

If you want to quickly load a specific random encounter map, the best way is by editing one of the WorldMapRandomEncounterZones. Like "ArizonaWorldMap/WorldMapRandomEncounterZone/[4,5] RE_SurroundingMurderSite.mson" which can be triggered by wandering around near the Radio Tower. Set the name in scenes to whatever map you want loaded. There's a list of all the map names in the game in miscellaneous.txt in the Export root folder.

Code: Select all

{
	scenes : [ AZ_RandomMap_10 ]
	collection : {
		percentChance : 100
		
		encounters : [
			{ encounter : RE_Desert_Human_VeryEasy, weighting : 5 }
			{ encounter : RE_Desert_Vendor, weighting : 100 }
		]
	}
}
Mustang052484
Initiate
Posts: 1
Joined: May 9th, 2021, 4:28 am

Ok so with regards to the Assembly-CSharp.dll my size is only 18,796,000 bytes or 18,796 kb which isn't the 19,248,128 bytes. Now I see the original post is several years old so assuming there were updates to the game, has the XDELTA been updated to work with the current version or is my assembly sharp size wring? I installed it and everything seemed to be ok but I'm not sure.
Shadow Jack
Acolyte
Posts: 89
Joined: October 25th, 2017, 7:53 am

Ok thanks. for the explanation. I'll keep tracking that issue maybe will be able to provide more details later, for now I'll just keep some maps unmodified.
I have graphical glitch though: handguns(pistols) are not visible in hands. Sometimes they float around npc. I doublechecked folders Import/[Mesh, Texture/Prefab] are empty. Do you have something similar or is it specific to my system only?
Executor_
Explorer
Posts: 313
Joined: August 11th, 2014, 5:38 am

I loaded up some saves and tried equipping and unequipping handguns repeatedly, didn't see any issues. It's only affecting that specific weapon type? Do you have any saves that reproduce the bug?
Post Reply

Return to “Wasteland 2: Community Content”