Jump to content
  • Announcements

    • AndalayBay

      Orphan Attachments   07/31/2018

      I have been doing some housekeeping lately and I've noticed that I had a lot of orphaned attachments. Attachments get orphaned when the PM or post is deleted without removing the attachment first. Deleting a PM or post does not delete the attachment and the file or image remain on the server. I'd like to ask all members to go through their attachments and delete any attachments you don't need anymore or those that have been orphaned. Where can I get a list of my attachments? Click on your display name in the upper right corner of the forums and pick "My Attachments" from the drop-down list. How can I tell an attachment is orphaned? If the PM has been deleted, you'll see a message like this in your attachment list: Unfortunately there is no message if the post has been deleted, so please check your old posts. We do purge old birthday threads every once in a while. Also some hosted projects have been shut down, so you may have orphaned attachments on one of those locations. Thanks!
LID919

Scripting Help for Vampire Feed Power

Recommended Posts

I got the whole thing working out. For future reference for anyone looking to accomplish something similar, here is what I did to blame the player of a killing, without making it a crime.

 

I set up a quest script with variables "prevCrimeGold" and "Run". When the player is undetected, I set prevCrimeGold to the player's current crime gold, make the kill, then set run to 1. The quest script then runs, and sets the players crime gold to their previous crime gold three times. I ran it three times because running it once sometimes missed the timing of the game's crime detection script, and the 1000 murder bounty would be added after the quest script ran.

 

This solution is not perfect, I could see problems arising if you force feed then go on a crime spree in the six seconds of the crimeWatch script's runtime, but it works well enough so far.

 

The force feed script looks like:

 

 

 

scriptname LIDForceFeedScript

Short TargetOdds
Short PlayerOdds
Short cleanCrime

