stevie70 Posted October 28, 2011 Share Posted October 28, 2011 i want a clothing item to be replaced by another item whenever it's health percentage falls below xyz.so far as i've figured it out, this should hopefully work with a begin OnDestructionStageChange / GetHealthPercentage - combination, but on event, i'd have to know if the item is in an actor's inventory (remove/add, unequip/equip) or in the world (placeatme(?)), and i'm ab-so-lu-te-ly clueless on how to do that - any ideas anybody? Link to comment Share on other sites More sharing options...
Quetzlsacatanango Posted October 28, 2011 Share Posted October 28, 2011 I would be surprised if destruction stages work on equipped/equippable items. But to check if it's in inventory, use myref.getitemcount itembaseid Link to comment Share on other sites More sharing options...
rickerhk Posted October 28, 2011 Share Posted October 28, 2011 To check the health of armor, it needs to be equipped. Then there are NVSE functions that you can use to figure the healthpercentage of it. There's no other way, currently. Link to comment Share on other sites More sharing options...
stevie70 Posted October 28, 2011 Author Share Posted October 28, 2011 I would be surprised if destruction stages work on equipped/equippable items. not? i thought it'd be more or less the same as health percentage, but i haven't looked into destruction stages very much yet (actually just stumbled across it looking for a way to change a "clean" version for a "dirty" version when health percentage drops below whatever, but that doesn't sound like it'd work that way at all. :-( But to check if it's in inventory, usemyref.getitemcount itembaseidwell but (apart from the above) how'd i know who "myref" is? after all, this should have worked for any of that items, meaning: also if worn by random npc's.and with getitemcount, ok i'd know if any of these items is in their inventory, but i'd still not know if the item itself is in the world and just another one of that kind in the inv?and if it won't work with OnDestructionStateChange, i guess i'd have to find out all that gamemode for who knows how many copies of the item...man, and i thought that one'd be trivial... :-) Link to comment Share on other sites More sharing options...
stevie70 Posted October 28, 2011 Author Share Posted October 28, 2011 To check the health of armor, it needs to be equipped. Then there are NVSE functions that you can use to figure the healthpercentage of it. There's no other way, currently.don't use nvse, so this won't work for me i fear.guess i'll leave that out for now then, should've been just a little additional detail anyway......hm...any idea perhaps if OnHit / OnHitWith would work with clothing?i mean, getting hit and dropping health percentage look like they'd go together well somehow... :-) Link to comment Share on other sites More sharing options...
LurkerCJ Posted October 29, 2011 Share Posted October 29, 2011 (edited) i'd have to know if the item is in an actor's inventory (remove/add, unequip/equip) In this event you'd useBaseRefID.GetItemCount (ItemID) with a return of the (# in inventory)BaseRefID.GetItemCount (ItemID) with a reutrn of the (# in inventory) As for the other stuff I do believe what you're requesting is NVSE functions like previously stated. Edited October 29, 2011 by LurkerCJ Link to comment Share on other sites More sharing options...
stevie70 Posted October 29, 2011 Author Share Posted October 29, 2011 In this event you'd useBaseRefID.GetItemCount (ItemID) with a return of the (# in inventory)BaseRefID.GetItemCount (ItemID) with a reutrn of the (# in inventory)As for the other stuff I do believe what you're requesting is NVSE functions like previously stated.figured it out now, it's actually amazingly easy:OnHit and OnHitWith work very well with clothing. If this triggers, it means the item is either equipped or in the world, otherwise (if it's just in a container and not equipped) it couldn't be hit.now i check if it's in a container by calling GetContainer. if it is in one, this returns the container's ref (except if it's the player i think, got that to read up yet), if it's not, it returns nothing. so, if it's hit and in a container, i can AddItemHealthPercent NewItem and Removeitem Olditem and the equipping stuff (i can now also check if it's actually equipped since i got the ref)if it's hit and in no container, i PlaceAtMe Disable MarkForDelete the stuff.and if it's not hit, the health percentage shouldn't change anyway, at least i assume so, so this should do what i wanted (and basically does, just tested a rough script successfully)...never say never.or no other way, or anything else absolute... ;-) Link to comment Share on other sites More sharing options...
LurkerCJ Posted October 29, 2011 Share Posted October 29, 2011 (edited) In this event you'd useBaseRefID.GetItemCount (ItemID) with a return of the (# in inventory)BaseRefID.GetItemCount (ItemID) with a reutrn of the (# in inventory)As for the other stuff I do believe what you're requesting is NVSE functions like previously stated.figured it out now, it's actually amazingly easy:OnHit and OnHitWith work very well with clothing. If this triggers, it means the item is either equipped or in the world, otherwise (if it's just in a container and not equipped) it couldn't be hit.now i check if it's in a container by calling GetContainer. if it is in one, this returns the container's ref (except if it's the player i think, got that to read up yet), if it's not, it returns nothing. so, if it's hit and in a container, i can AddItemHealthPercent NewItem and Removeitem Olditem and the equipping stuff (i can now also check if it's actually equipped since i got the ref)if it's hit and in no container, i PlaceAtMe Disable MarkForDelete the stuff.and if it's not hit, the health percentage shouldn't change anyway, at least i assume so, so this should do what i wanted (and basically does, just tested a rough script successfully)...never say never.or no other way, or anything else absolute... ;-) Glad you figured it out :thumbsup: . Might come in handy for people wondering on how to do it. Edited October 29, 2011 by LurkerCJ Link to comment Share on other sites More sharing options...
stevie70 Posted October 29, 2011 Author Share Posted October 29, 2011 Glad you figured it out :thumbsup: . Might come in handy for people wondering on how to do it.yeah, me too :-) - but still i was a bit early with my euphoria i fear, because the whole thing has one big flaw:true is: checking if in a container and if equipped work like i wrote. also true is: OnHit works well with an armor item that's lying around in the world. BUT: on further testing i had to find OnHit (or OnHitWith) obviously won't trigger for an _equipped_ armor item;and one more problem about my whole setup, i've made an essential test-fiend with the suit on and punched bullets into him for about half an hour, but the suit's health percentage wouldn't drop (as seen by using showinventory) - this is strange, because on player-equipped items it sure does drop. or i don't know how long i'd have to shoot the guy before it drops on an npc, whatever. but at least i have half of the thing working so far, i'll see if i can find (out) something for/about the other half without having to use a ton of gamemode blocks.one thing that certainly didn't work was destruction stage, found i could add those to an item and even could make the item exchange for an other one on that stage (but not suitable for clothing anyhow, because you'd have to pick a nif and not an object (f/m-versions!)) and lots of other stuff, but it wouldn't trigger. next thing i found (on the geck-wiki) was, this obviously only works for objects that have destruction stages defined in the nif, so this try went absolutely nowhere. Link to comment Share on other sites More sharing options...
Recommended Posts