Jump to content

Companion Weapon Damage script


Agnot2006

Recommended Posts

I created and added a new section to Penny’s main Object script. The new section enables Penny to monitor and inform the player when her weapon is becoming damaged.

I created a topic for her to say when the weapon becomes damaged and a couple of extra quest variables that show me the base health and the damage of the weapon she is using in the consol. The two variables setup to monitor the damage doesn’t seem to be updating. Although the rest is working, the topic triggers when the weapon she is using reaches the damage limit and goes back to max when I repair her weapon. The weapon was damaged when I started running the script and initially variable showed that damage but didn’t update when the damage increased but it did jump back up to max after I did the repair, but doesn’t show the damage as it happens. Can anyone help with what I did wrong?

Penny Weapon Damage

;Insert into Penny's quest script
Short PennyWeaponTopic ;To start the topic
Short PennyWeaponSaid ;To stop the topic
Short PennyWeaponHealth ;to monitor damage rate



;Insert into Penny Script
Ref rPennyWeapon
Short iPennyWeaponBaseHealt
Short pWeaponHealth

Begin Gamemode
if GetEquippedObject 5 > 0
		set rPennyWeapon to GetEquippedObject 5 
		set iPennyWeaponBaseHealt to GetBaseHealth rPennyWeapon
		set pWeaponHealth to GetEquippedCurrentHealth 5
		set aajeallesGirlsRepairSB.PennyWeaponHealth to pWeaponHealth; show me
		set aajeallesGirlsRepairSB.PennyWeaponBaseHealth to iPennyWeaponBaseHealt; show me
			If pWeaponHealth < iPennyWeaponBaseHealt - 50
				Set aajeallesGirlsRepairSB.PennyWeaponTopic to 1
			else
				Set aajeallesGirlsRepairSB.PennyWeaponTopic to 0
				Set aajeallesGirlsRepairSB.PennyWeaponSaid to 0
			endif
endif
end

Link to comment
Share on other sites

For weapon health on her object script you can just use

 

set pWeaponHealth to GetWeaponHealthPerc
If pWeaponHealth < 50
;do stuff

 

Or if you want to stick with the With the FOSE functions, you have to do a division to get the percentage, because GetBaseHealth returns the number of hitpoints the item has (its 'health' in the Geck).

GetEquippedCurrentHealth returns the nnumber of hitpoints that the item has left.

So the percentage (0.0 to 1.0) would be (a float):

 

float pWeaponHealthPerc
set pWeaponHealthPerc to pWeaponHealth / iPennyWeaponBaseHealt * 100	;returns 0 - 100

Link to comment
Share on other sites

  • Recently Browsing   0 members

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