Jump to content

BreakArmor for Vanilla Armors (Last Update: 130115)


Recommended Posts

Cool' date=' hope things go well. Thank you.

 

Anyway, I won't think about enchanting or enchanted items for a while. To be honest I couldn't make any progress of my current BU meshes because of this and other petty works.

[/quote']

 

Oh yeah, anyone feel like taking the latest Clothing converter Pre-Release beta for a test run?

 

When I say petty works I mean my messy data folder. I was wrestling with my obmm script and wondering how I could reduce those annoying 'choose one option' messageboxes.

Link to comment

I've begun digging through the BU scrips in BreakUndies.esm (pretty confusing place' date=' I can't tell if some of this stuff is bitrot or intentional) and there is definitely code that is *supposed* to capture player enchant events.

 

If you take a look at aaBUSerializerSC there is a menumode section

 

Begin MenuMode 1042
let base := GetEnchMenuBaseItem
if (base != 0)
	if eval((ar_Find playerRef aaBUData.EnablerQueue) < 0)
		ar_Append aaBUData.EnablerQueue playerRef
	endif
endif
End

 

So, what should that be doing? Well, GetEnchMenuBaseItem is a neat little function that will give us the itemid of the item currently selected for enchantment. This is handy, for obvious reasons.

 

I'm still trying to figure out how all the pieces are supposed to work together (and I'm seriously considering just creating a test framework from scratch at this point) but it sure looks like it was intended to compensate for player enchantment events.

 

Of course, I would have expected this bit of code to be followed up with GetLastEnchantedItem *somwhere* in the script or another script. And there are no references anywhere to that. (I would have maintained a global quest variable that has a duplicate of the last known GetLastEnchantedItem. Any time the enchantment menu is exited, it would compare its value to GetLastEnchantedItem and, if different, create a key/value pair that points GetLastEnchantedItem to the relevant BU entry for the idemid belonging to GetEnchMenuBaseItem, if it exists)

 

So, at this point I don't think that they are capturing the new itemid (but I'm still digging around for any alternate methods that they might be using).

 

I may be missing something (In fact I probably am) but I think my next step is going to be to create a new (but compatible) breakundies framework, if for no other reason then to understand some of the decisions that were made in the development of the initial framework.

 

In particular, I want to find out if I can code a version of the framework that doesn't depend on itemids at all. I'd like to try and capture the idemids dynamically by just checking model paths. If it works (and can be done without hogging resources), it should make all of the code much simpler.