Begin ScriptEffectStart

    If GetFactionRank VampireFaction == -1 && GetRace != VampireRace && (GetRace == Argonian || GetRace == Breton || GetRace == Nord || GetRace == Imperial || GetRace == Redguard || GetRace == DarkElf || GetRace == HighElf || GetRace == WoodElf || GetRace == Khajiit)

        Set TargetOdds to -1

        If getSleeping
            
            if player.isActorDetected == 0
                set LIDVampireCrimeWatch.prevCrimeGold to player.getCrimeGold
                set CleanCrime to 1
            endif
            kill player
                    

            If Vampire.FedBefore == 0
                messagebox "As blood drips from your lips and you stare at the dessecrated carcas beneath you, you realize what kind of monster you have become. You realize fully the truth to the whispers of... Vampire."
            Else
                messagebox "You leave no drop undrank."
            EndIf

        Else

            Set PlayerOdds To Player.GetAv strength + Player.GetAv Agility

            If Player.IsActorDetected == 0
                Set LIDVampireCrimeWatch.PrevCrimeGold to Player.GetCrimeGold
                Set CleanCrime to 1
            EndIf

            If GetDetectionLevel Player < 2

                Set TargetOdds To GetAv Strength
                ;Set Vampire.PrevCrimeGold to Player.getCrimeGold

            Else

                Set TargetOdds To GetAv Strength + (GetAv Health * 2)

            EndIf

            If TargetOdds != -1
            
                If PlayerOdds >= TargetOdds

                    kill player
                
                    playsound NPCHumanVampireFeed
                
                    ;Reset Vampirism level to 100 and start the counters over again

                    If ( PCVampire >= 1 )
                
                        Set PCVampire to 1

                        ;remove any spells from lower states

                        Player.removespell Vampirism50Player
                        Player.removespell Vampirism50Att0
                        Player.removespell Vampirism50Att10
                        Player.removespell Vampirism50Att20
                        Player.removespell Vampirism50Att30
                        Player.removespell Vampirism50Skills0
                        Player.removespell Vampirism50Skills10
                        Player.removespell Vampirism50Skills20
                        Player.removespell Vampirism50Skills30
                        Player.removeSpell LIDVampireScentOfBlood50
                        Player.removespell Vampirism75Player
                        Player.removespell Vampirism75Att0
                        Player.removespell Vampirism75Att10
                        Player.removespell Vampirism75Att20
                        Player.removespell Vampirism75Att30
                        Player.removespell Vampirism75Skills0
                        Player.removespell Vampirism75Skills10
                        Player.removespell Vampirism75Skills20
                        Player.removespell Vampirism75Skills30
                        Player.removeSpell LIDVampireScentOfBlood75
                        Player.removespell Vampirism25Player
                        Player.removespell Vampirism25Att0
                        Player.removespell Vampirism25Att10
                        Player.removespell Vampirism25Att20
                        Player.removespell Vampirism25Att30
                        Player.removespell Vampirism25Skills0
                        Player.removespell Vampirism25Skills10
                        Player.removespell Vampirism25Skills20
                        Player.removespell Vampirism25Skills30
                        Player.removeSpell LIDVampireScentOfBlood25

                        ;re-add level 100 spells

                        Player.addspell Vampirism100Player

                        If Player.getlevel >= 30
                            Player.addspell Vampirism100Att30
                            Player.addspell Vampirism100Skills30
                        ElseIf Player.getlevel >= 20
                            Player.addspell Vampirism100Att20
                            Player.addspell Vampirism100Skills20
                        ElseIf Player.getlevel >= 10
                            Player.addspell Vampirism100Att10
                            Player.addspell Vampirism100Skills10
                        Else
                            Player.addspell Vampirism100Att0
                            Player.addspell Vampirism100Skills0
                        EndIf

                        Player.addspell VampireEmbraceofShadows
                        Player.addspell VampireReignofTerror
                        Player.addspell VampireSeduction
                        Player.addspell LIDVampireScentOfBlood100
                        set Vampire.vampday to GameDay
                        set Vampire.vamphour to GameHour

                        If Vampire.FedBefore == 0
            
                            MessageBox "As blood drips from your lips and you stare at the desecrated carcass beneath you, you realize what kind of monster you have become. You realize fully the truth to the whispers of. . . Vampire."
                            Set Vampire.FedBefore to 1
                        EndIf    

                    EndIf

                    If CleanCrime

                        Set LIDVampireCrimeWatch.Run to 1
                        Set CleanCrime to 0
                    EndIf

                Else

                    StartCombat Player

                    if getAv responsibility >= 30
                    Player.modcrimegold 1000
                    endif

                EndIf

            EndIf

        EndIf

    EndIf
    
End 

 

 

 

 

And the crime watch script looks like:

 

 

 

ScriptName LIDVampireCrimeWatchScript

Short DoOnce
Short PrevCrimeGold
Short FQuestDelayTime
Short Run
Short Counter
Short G
Short Debug


Begin GameMode

    if DoOnce == 0
        Set FQuestDelayTime To 2
        Set DoOnce to 1
    EndIf

    If Debug
        PrintC "CrimeWatchUpdate:"
        PrintC "Running Status: %g",Run
        Set G to Player.GetCrimeGold
        PrintC "Current player crime gold: %g",G
        PrintC "PreviousCrimeGoldVariable: %g",PrevCrimeGold
    EndIf

    If Run == 1
        Player.SetCrimeGold PrevCrimeGold
        If Counter == 2
            Set Run to 0
            Set Counter to 0
        Else
            Set Counter to Counter + 1
        EndIf
    EndIf

End 

 

 

 

So there's that.

 

Original Post:

 

 

 

I have a small vampirism tweaks mod I am working on. One of the abilities I have been trying to add is a power to allow the vampire to kill victims by feeding, both asleep and awake. The script for this currently looks like this:

 

 

 

scriptname LIDForceFeedScript

Short TargetOdds
Short PlayerOdds
Short Sneak

