Getting the current health of an item?

Post » Mon Mar 14, 2011 2:48 pm

Is it possible to get the current health of a item which is not equipped? If its possible how?
User avatar
Project
 
Posts: 3490
Joined: Fri May 04, 2007 7:58 am

Post » Tue Mar 15, 2011 2:23 am

It maybe "Plausible" to target a specific item within the players stuff, but determining the health of an unequipped item would be difficult.

If Player.GetItemCount Caps001 == 0  Player.AddItem Caps001 100EndIf


Could modify it so it would say for example:

If Player.GetItemCount WeapLaserRifleUnique == 1 ShowHappyMsg endIf 


where the game determines if the player has the AER-14 Prototype laser rifle. If the player has it the code will show the message and if not it won't show anything. Beyond that i'm unsure and you may want to look at the script extender to get some more functionality. What are you wanting to do with the code specifically so we can get a better idea of how to help you out?
User avatar
Rudy Paint fingers
 
Posts: 3416
Joined: Sun Nov 11, 2007 1:52 am

Post » Tue Mar 15, 2011 1:49 am

The basic idea is to get the condition of a weapon/armor the player wants to scrap and generate salvage. The salvage depends on the rifle condition (more parts for a more intact gun/armor), so i want to get the condition of the item.
User avatar
Zach Hunter
 
Posts: 3444
Joined: Wed Aug 08, 2007 3:26 pm

Post » Tue Mar 15, 2011 3:10 am

No. At least, not in inventory.
User avatar
maya papps
 
Posts: 3468
Joined: Mon Aug 07, 2006 3:44 pm

Post » Mon Mar 14, 2011 7:22 pm

The basic idea is to get the condition of a weapon/armor the player wants to scrap and generate salvage. The salvage depends on the rifle condition (more parts for a more intact gun/armor), so i want to get the condition of the item.


Unfortunately no it's not possible then since there may exist multiple copies of an item within that player's inventory. It would be better to use the repair kit script as a template where you get the weaponhealth of the currently equipped weapon. Then modify the script so that it recognizes the varying health amounts. This will be the easiest way to do it for the weapons, but for armor i'm unsure if you can do this. Haven't seen any scripts that recognize armor health, but you maybe able to do the getequipped check to see if the player is wearing a specific armor.
User avatar
^_^
 
Posts: 3394
Joined: Thu May 31, 2007 12:01 am

Post » Mon Mar 14, 2011 4:54 pm

Ok, i may have explained it wrong. The items are not in the players inventory. The weapons / armors which will be scrapped are allready in a seperate cell and there they should be individually accessible by using GetFirstRefInCell to process one item and then deleting it and repeat this until all Refs of that type are gone.
So basiclly the question is if its possible to get the health from a weapon or armor ref.
User avatar
Baby K(:
 
Posts: 3395
Joined: Thu Nov 09, 2006 9:07 pm

Post » Tue Mar 15, 2011 1:04 am

You really don't have much initiative, do you? You've posted in the NVSE thread showing you know GetCurrentHealth exists, why don't you see if it works?
User avatar
Daddy Cool!
 
Posts: 3381
Joined: Tue Aug 21, 2007 5:34 pm

Post » Tue Mar 15, 2011 12:43 am

Doesn't work as far as i can see. Tested it but it doesn't work. Also i tested the GetHealth function in game on a dropped weapon and it returns 0 instead of the weapon health, maybe not working correctly or used wrong?
The motivation for posting in the NVSE Thread was to find out if this function is intended for item health or not. Maybe it could be only used on actors, don't know since no documentation is currently available.

*Edit*: rewrote my script, seems to work now. I'm happy but quite irritated now.
User avatar
Unstoppable Judge
 
Posts: 3337
Joined: Sat Jul 29, 2006 11:22 pm


Return to Fallout: New Vegas