[/quote']

 

Do you have an idea how to make it work only on model paths? With the itemIDs it's easy because you attach a script to an item based on the ID supplied in the ini. How would you do it without that? check every piece of armor comparing it to every nif path?

Link to comment

Cool' date=' hope things go well. Thank you.

 

Anyway, I won't think about enchanting or enchanted items for a while. To be honest I couldn't make any progress of my current BU meshes because of this and other petty works.

[/quote']

 

Oh yeah, anyone feel like taking the latest Clothing converter Pre-Release beta for a test run?

 

When I say petty works I mean my messy data folder. I was wrestling with my obmm script and wondering how I could reduce those annoying 'choose one option' messageboxes.

 

One thing that might help a bit would be to repackage all of the mesh and texture files in the archive to match your intended directory structure. That should significantly reduce the amount of scripting that you have to do, and should make life easier for folks who like to install things by hand at the same time.

Link to comment

Do you have an idea how to make it work only on model paths? With the itemIDs it's easy because you attach a script to an item based on the ID supplied in the ini. How would you do it without that? check every piece of armor comparing it to every nif path?

 

Oh yeah.

 

The first thing is to construct an array that contains all of the model paths (probably gathered from multiple ini files...I have another idea to have an initialization script that checks for any ini files starting with BU_ or whatever it needs to be.) This gets done once, and probably whenever the game is loaded.

 

Then you just run a script that periodically checks local NPC's and the player for nifs with BU support. Whenever it finds one, it grabs the itemid and monitors that item in more or less the same fashion it does now.

 

That's my idea anyway. I need to create a testing framework to see if it is actually doable, or just a pipe dream.

Link to comment

Then you just run a script that periodically checks local NPC's and the player for nifs with BU support. Whenever it finds one' date=' it grabs the itemid and monitors that item in more or less the same fashion it does now.

[/quote']

 

How would you go about that, like how would you get local npc list?

Link to comment

Then you just run a script that periodically checks local NPC's and the player for nifs with BU support. Whenever it finds one' date=' it grabs the itemid and monitors that item in more or less the same fashion it does now.

[/quote']

 

How would you go about that, like how would you get local npc list?

 

Basically I'd just do the same thing that Autosetbody Reloaded does.

 

I'd start with a call to GetFirstRef

 

Something a bit like this (very crude rough draft):

 

set currentNPC to GetFirstRef 35 1
	while( currentNPC )
                   DoStuff(currentNPC)

 

*edit* I forgot to add, follow up with GetNextRef

 

The idea is to just cycle through all NPCs in a scene, do any inventory checks, equip/unequip events, etc you want.

 

To make the script run more efficiently, it might make sense sense to maintain a dynamically generated array that treats NPC's with bu-compatible items equipped as active (run scripts on them) and NPC's without bu-compatible items as inactive (don't run bu scripts on them).

Link to comment

set currentNPC to GetFirstRef 35 1
	while( currentNPC )
                   DoStuff(currentNPC)

 

Let's do a jury rig using this.

 

set currentNPC to GetFirstRef 35 1
	while( currentNPC )
                   Re-equip current armor(currentNPC)

Any way to get them equipped anything from their inventory?

Link to comment

set currentNPC to GetFirstRef 35 1
	while( currentNPC )
                   DoStuff(currentNPC)

 

Let's do a jury rig using this.

 

set currentNPC to GetFirstRef 35 1
	while( currentNPC )
                   Re-equip current armor(currentNPC)

Any way to get them equipped anything from their inventory?

 

Sure. I don't remember the function offhand, but there is a function that will return the IDs of any inventory items that fit the specified slot(s). Once you have the ID, you can do pretty much anything you want to it.

Link to comment

Now, for the BU test framework

 

I'm thinking something along the lines of this:

 

Periodically Cycle through NPCs in a scene with GetFirstRef and GetNextRef

 

Cycle through each NPC's inventory , if the item is equipped, compare the GetModelPath value to the BU item array, if it is found, add the itemid to another array that links the NPC ID to the discovered ID's for any equipped items (it could also include unequipped items) containing BU compatible model paths.

 

Then periodically run (say, once per second) GetInvRefsForItem for each item ID in each BU Active NPC's array entry and check the health of the item.

 

I *suspect* that we will want to clone the item prior to changing the model path via CloneForm to avoid conflicts if multiple NPCs are wearing the same armor in a scene.

 

When the item's health deteriorates, use SetModelPath and UnequipItemSilent followed by EquipItemSilent

 

If I can get this to work (and there are no guarantees that I can), then this would give us a BU framework that depends only on an ini file (or better yet, multiple ini files) and model paths.

 

There would still be the problem with Arena Rainments, but that should be solvable.

Link to comment

It's go no .ini file with it' date=' but here http://www.mediafire.com/download.php?j1mac47a9fc1q7j are some BU meshes I prepared for the elven curiass. Needs re-weighting as I can't do that but I've tested the meshes in game and they work. Its for hgec d-cup standard.

[/quote']

 

Hey, THANKS! Thanks for the BBB elven cuirass :D Definitely will see why it needs reweighting and put it together. btw will you do this together with us? Don't worry about weightpainting thing. It takes no more than 1 hour to learn how to use BWC.

 

This would be a good default option for those who don't like remodeled replacer if you continue to doing this.

Link to comment

*Hopefully* this works.

SCN aaaVBUQuestScript

ref Them

Begin GameMode

If GetGameRestarted == 0 && GetGameLoaded == 0
;PrintC "The game is neither loaded nor restarted, so return."
	Return
EndIf

Set Them to GetFirstRef 35 1
while ( Them )
	If Them.GetDisabled == 0 && Them != Player
		Them.Update3D
	EndIf
	Set Them to GetNextRef
loop

End

 

And I cannot belive that I've spent hours to find Update3D function.

SCN aaaVBUQuestScript

;float fQuestDelayTime

ref Them
ref pInvObj

short InvPos
short InvCount
short SumSlot

long sInvObj

Begin GameMode

;Set fQuestDelayTime to

If GetGameRestarted == 0 && GetGameLoaded == 0
;PrintC "The game is neither loaded nor restarted, so return."
	Return
EndIf

Set Them to GetFirstRef 35 1
;	Label 0
while ( Them )
;	If ( Them )
	If Them.GetDisabled == 0 && Them != Player
;			Set SumSlot to 0
;			Set InvPos to 0
;			Set InvCount to Them.GetNumItems
		Them.Update3D
		Set Them to GetNextRef
	EndIf
;EndIf
loop
;	GoTo 1

;	Label 1
;	while InvPos < InvCount
;		Set pInvObj to ( Them.GetInventoryObject InvPos )
;		If pInvObj.IsArmor
;			Set sInvObj to pInvObj.GetBipedSlotMask
;			If ( sInvObj == 4 || sInvObj == 8 || sInvObj == 12 || sInvObj == 60 )
;				PrintC "[VBUTest] EquipItem executed"
;				Them.EquipItem pInvObj
;				Set SumSlot to ( SumSlot + sInvObj )
;			EndIf
;			If SumSlot >= 12
;				break
;			EndIf
;			Set InvPos to ( InvPos + 1 )
;			Set Them to GetNextRef
;		EndIF
;	loop
;	GoTo 0

End

Link to comment

scn aaaBUBaseQuestScript

float fQuestDelayTime
ref currentNPC

ref iterItem
ref currentNPCInventory
short count


Begin GameMode
let fQuestDelayTime := 5 ; run script once every five seconds
;Cycle through Every NPC in a scene
let currentNPC := GetFirstRef 35 1
while( currentNPC )
	print $currentNPC
	let currentNPCInventory := currentNPC
	foreach iterItem <- currentNPCInventory
		if iterItem.IsEquipped
			let count := iterItem.GetRefCount
			if currentNPC.GetIsSex Male
				print "Found Male Path "+ iterItem.GetBipedModelPath 0 + " for " + $iterItem + " " + iterItem.GetFormIDString
			else 
				print "Found Female Path " + iterItem.GetBipedModelPath 1 + " for " + $iterItem + " " + iterItem.GetFormIDString
			endif
		endif
	loop
	;Now that we're done, get the next NPC
	let currentNPC := GetNextRef
loop	
end

 

Here's a quick little proof of concept script I've started working on. I've got it set to run every five seconds and at the moment it just returns the model path (for clothing), the name, and the formID of all equipped inventory.

Link to comment

*Hopefully* this works.

SCN aaaVBUQuestScript

ref Them

Begin GameMode

If GetGameRestarted == 0 && GetGameLoaded == 0
;PrintC "The game is neither loaded nor restarted, so return."
	Return
EndIf

Set Them to GetFirstRef 35 1
while ( Them )
	If Them.GetDisabled == 0 && Them != Player
		Them.Update3D
	EndIf
	Set Them to GetNextRef
loop

End

 

And I cannot belive that I've spent hours to find Update3D function.

SCN aaaVBUQuestScript

;float fQuestDelayTime

ref Them
ref pInvObj

short InvPos
short InvCount
short SumSlot

long sInvObj

Begin GameMode

;Set fQuestDelayTime to

If GetGameRestarted == 0 && GetGameLoaded == 0
;PrintC "The game is neither loaded nor restarted, so return."
	Return
EndIf

Set Them to GetFirstRef 35 1
;	Label 0
while ( Them )
;	If ( Them )
	If Them.GetDisabled == 0 && Them != Player
;			Set SumSlot to 0
;			Set InvPos to 0
;			Set InvCount to Them.GetNumItems
		Them.Update3D
		Set Them to GetNextRef
	EndIf
;EndIf
loop
;	GoTo 1

;	Label 1
;	while InvPos < InvCount
;		Set pInvObj to ( Them.GetInventoryObject InvPos )
;		If pInvObj.IsArmor
;			Set sInvObj to pInvObj.GetBipedSlotMask
;			If ( sInvObj == 4 || sInvObj == 8 || sInvObj == 12 || sInvObj == 60 )
;				PrintC "[VBUTest] EquipItem executed"
;				Them.EquipItem pInvObj
;				Set SumSlot to ( SumSlot + sInvObj )
;			EndIf
;			If SumSlot >= 12
;				break
;			EndIf
;			Set InvPos to ( InvPos + 1 )
;			Set Them to GetNextRef
;		EndIF
;	loop
;	GoTo 0

End

 

Look good. That seems much better than running an equip/unequip on every item in their inventory.

 

If I'm reading the documentation correctly, update3d does not work on the player (as you code acknowledges). Oh well. It would be nice to be able to get rid of the unequip/equip kludge altogether.

Link to comment

If I'm reading the documentation correctly' date=' update3d does not work on the player (as you code acknowledges). Oh well. It would be nice to be able to get rid of the unequip/equip kludge altogether.

[/quote']

 

I cannot figure out what PC's current equipped armor is, because when aaaVBUQuest runs PC already has unequpped it.

 

..This might do the trick.

 

adding these to BUstock ini,

Set aaaVBUQuest.PCArmor4 to Player.GetEquipmentSlotMask 60 4	;upper only
Set aaaVBUQuest.PCArmor8 to Player.GetEquipmentSlotMask 60 8	;lower only
Set aaaVBUQuest.PCArmor12 to Player.GetEquipmentSlotMask 60 12	;upper+lower but no foot/hand
Set aaaVBUQuest.PCArmor60 to Player.GetEquipmentSlotMask 60 60	;upper+lower+foot+hand

 

And I modify a few lines inside of while loop something like this.

 

(while)
If (not player)
Them.Update3D
ElseIf Them == Player
If PCArmor4 || PCArmor8
	Them.EquipItemSilent PCArmor4
	Them.EquipItemSilent PCArmor8
ElseIf PCArmor12
	Them.EquipItemSilent PCArmor12
ElseIf PCArmor60
	Them.EquipItemSilent PCArmor60
EndIf
EndIf
(loop)

Link to comment

Now' date=' for the BU test framework

 

I'm thinking something along the lines of this:

 

Periodically Cycle through NPCs in a scene with GetFirstRef and GetNextRef

 

Cycle through each NPC's inventory , if the item is equipped, compare the GetModelPath value to the BU item array, if it is found, add the itemid to another array that links the NPC ID to the discovered ID's for any equipped items (it could also include unequipped items) containing BU compatible model paths.

 

Then periodically run (say, once per second) GetInvRefsForItem for each item ID in each BU Active NPC's array entry and check the health of the item.

 

I *suspect* that we will want to clone the item prior to changing the model path via CloneForm to avoid conflicts if multiple NPCs are wearing the same armor in a scene.

 

When the item's health deteriorates, use SetModelPath and UnequipItemSilent followed by EquipItemSilent

 

If I can get this to work (and there are no guarantees that I can), then this would give us a BU framework that depends only on an ini file (or better yet, multiple ini files) and model paths.

 

There would still be the problem with Arena Rainments, but that should be solvable.

 

From what I read scripts with Object type, attached to an object, alhough attached to the global object run on a particular instance of that object so there should be no need to clone the objec prior to making changes

 

*edit* that makes sense although more than one npc has the same armor it keeps separate values for each instance, ie different npcs have separate damage values for the same armor. Also cloned forms save in the save file so by using CloneForm you would end up bloating the saves

Link to comment

 

From what I read scripts with Object type' date=' attached to an object, alhough attached to the global object run on a particular instance of that object so there should be no need to clone the objec prior to making changes

 

*edit* that makes sense although more than one npc has the same armor it keeps separate values for each instance, ie different npcs have separate damage values for the same armor. Also cloned forms save in the save file so by using CloneForm you would end up bloating the saves

[/quote']

 

That is good news.

 

I've made some progress on my proof of concept for the itemID-less BU framework.

 

I have successfully generated a stringmap array that uses each unique nif listed in the ini file as a key. Each of these unique keys point to an array that lists the entire category of compatible meshes (in the same order as they appear in the ini file).

 

Even better, the value returned by GetBipedModelPath works as a key for this array.

 

All I need to do is add grab the current condition of the armor and toss in a mesh replacement script and we've got ourselves a bare-boned start to an entirely mesh-based BU framework.

 

It doesn't actually do anything other then make console spam at the moment, but it's making the right sort of console spam.

Link to comment

 

From what I read scripts with Object type' date=' attached to an object, alhough attached to the global object run on a particular instance of that object so there should be no need to clone the objec prior to making changes

 

*edit* that makes sense although more than one npc has the same armor it keeps separate values for each instance, ie different npcs have separate damage values for the same armor. Also cloned forms save in the save file so by using CloneForm you would end up bloating the saves

[/quote']

 

That is good news.

 

I've made some progress on my proof of concept for the itemID-less BU framework.

 

I have successfully generated a stringmap array that uses each unique nif listed in the ini file as a key. Each of these unique keys point to an array that lists the entire category of compatible meshes (in the same order as they appear in the ini file).

 

Even better, the value returned by GetBipedModelPath works as a key for this array.

 

All I need to do is add grab the current condition of the armor and toss in a mesh replacement script and we've got ourselves a bare-boned start to an entirely mesh-based BU framework.

 

It doesn't actually do anything other then make console spam at the moment, but it's making the right sort of console spam.

 

well even thoug it doesn't do anything other than spamming the console it should be showing how much cpu intensive this scripst are, right? because these are the most cpu power intensive parts of the project, aren't they?

 

BTW I already know where Mo is from, what about you? I'm curious because I think we've got quite an international team here

 

*edit* oh and be sure to check what gets saved in the savefile. i remember that at least some types of variables do unless you explicitly destroy them at the end of the script. i also remember that they probably get auto destroyed when there are no references pointing to them. keep in mind that i'm still a noob in oblivion scripting, but i know that cleaning up after yourself is an important thing. bloating the save file is the last thing we want to do, so thats why i'm concerned. i hope that my concerns and bits of oblivion modding knowledge i aquired so far are helpful. i've got some experience in programming in general in couple of languages (still far from pro) but i hope it will prove useful

Link to comment

It's go no .ini file with it' date=' but here http://www.mediafire.com/download.php?j1mac47a9fc1q7j are some BU meshes I prepared for the elven curiass. Needs re-weighting as I can't do that but I've tested the meshes in game and they work. Its for hgec d-cup standard.

[/quote']

 

Nice work, i didnt test them in game till now, but it it looks like you only removed parts and dont change any 3Ddata, so you dont need to re-weight them, to my knowledge.

Link to comment

OP updated to 121122.

 

I know' date=' clicking 1 page again is damn bothersome.

 

http://www.mediafire.com/?5u7kdzj0jnqkw24

 

[img']http://images.wikia.com/fallout/images/2/24/JuryRigging.png[/img]

Fixed the issue that CS-enchanted items not being properly re-equpped when the game is loaded.

 

And's here's some mythic dawn armor http://www.mediafire.com/download.php?b5m21lz3dyagr46 - d cup agian, Thanks :D

Link to comment

And's here's some mythic dawn armor http://www.mediafire.com/download.php?b5m21lz3dyagr46 - d cup agian' date=' Thanks :D

[/quote']

 

Thanks again. Notifying its cup size is very helpful especially when the file is not weighted yet.

 

Fixed the issue that CS-enchanted items not being properly re-equpped when the game is loaded.

 

So how did you do that?

 

It's a crude workaround. When the game is loaded, check every last NPC in the cell and update their 3D. For the player, save player's equipped items when .ini is loaded and equip it when the quest runs.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use