armor health

Post » Fri Feb 18, 2011 11:12 pm

Im working on my centaur mod and adding centaur specific armor, in this example, im making a centaur version of the steel amor (using an DLC mesh).

Now I have my script to replace out the normal steel greaves when equipped with the centaur, however I have a problem. I can copy over the current 'health' of the item from the normal steel greaves to the centaur ones, but afterwards when the centaur steel greaves get unequipped you get back proper steel greaves in your inventory. This is where the problem is, I cant find a way to set the health of the greaves i put back into the player's inventory, meaning that no matter what condition they were in the get added back in at 100% health.....which is a problem.

Can anyone help?
User avatar
Mark
 
Posts: 3341
Joined: Wed May 23, 2007 11:59 am

Post » Sat Feb 19, 2011 2:23 am

I was having a similar issue with my scripting approach when I was still actively developing it.

Like in your solution, when equipping the item it's not difficult to store its health prior to the forced unequip and after the scripted equip of the substitute reapply the stored health to this one.
But when I unequipped an item and the scripts removed it from the inventory and added the original one back in there was no way to obtain its health "after it was unequipped". So I obtained the health of every item equipped each run of my token script, and as soon as an item got missing (was unequipped an instant ago) the stored health for this item was applied to the original item added to the inventory afterwards accordingly. There's the off chance to miss a tiny amount of health lost between the last regular check and the unequipping by the user, but back then my scripts were default configured to check every 5 frames or so, and that's not really enough time for huge differences.

I'm not sure anymore and would have to read it up again first, but weren't there some additions to OBSE covering modification of "unequipped" items in your inventory directly as well, as in messing around with the reference data stored aside the base object entry for the items in your inventory? But my memory's the worst one can imagine, so this could be just me mixing up things again as well.
User avatar
D LOpez
 
Posts: 3434
Joined: Sat Aug 25, 2007 12:30 pm

Post » Sat Feb 19, 2011 9:03 am

I was having a similar issue with my scripting approach when I was still actively developing it.

Like in your solution, when equipping the item it's not difficult to store its health prior to the forced unequip and after the scripted equip of the substitute reapply the stored health to this one.
But when I unequipped an item and the scripts removed it from the inventory and added the original one back in there was no way to obtain its health "after it was unequipped". So I obtained the health of every item equipped each run of my token script, and as soon as an item got missing (was unequipped an instant ago) the stored health for this item was applied to the original item added to the inventory afterwards accordingly. There's the off chance to miss a tiny amount of health lost between the last regular check and the unequipping by the user, but back then my scripts were default configured to check every 5 frames or so, and that's not really enough time for huge differences.

I'm not sure anymore and would have to read it up again first, but weren't there some additions to OBSE covering modification of "unequipped" items in your inventory directly as well, as in messing around with the reference data stored aside the base object entry for the items in your inventory? But my memory's the worst one can imagine, so this could be just me mixing up things again as well.


But when an object is back in your inventory it doesnt have a reference ID.....hence the problem.
User avatar
Skrapp Stephens
 
Posts: 3350
Joined: Mon Aug 06, 2007 5:04 am

Post » Fri Feb 18, 2011 11:55 pm

You can walk through your inventory using foreach checkitem <- me, where checkitem will be a reference to an item in your inventory (me == player). When you found the right reference use something like checkitem.SetCurrentHealth myhealth to set the item's health to myhealth.
User avatar
J.P loves
 
Posts: 3487
Joined: Thu Jun 21, 2007 9:03 am

Post » Fri Feb 18, 2011 9:24 pm

Solution!

I found if i quickly re-equip the greaves, set their damage unequip them again it works!
User avatar
Tamara Primo
 
Posts: 3483
Joined: Fri Jul 28, 2006 7:15 am

Post » Fri Feb 18, 2011 10:53 pm

Solution!

I found if i quickly re-equip the greaves, set their damage unequip them again it works!

Uh, I'm very sorry. This was the part I forgot to include in my description above! Of course I was doing something like this as well. Silly me. Well, just shows how bad my memory is. :facepalm:
User avatar
Keeley Stevens
 
Posts: 3398
Joined: Wed Sep 06, 2006 6:04 pm


Return to IV - Oblivion