ZippyDSMlee Posted January 19, 2014 Share Posted January 19, 2014 This should call out to the combat target if its health is below 10% but its seems to work in the opposite direction. I've tried >= but it dose not work at all. I am so confused.This is the last thing I can think of to use disintegration outside of on critical hit on death ref CombatTarget Begin GameMode If player.GetEquipped Weapzippymoujor && player.IsInCombat set CombatTarget to player.GetCombatTarget If CombatTarget.GetHealthPercentage <= 0.10 CombatTarget.CIOS AlienDisintegrationFXSpell CombatTarget.kill Endif Endif End Link to comment Share on other sites More sharing options...
Jojash Posted January 20, 2014 Share Posted January 20, 2014 (edited) GetHealthPercentage applies to weapons, not NPCs. To get the percentage of health an NPC is on, you'll need to calculate it manually. To do this, you'll need to use GetAV Health, this will return the NPC's current health. You then need to get that as a percentage of their total health. Here's how I'd do that: ref rCombatTarget short iTotalHealth short iTargetHealth short iTargetHealthPerc short iDifference begin GameMode if player.GetEquipped Weapzippymoujor && player.IsInCombat if rCombatTarget != player.GetCombatTarget set rCombatTarget to player.GetCombatTarget set iTargetHealth to 0 endif if iTargetHealth < rCombatTarget.GetAV Health set iTargetHealth to rCombatTarget.GetAV Health rCombatTarget.RestoreAV Health 1000 set iDifference to rCombatTarget.GetAV Health - iTargetHealth set iTargetHealthPerc to iTargetHealth/rCombatTarget.GetAV Health set iTargetHealthPerc to iTargetHealthPerc*100 rCombatTarget.DamageAV Health iDifference endif if iTargetHealthPerc < 0.1 rCombatTarget.CIOS AlienDisintegrationSpell rCombatTarget.Kill Player; This way the player gets the XP endif endif end Edited January 20, 2014 by Jojash Link to comment Share on other sites More sharing options...
ZippyDSMlee Posted January 20, 2014 Author Share Posted January 20, 2014 GetHealthPercentage applies to weapons, not NPCs. To get the percentage of health an NPC is on, you'll need to calculate it manually. To do this, you'll need to use GetAV Health, this will return the NPC's current health. You then need to get that as a percentage of their total health. Here's how I'd do that: ref rCombatTarget short iTotalHealth short iTargetHealth short iTargetHealthPerc short iDifference begin GameMode if player.GetEquipped Weapzippymoujor && player.IsInCombat if rCombatTarget != player.GetCombatTarget set rCombatTarget to player.GetCombatTarget set iTargetHealth to 0 endif if iTargetHealth < rCombatTarget.GetAV Health set iTargetHealth to rCombatTarget.GetAV Health rCombatTarget.RestoreAV Health 1000 set iDifference to rCombatTarget.GetAV Health - iTargetHealth set iTargetHealthPerc to iTargetHealth/rCombatTarget.GetAV Health set iTargetHealthPerc to iTargetHealthPerc*100 rCombatTarget.DamageAV Health iDifference endif if iTargetHealthPerc < 0.1 rCombatTarget.CIOS AlienDisintegrationSpell rCombatTarget.Kill Player; This way the player gets the XP endif endif endDarn it why didn't they say its weapon condition only, oy it makes no sense >< That's amazing! A shame its not saving uhg what did I do to it? LOL I can not seem to spot anything out of place it has the right number of endif never saw rcombattarget before hell never seen any of the Istuff before either. If I am reading this right sets target health to zero(wont that kill the target?) then raises(raises or heals?) it to 1000 and uses 1000 as basis for 100% and when health falls below 1 point applies the disintegration effect and then ensures the target will not become invisible by killing it. Link to comment Share on other sites More sharing options...
Jojash Posted January 20, 2014 Share Posted January 20, 2014 (edited) I can not seem to spot anything out of place it has the right number of endif never saw rcombattarget before hell never seen any of the Istuff before either. It's a simply a form of notation, just something to make it clearer in longer scripts what everything is without checking what it's set as at the top each time. :smile: So, "rCombatTarget" is exactly the same as your "CombatTarget", I've just put a lower-case "r" in front to show that it's a reference. As I said, this is just a form of notation, so you don't need to do it, it just makes things clearer. The same goes for the lower case "i"s, they just show that the variable is a an integer. then raises(raises or heals?) it to 1000 and uses 1000 as basis for 100% and when health falls below 1 point applies the disintegration effect and then ensures the target will not become invisible by killing it. It doesn't go past the maximum, because RestoreAV will not surpass the maximum value of whatever actor value it's restoring. So essentially "RestoreAV Health 1000" is just a way to fully heal the target. Obviously this won't work if the target has more than 1000 health, but generally they don't. Anyway, since the target's fully healed this means that the target's maximum health is used as 100%, rather than 1000. You could use GetPermentantAV or GetBaseAV instead of restoring their health and doing everything that I'm suggesting, but that won't be quite as accurate, if they're wearing something that affects their health, for instance, then those two functions won't pick it up, whereas this method will. As for health falling below one point, no. It'll activate after it falls below 0.1%, which is what you set in your original script. Honestly, I think that's unlikely to ever be true, but since you used it originally, I'd guess that the weapon in question will be able to get it down to there or something? :smile: If I am reading this right sets target health to zero(wont that kill the target?) You're referring to "set iTargetHealth to 0"? This just sets the variable "iTargetHealth" to 0, it doesn't affect the target in any way. If you wanted to, you could replace each instance of "iTargetHealth" with something like; "SmallPlasticBag" (obviously you shouldn't do that since it would be incredibly confusing) and your script would still work in exactly the same way. and when health falls below 1 point applies the disintegration effect and then ensures the target will not become invisible by killing it. Again, I've only copy-pasted it from the script you posted, it serves whatever purpose you had in mind for it when you posted it originally. Although, yes, when the target's health falls below 0.1 percent, then the target will play the alien disintegration effect and will be killed (in this case with the optional reference of the player specified so that they will get the XP). That's amazing! A shame its not saving uhg what did I do to it? LOL If you just copy-pasted, then it doesn't have a name, also "AlienDisintegrationSpell" doesn't exist, did you mean "AlienDisintegrationFXSpell"? If you change that it ought to work. :smile: Edit: GetHealthPercentage applies to weapons, not NPCs. To get the percentage of health an NPC is on, you'll need to calculate it manually. That's not correct. GetHealthPercentage only applies to actors. Yes, I only just realised that, I was getting it mixed up with GetWeaponHealthPerc, I feel quite foolish indeed now! Thanks for pointing that out. Edited January 20, 2014 by Jojash Link to comment Share on other sites More sharing options...
rickerhk Posted January 20, 2014 Share Posted January 20, 2014 GetHealthPercentage applies to weapons, not NPCs. To get the percentage of health an NPC is on, you'll need to calculate it manually. That's not correct. GetHealthPercentage only applies to actors. http://geck.bethsoft.com/index.php?title=GetHealthPercentage The only thing I see problematic with you're original script is that getting the player's combat target may not always work. The game can't read the player's mind and I *think* it only returns a value if you see an enemies red health bar. Link to comment Share on other sites More sharing options...
ZippyDSMlee Posted January 20, 2014 Author Share Posted January 20, 2014 I can not seem to spot anything out of place it has the right number of endif never saw rcombattarget before hell never seen any of the Istuff before either. It's a simply a form of notation, just something to make it clearer in longer scripts what everything is without checking what it's set as at the top each time. :smile: So, "rCombatTarget" is exactly the same as your "CombatTarget", I've just put a lower-case "r" in front to show that it's a reference. As I said, this is just a form of notation, so you don't need to do it, it just makes things clearer. The same goes for the lower case "i"s, they just show that the variable is a an integer.[/qoute] then raises(raises or heals?) it to 1000 and uses 1000 as basis for 100% and when health falls below 1 point applies the disintegration effect and then ensures the target will not become invisible by killing it. It doesn't go past the maximum, because RestoreAV will not surpass the maximum value of whatever actor value it's restoring. So essentially "RestoreAV Health 1000" is just a way to fully heal the target. Obviously this won't work if the target has more than 1000 health, but generally they don't. Anyway, since the target's fully healed this means that the target's maximum health is used as 100%, rather than 1000. You could use GetPermentantAV or GetBaseAV instead of restoring their health and doing everything that I'm suggesting, but that won't be quite as accurate, if they're wearing something that affects their health, for instance, then those two functions won't pick it up, whereas this method will. As for health falling below one point, no. It'll activate after it falls below 0.1%, which is what you set in your original script. Honestly, I think that's unlikely to ever be true, but since you used it originally, I'd guess that the weapon in question will be able to get it down to there or something? :smile: If I am reading this right sets target health to zero(wont that kill the target?) You're referring to "set iTargetHealth to 0"? This just sets the variable "iTargetHealth" to 0, it doesn't affect the target in any way. If you wanted to, you could replace each instance of "iTargetHealth" with something like; "SmallPlasticBag" (obviously you shouldn't do that since it would be incredibly confusing) and your script would still work in exactly the same way. and when health falls below 1 point applies the disintegration effect and then ensures the target will not become invisible by killing it. Again, I've only copy-pasted it from the script you posted, it serves whatever purpose you had in mind for it when you posted it originally. Although, yes, when the target's health falls below 0.1 percent, then the target will play the alien disintegration effect and will be killed (in this case with the optional reference of the player specified so that they will get the XP). That's amazing! A shame its not saving uhg what did I do to it? LOL If you just copy-pasted, then it doesn't have a name, also "AlienDisintegrationSpell" doesn't exist, did you mean "AlienDisintegrationFXSpell"? If you change that it ought to work. :smile: Edit: GetHealthPercentage applies to weapons, not NPCs. To get the percentage of health an NPC is on, you'll need to calculate it manually. That's not correct. GetHealthPercentage only applies to actors. Yes, I only just realised that, I was getting it mixed up with GetWeaponHealthPerc, I feel quite foolish indeed now! Thanks for pointing that out. I see. Just trying to figure it out in my head, thank you for your time and the explanation. Ggaaa spelling mistakes are my bane if they do not keep me busy the other half the time its simple scripting things. I was thinking that having it focus on combat target it would lock the gethealthpercentage to the combat targets. But I have learned you have to be very specific in order to pull off certain things otherwise it wants repeat the function calls more than once per target. I really wish they had more script examples. That way I would not be so lost. I got a question how dose getlastcritcal work? I tried using it set to combattarget but it did not work it would save but not work in game. One of my problems with this dumb weapon I am making is it dose an explosion on critical hit that's the easy part, getting disintegration to work with it is outside my pay grade. I have used random for it and put disintegration on critical but I would rather have the explosion set to critical so it can be more character build type specific. Of course I dunno why I bother its a bleeding novelty weapon like every other thing I make but still I guess I can a perfectionist LOL. Thank you all again ====================== And now to be a complete bother. If piped through the explosion via on critical it kicks in disintegration randomly even on un damaged targets. If piped though object effect its instant disintegration.If piped though weapon script after 2-3 seconds after a hit disintegration kicks in. I swear the game hates me LOL Link to comment Share on other sites More sharing options...
Jojash Posted January 20, 2014 Share Posted January 20, 2014 (edited) I got a question how dose getlastcritcal work? As I understand it, GetLastHitCritical will return true if the last shot fired (or blow landed in the case of a melee weapon) was a critical hit. According to the wiki, it can only be called in an OnHit block. For example: begin OnHit if GetLastHitCritical ; Do Stuff endif endIf the last hit was a critical, the condition will return true. However, you want to do stuff to the reference you hit, no? For that, you'll need to use GetOwnerLastTarget too. Something like: ref rTarget begin OnHit set rTarget to GetOwnerLastTarget if GetLastHitCritical && rTarget.GetHealthPercentage < 0.1 rTarget.CIOS AlienDisintegrationFXSpell rTarget.Kill player endif endThis script ought to play the disintegration FX when your target is on 10% of their maximum HP and you get a critical hit off on them. I'm not sure if you're still trying to do it that way, but if you want it just to trigger on critical hits, just get rid of rTarget.GetHealthPercentage < 0.1, or vice versa if you want it to trigger on low health instead. If piped though weapon script after 2-3 seconds after a hit disintegration kicks in. Is this the same script as before, or have you changed it? it wants repeat the function calls more than once per target. It will repeat the function regardless of whom the target is, even if it's been called on them twenty or thirty times already, if it didn't, you wouldn't be able to detect the changes in their health. I was thinking that having it focus on combat target it would lock the gethealthpercentage to the combat targets. I'm not sure that I follow here, you're checking the player's combat target's health each time. The line "If CombatTarget.GetHealthPercentage <= 0.10" (from your original script) tells you what their health is. You wouldn't want to lock that function, if you did, you couldn't detect changes in health as I stated previously. GetHealthPercentage is only going to run on your targets, since they're the only ones (with the reference "CombatTarget") you've specified. Anyway, best of luck! Edited January 20, 2014 by Jojash Link to comment Share on other sites More sharing options...
ZippyDSMlee Posted January 20, 2014 Author Share Posted January 20, 2014 I got a question how dose getlastcritcal work? As I understand it, GetLastHitCritical will return true if the last shot fired (or blow landed in the case of a melee weapon) was a critical hit. According to the wiki, it can only be called in an OnHit block. For example: begin OnHit if GetLastHitCritical ; Do Stuff endif endIf the last hit was a critical, the condition will return true. However, you want to do stuff to the reference you hit, no? For that, you'll need to use GetOwnerLastTarget too. Something like: ref rTarget begin OnHit set rTarget to GetOwnerLastTarget if GetLastHitCritical && rTarget.GetHealthPercentage < 0.1 rTarget.CIOS AlienDisintegrationFXSpell rTarget.Kill player endif endThis script ought to play the disintegration FX when your target is on 10% of their maximum HP and you get a critical hit off on them. I'm not sure if you're still trying to do it that way, but if you want it just to trigger on critical hits, just get rid of rTarget.GetHealthPercentage < 0.1, or vice versa if you want it to trigger on low health instead.I see that explains a few things. I tried placing an explosion at the player but it did not want to summon it. Probly using placeatme wrong >< ref rTarget begin OnHit set rTarget to GetOwnerLastTarget if GetLastHitCritical Player.PlaceAtMe zippynullGrenadePulseExplosionfake 1 endif end Is this the same script as before, or have you changed it?No I cut and pasted it only changing the spellfx on the aliendisintegration, and I cut and pasted its name to be sure I did not screw it up. ref rCombatTarget short iTotalHealth short iTargetHealth short iTargetHealthPerc short iDifference begin GameMode if player.GetEquipped Weapzippymoujor && player.IsInCombat if rCombatTarget != player.GetCombatTarget set rCombatTarget to player.GetCombatTarget set iTargetHealth to 0 endif if iTargetHealth < rCombatTarget.GetAV Health set iTargetHealth to rCombatTarget.GetAV Health rCombatTarget.RestoreAV Health 1000 set iDifference to rCombatTarget.GetAV Health - iTargetHealth set iTargetHealthPerc to iTargetHealth/rCombatTarget.GetAV Health set iTargetHealthPerc to iTargetHealthPerc*100 rCombatTarget.DamageAV Health iDifference endif if iTargetHealthPerc < 0.1 rCombatTarget.CIOS AlienDisintegrationFXSpell rCombatTarget.Kill Player; This way the player gets the XP endif endif end Saves fine but in game its a tad screwy, disintegration is random and exp is 3 or 4 times what it should be. I have script extender and using godmode to test it on deathclaws, could that bring up any bugs? I can take a video put it on youtube and show you what I mean, just to be sure I double checked everything and it is calling to the right script and stuff and I tried it again through critical,weapon script and object effect still no luck. I'll keep trying to see what on my end could be messing with it maybe I should close geck for once LOL. It will repeat the function regardless of whom the target is, even if it's been called on them twenty or thirty times already, if it didn't, you wouldn't be able to detect the changes in their health. I meant an older script I was trying to hobble together I had it set to combattargt.getdead and for a few seconds after a target died it reapplied the disintegration effect with each hit of the weapon on other targets with or without a radius or time set. I'm not sure that I follow here, you're checking the player's combat target's health each time. The line "If CombatTarget.GetHealthPercentage <= 0.10" (from your original script) tells you what their health is. You wouldn't want to lock that function, if you did, you couldn't detect changes in health as I stated previously. GetHealthPercentage is only going to run on your targets, since they're the only ones (with the reference "CombatTarget") you've specified. Anyway, best of luck! I see. Thanks again for the information! Link to comment Share on other sites More sharing options...
Jojash Posted January 20, 2014 Share Posted January 20, 2014 (edited) Saves fine but in game its a tad screwy, disintegration is random and exp is 3 or 4 times what it should be As rickerhk was kind enough to point out, I was completely wrong about GetHealthPercentage (honestly I didn't know that function existed, which made me think it was GetWeaponHealthPerc), so most of that script is redundant. (Just me being stupid.) I have script extender and using godmode to test it on deathclaws, could that bring up any bugs? None that I can think of, since all of the functions here would affect the deathclaws, and not the player. I tried it again through critical,weapon script and object effect still no luck. Have you tried the script I posted with my last reply? Scn DisintegrateWeaponScript begin OnHit set rTarget to GetOwnerLastTarget if GetLastHitCritical && rTarget.GetHealthPercentage < 0.1 rTarget.CIOS AlienDisintegrationFXSpell rTarget.Kill player endif end Edited January 20, 2014 by Jojash Link to comment Share on other sites More sharing options...
jazzisparis Posted January 20, 2014 Share Posted January 20, 2014 GetCombaTarget only returns a value if the crosshair is currently pointed at a live actor, who is within a distance (from the player) defined by the game setting fAutoAimMaxDistance. The latter's default value is 1800 game units, and that's pretty short (roughly 28 feet). You may want to try setting fAutoAimMaxDistance to 8192 (which is the maximum effective distance). Link to comment Share on other sites More sharing options...
Recommended Posts