Begin ScriptEffectStart

	If GetFactionRank CreatureFaction == -1 && GetFactionRank UndeadFaction == -1 && GetFactionRank DremoraFaction == -1 && GetFactionRank VampireFaction == -1;TODO: Check by race, this is unreliable.

		Set TargetOdds to -1
		Set Sneak to 0

;TODO: Insta kill if they are sleeping. Detecting AI package is too unreliable, need to find a better method.

		Set PlayerOdds To Player.GetAv Strength + Player.GetAv Agility

		If Player.IsSneaking && Player.IsActorDetected == 1

			Set TargetOdds To GetAv Strength
			Set Sneak To 1

		Else

			Set TargetOdds To GetAv Strength + GetAv Health

		EndIf

		If TargetOdds != -1
			
			If PlayerOdds >= TargetOdds
				
				If Sneak
					Kill player ; This was just "kill", but that lead to detection issues for the game.
				Else
					kill player
				Endif

				playsound NPCHumanVampireFeed
				
				;Reset Vampirism level to 100 and start the counters over again

				If ( PCVampire >= 1 )
				
					Set PCVampire to 1

					;remove any spells from lower states

					Player.removespell Vampirism50Player
					Player.removespell Vampirism50Att0
					Player.removespell Vampirism50Att10
					Player.removespell Vampirism50Att20
					Player.removespell Vampirism50Att30
					Player.removespell Vampirism50Skills0
					Player.removespell Vampirism50Skills10
					Player.removespell Vampirism50Skills20
					Player.removespell Vampirism50Skills30
					Player.removeSpell LIDVampireScentOfBlood50
					Player.removespell Vampirism75Player
					Player.removespell Vampirism75Att0
					Player.removespell Vampirism75Att10
					Player.removespell Vampirism75Att20
					Player.removespell Vampirism75Att30
					Player.removespell Vampirism75Skills0
					Player.removespell Vampirism75Skills10
					Player.removespell Vampirism75Skills20
					Player.removespell Vampirism75Skills30
					Player.removeSpell LIDVampireScentOfBlood75
					Player.removespell Vampirism25Player
					Player.removespell Vampirism25Att0
					Player.removespell Vampirism25Att10
					Player.removespell Vampirism25Att20
					Player.removespell Vampirism25Att30
					Player.removespell Vampirism25Skills0
					Player.removespell Vampirism25Skills10
					Player.removespell Vampirism25Skills20
					Player.removespell Vampirism25Skills30
					Player.removeSpell LIDVampireScentOfBlood25

					;re-add level 100 spells

					Player.addspell Vampirism100Player

					If Player.getlevel >= 30
						Player.addspell Vampirism100Att30
						Player.addspell Vampirism100Skills30
					ElseIf Player.getlevel >= 20
						Player.addspell Vampirism100Att20
						Player.addspell Vampirism100Skills20
					ElseIf Player.getlevel >= 10
						Player.addspell Vampirism100Att10
						Player.addspell Vampirism100Skills10
					Else
						Player.addspell Vampirism100Att0
						Player.addspell Vampirism100Skills0
					EndIf

					Player.addspell VampireEmbraceofShadows
					Player.addspell VampireReignofTerror
					Player.addspell VampireSeduction
					Player.addspell LIDVampireScentOfBlood100
					set Vampire.vampday to GameDay
					set Vampire.vamphour to GameHour

					If Vampire.FedBefore == 0
						MessageBox "As blood drips from your lips and you stare at the desecrated carcass beneath you, you realize what kind of monster you have become. You realize fully the truth to the whispers of. . . Vampire."
						Set Vampire.FedBefore to 1
					EndIf	

				EndIf

			Else

				StartCombat Player

			EndIf

		EndIf

	EndIf
	
End

 

 

 

My problems are:

 

