Jump to content

GetHealthPercentage not working right.


ZippyDSMlee

Recommended Posts

 

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

 

 

 

 

No luck, all I get is the aliendisintegrationfxspell sound on each hit. Even tried removing && rTarget.GetHealthPercentage < 0.1 and it did not change any.

 

 

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).

That might be something to think about once I get the script gods let me find a trigger function that works. LOL

Link to comment
Share on other sites

Alright, I've done some testing and I cannot for the life of me get GetLastHitCritical to work. I'm sure I've misunderstood something when reading its description on the wiki. Regardless if you're content for the effect to trigger just when your enemy is on 10% of their health the following script worked for me:

 

 

 

 

 

Scn DisintegrateWeaponScript

ref rTarget

begin OnHit
 
    set rTarget to GetOwnerLastTarget
    if rTarget.GetHealthPercentage < 0.1 && rTarget.GetDead == 0
        rTarget.Kill player
        rTarget.CIOS AlienDisintegrationFXSpell
    endif
end

 

 

 

Anyway, I wish you good luck!

Link to comment
Share on other sites

Alright, I've done some testing and I cannot for the life of me get GetLastHitCritical to work. I'm sure I've misunderstood something when reading its description on the wiki. Regardless if you're content for the effect to trigger just when your enemy is on 10% of their health the following script worked for me:

 

 

 

 

 

Scn DisintegrateWeaponScript

ref rTarget

begin OnHit
 
    set rTarget to GetOwnerLastTarget
    if rTarget.GetHealthPercentage < 0.1 && rTarget.GetDead == 0
        rTarget.Kill player
        rTarget.CIOS AlienDisintegrationFXSpell
    endif
end

 

 

 

Anyway, I wish you good luck!

 

 

I tweaked it a bit to allow for the exp gained to be based on the players level,ect. For some strange reason I was getting 2X the exp on kills that disintegrated.

ref rTarget

begin OnHit
 
    set rTarget to GetOwnerLastTarget
    if rTarget.GetHealthPercentage < 0.1 && rTarget.GetDead == 0
        rTarget.DamageActorValue Health 900
        rTarget.CIOS AlienDisintegrationFXSpell
    endif
end

As a weapon script its working to a satisfactory level and all I can say is thank you!!!!!!!

 

I'm glad I was not the only one having trouble with getlasthitcritcal !

 

thankyou!!thankyou!!thankyou!!thankyou!!thankyou!!thankyou!!thankyou!!thankyou!!thankyou!!thankyou!!thankyou!!thankyou!!thankyou!!thankyou!!thankyou!! LOL

 

Now time for clean up I have a ton of dup's to get rid of >< LOL

Link to comment
Share on other sites

I tweaked it a bit to allow for the exp gained to be based on the players level,ect. For some strange reason I was getting 2X the exp on kills that disintegrated.

 

 

You killed them when you shot them and the script killed them again. GetDead ought to have fixed that.

 

Anyway, best of luck!

Edited by Jojash
Link to comment
Share on other sites

 

I tweaked it a bit to allow for the exp gained to be based on the players level,ect. For some strange reason I was getting 2X the exp on kills that disintegrated.

 

 

You killed them when you shot them and the script killed them again. GetDead ought to have fixed that.

 

Anyway, best of luck!

 

Ah. Do you deal with functions/conditions in the object effect/enchantment much? I managed to make the player immune to the damage and knockback of the critical hit explosion. I am now trying to fig out how to make those in the player faction immune. Or is there a function that targets only hostile targets?

 

 

Thanks again for all the help!

Edited by ZippyDSMlee
Link to comment
Share on other sites

I am now trying to fig out how to make those in the player faction immune.

 

 

You can check who's in the player faction with the function GetInFaction.

 

Or is there a function that targets only hostile targets?

 

 

To check if NPCs are hostile to the player you'll need to use GetActorFactionPlayerEnemy and GetActorCrimeplayerEnemy

 

I think you'll want to use the former, but I can't really give you any more help than that without seeing the script you're using to do this.

Edited by Jojash
Link to comment
Share on other sites

 

I am now trying to fig out how to make those in the player faction immune.

 

 

You can check who's in the player faction with the function GetInFaction.

 

Or is there a function that targets only hostile targets?

 

 

To check if NPCs are hostile to the player you'll need to use GetActorFactionPlayerEnemy and GetActorCrimeplayerEnemy

 

I think you'll want to use the former, but I can't really give you any more help than that without seeing the script you're using to do this.

 

I'll try a few of them. Thanks!

 

If the idea is to check whether the target is a player's follower, simply use if rTarget.GetPlayerTeammate.

To check whether the target is hostile or not, use if rTarget.GetShouldAttack player > 0.

 

Ah that worked well thank you so much!

 

 

------

Now on to make a steampunk light saber. Vertex colors how I hate you......

Link to comment
Share on other sites

  • Recently Browsing   0 members

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