Jump to content

Vampire Feeding Damage


SoulLimit

Recommended Posts

Hi,

 

I am trying to make it so that when the player feeds, the victim looses a percentage of their health (depending on the vampire rank the player is at), but it just does not seem to work..

 

I'm not sure where i am going wrong, so i have posted my code here in the hope someone can see what i have done wrong.

 

Below is the vampire feed script

 

The part enlarged and bold is the part that try's to harm the target

 

Function VampireFeed(Actor akTarget)

float tempPercentageDamage

;Effects for hiding the change

;VampireChangeFX.play(game.getPlayer())

VampireTransformDecreaseISMD.applyCrossFade(2.0)

utility.wait(2.0)

imageSpaceModifier.removeCrossFade()

;VampireChangeFX.stop(game.getPlayer())

 

Game.IncrementStat( "Necks Bitten" )

VampireFeedMessage.Show()

VampireFeedReady.SetValue(0)

 

; What is the targets current health and damage amount?

Float TargetsHealth = akTarget.GetBaseActorValue("Health") as Float

If VampireStatus == 1

tempPercentageDamage = 25

ElseIf VampireStatus == 2

tempPercentageDamage = 40

ElseIf VampireStatus == 3

tempPercentageDamage = 55

ElseIf VampireStatus == 4

tempPercentageDamage = 70

EndIf

;Calculate Damage to do to the target

float TargetDamage = TargetsHealth * (tempPercentageDamage/100)

 

;Damage target by calculated amount

akTarget.DamageActorValue("Health",TargetDamage)

;Game.GetPlayer().DamageActorValue("Health", TargetDamage)

 

;Heal the player by the same amount of health

Game.GetPlayer().RestoreActorValue("Health",TargetDamage)

 

;Game.ForceThirdPerson()

;Game.GetPlayer().PlayIdle(VampireFeedingBedRight)

;Player has fed, regress to Stage 1 Vampirisim

;Remove Stage 2, 3, and 4 buffs and spells

LastFeedTime = GameDaysPassed.Value

VampireStatus = 1

VampireProgression(Game.GetPlayer(), 1)

;Player is no longer hated

Game.GetPlayer().RemoveFromFaction(VampirePCFaction)

Game.GetPlayer().SetAttackActorOnSight(False)

 

int cfIndex = 0

while (cfIndex < CrimeFactions.GetSize())

; Debug.Trace("VAMPIRE: Removing enemy flag from " + CrimeFactions.GetAt(cfIndex))

(CrimeFactions.GetAt(cfIndex) as Faction).SetPlayerEnemy(false)

cfIndex += 1

endwhile

 

;Start checking GameTime again if we weren't already

UnregisterforUpdateGameTime()

RegisterForUpdateGameTime(12)

 

 

EndFunction

 

Thanks in advance

Edited by SoulLimit
Link to comment
Share on other sites

  • Recently Browsing   0 members

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