I have yet to discover a reliable method of detecting if the target is asleep. I wanted to display a different message for sleeping targets, as well as guarantee the kill, but I could not determine a method of detecting that an opponent is sleeping. EDIT: Solution provided by AndalayBay

 

 

Currently, while sneaking and undetected, if I kill a target with this power, I get a bounty and everyone freaks out. I originally remedied this by changing the "kill player" to just "kill", but this lead to the issue that, since the kill was not assigned to the player at all, quest flags did not trip, like starting the Dark Brotherhood, or getting XP in Oblivion XP. I suspect I could have further issues as well if the kill is not assigned to the player. I tried detecting the currently running AI package, but when I tested on a guard at his post, the instant kill was triggered, while previously the guard would not have died.

 

The script is currently attached to an on touch lesser power.

 

Anyone have advice for my issues?

 

 

Edited by LID919

Share this post


Link to post
Share on other sites

For the sleeping issue, use GetSleeping. For the detection issue, I think you're going to have to override the normal behaviour through scripting. You could try asking in the CS forums and see if anyone has any ideas.

Share this post


Link to post
Share on other sites

For the sleeping issue, use GetSleeping. For the detection issue, I think you're going to have to override the normal behaviour through scripting. You could try asking in the CS forums and see if anyone has any ideas.

 

Thank you. My Google-Fu must be getting rusty, because I never found any references to "GetSleeping", I'll try harder next time.

Share this post


Link to post
Share on other sites

I just go to the CS wiki and use the built in search. It was broken for a bit, but Beth fixed it.

Share this post


Link to post
Share on other sites

I got the whole thing working out. For future reference for anyone looking to accomplish something similar, here is what I did for the Crime portion.

 

I set up a quest script with variables "prevCrimeGold" and "Run". When the player is undetected, I set prevCrimeGold to the player's current crime gold, make the kill, then set run to 1. The quest script then runs, and sets the players crime gold to their previous crime gold three times. I ran it three times because running it once sometimes missed the timing of the game's crime detection script, and the 1000 murder bounty would be added after the quest script ran.

 

This solution is not perfect, I could see problems arising if you force feed then go on a crime spree in the six seconds of the crimeWatch script's runtime, but it works well enough so far.

 

The force feed script looks like:

 

 

 

scriptname LIDForceFeedScript

Short TargetOdds
Short PlayerOdds
Short cleanCrime

Begin ScriptEffectStart

	If GetFactionRank VampireFaction == -1 && GetRace != VampireRace && (GetRace == Argonian || GetRace == Breton || GetRace == Nord || GetRace == Imperial || GetRace == Redguard || GetRace == DarkElf || GetRace == HighElf || GetRace == WoodElf || GetRace == Khajiit)

		Set TargetOdds to -1

		If getSleeping
			
			if player.isActorDetected == 0
				set LIDVampireCrimeWatch.prevCrimeGold to player.getCrimeGold
				set CleanCrime to 1
			endif
			kill player
					

			If Vampire.FedBefore == 0
				messagebox "As blood drips from your lips and you stare at the dessecrated carcas beneath you, you realize what kind of monster you have become. You realize fully the truth to the whispers of... Vampire."
			Else
				messagebox "You leave no drop undrank."
			EndIf

		Else

			Set PlayerOdds To Player.GetAv strength + Player.GetAv Agility

			If Player.IsActorDetected == 0
				Set LIDVampireCrimeWatch.PrevCrimeGold to Player.GetCrimeGold
				Set CleanCrime to 1
			EndIf

			If GetDetectionLevel Player < 2

				Set TargetOdds To GetAv Strength
				;Set Vampire.PrevCrimeGold to Player.getCrimeGold

			Else

				Set TargetOdds To GetAv Strength + (GetAv Health * 2)

			EndIf

			If TargetOdds != -1
			
				If PlayerOdds >= TargetOdds

					kill player
				
					playsound NPCHumanVampireFeed
				
					;Reset Vampirism level to 100 and start the counters over again

					If ( PCVampire >= 1 )
				
						Set PCVampire to 1

						;remove any spells from lower states

						Player.removespell Vampirism50Player
						Player.removespell Vampirism50Att0
						Player.removespell Vampirism50Att10
						Player.removespell Vampirism50Att20
						Player.removespell Vampirism50Att30
						Player.removespell Vampirism50Skills0
						Player.removespell Vampirism50Skills10
						Player.removespell Vampirism50Skills20
						Player.removespell Vampirism50Skills30
						Player.removeSpell LIDVampireScentOfBlood50
						Player.removespell Vampirism75Player
						Player.removespell Vampirism75Att0
						Player.removespell Vampirism75Att10
						Player.removespell Vampirism75Att20
						Player.removespell Vampirism75Att30
						Player.removespell Vampirism75Skills0
						Player.removespell Vampirism75Skills10
						Player.removespell Vampirism75Skills20
						Player.removespell Vampirism75Skills30
						Player.removeSpell LIDVampireScentOfBlood75
						Player.removespell Vampirism25Player
						Player.removespell Vampirism25Att0
						Player.removespell Vampirism25Att10
						Player.removespell Vampirism25Att20
						Player.removespell Vampirism25Att30
						Player.removespell Vampirism25Skills0
						Player.removespell Vampirism25Skills10
						Player.removespell Vampirism25Skills20
						Player.removespell Vampirism25Skills30
						Player.removeSpell LIDVampireScentOfBlood25

						;re-add level 100 spells

						Player.addspell Vampirism100Player

						If Player.getlevel >= 30
							Player.addspell Vampirism100Att30
							Player.addspell Vampirism100Skills30
						ElseIf Player.getlevel >= 20
							Player.addspell Vampirism100Att20
							Player.addspell Vampirism100Skills20
						ElseIf Player.getlevel >= 10
							Player.addspell Vampirism100Att10
							Player.addspell Vampirism100Skills10
						Else
							Player.addspell Vampirism100Att0
							Player.addspell Vampirism100Skills0
						EndIf

						Player.addspell VampireEmbraceofShadows
						Player.addspell VampireReignofTerror
						Player.addspell VampireSeduction
						Player.addspell LIDVampireScentOfBlood100
						set Vampire.vampday to GameDay
						set Vampire.vamphour to GameHour

						If Vampire.FedBefore == 0
			
							MessageBox "As blood drips from your lips and you stare at the desecrated carcass beneath you, you realize what kind of monster you have become. You realize fully the truth to the whispers of. . . Vampire."
							Set Vampire.FedBefore to 1
						EndIf	

					EndIf

					If CleanCrime

						Set LIDVampireCrimeWatch.Run to 1
						Set CleanCrime to 0
					EndIf

				Else

					StartCombat Player

					if getAv responsibility >= 30
					Player.setcrimegold 1000
					endif

				EndIf

			EndIf

		EndIf

	EndIf
	
End 

 

 

 

 

And the crime watch script looks like:

 

 

 

ScriptName LIDVampireCrimeWatchScript

Short DoOnce
Short PrevCrimeGold
Short FQuestDelayTime
Short Run
Short Counter
Short G
Short Debug


Begin GameMode

	if DoOnce == 0
		Set FQuestDelayTime To 2
		Set DoOnce to 1
	EndIf

	If Debug
		PrintC "CrimeWatchUpdate:"
		PrintC "Running Status: %g",Run
		Set G to Player.GetCrimeGold
		PrintC "Current player crime gold: %g",G
		PrintC "PreviousCrimeGoldVariable: %g",PrevCrimeGold
	EndIf

	If Run == 1
		Player.SetCrimeGold PrevCrimeGold
		If Counter == 2
			Set Run to 0
			Set Counter to 0
		Else
			Set Counter to Counter + 1
		EndIf
	EndIf

End 

 

 

 

So there's that.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×