Jump to content

Detecting kill number


kieranfoy

Recommended Posts

Well, I've been working on a script for a sword, and I've gotten this so far:

 

begin ondeath

 

playsound ambvoicesinheadlp

 

message "The blade has consumed another soul..."

 

player.modav health 10

 

end

 

I was wondering if there was some way for it to detect how many creatures and NPC's it had killed, and have the message box say "The sword has killed X people."

 

Any help'd be appreciatred.

Link to comment
Share on other sites

Have you examined the Shivering Isles Dawnfang/Duskfang scripts? Some of the techniques might be applicable to what you are trying to do.

 

scn SEDuskfangSpellEffectScript

ref Target
ref self

short KillingBlow

begin ScriptEffectStart

set KillingBlow to 0
set target to GetSelf
set self to GetSelf

end

begin ScriptEffectUpdate

if ( KillingBlow == 0 )
	if ( Target.GetDead == 1 )
		if ( SESwordDuskfangKills < 1 )
			Set SESwordDuskfangKills to ( SESwordDuskfangKills + 1 )
			Message "Duskfang has extinguished %.0f life.", SESwordDuskfangKills
			Set KillingBlow to 1
		elseif ( SESwordDuskfangKills >= 1 ) && ( SESwordDuskfangKills < 11 )
			Set SESwordDuskfangKills to ( SESwordDuskfangKills + 1 )
			Message "Duskfang has extinguished %.0f lives.", SESwordDuskfangKills
			Set KillingBlow to 1
		elseif ( SESwordDuskfangKills == 11 )
			Set SESwordDuskfangKills to ( SESwordDuskfangKills + 1 )
			Message "Duskfang's bloodthirst has been quenched."
			Set KillingBlow to 1
		elseif ( SESwordDuskfangKills >= 12 )
			Set KillingBlow to 1
		endif
	endif
endif

end 

Link to comment
Share on other sites

Unfortunately, I'm a n00b modder, so figuring that out is far beyond me. Sort of why I'm begging for help in the first place. My no knows teh scripting-zorz.

 

Here's the fulls cript:

 

scn aaebonflamescript

 

begin scripteffectstart

 

ref target

 

target.playmagicshadervisuals 1blackflame 10

 

end

 

begin ondeath

 

player.playsound ambvoicesinheadlp

 

message "The blade has consumed another soul..."

 

player.modav health 10

 

 

end

 

Problem is, the second half isn't working, either. I don't suppose anyone has some troubleshooting advice?

Link to comment
Share on other sites

I got in there and tested some scripts and it ended up being sort of complicated.

 

Quest Script:

SCN AATestSoulDrinkerSwordQuestSCRIPT

; This script is used on the quest with the same name and initializes  
; the quest variable that records the number of kills.

Short Kills  

 

Magic Effect Script placed on custom enchantment, which is placed on custom sword

SCN AATestSouldrinkerSCRIPT

; This script is used by enchantment AATESTSoulDrinkerEnch which is used on sword AATESTRavenousBlade

ref Target
ref self

short KillingBlow

begin ScriptEffectStart

set KillingBlow to 0
set target to GetSelf
set self to GetSelf

end

begin ScriptEffectUpdate

if ( KillingBlow == 0 )
	if ( Target.GetDead == 1 )
			Set AATESTSouldrinkerSword.Kills to AATESTSouldrinkerSword.Kills + 1 
			Message "The Ravenous Blade has consumed %.0f souls.", AATESTSouldrinkerSword.Kills
			player.modav health 10
			PlaySound AATESTAMBVoicesInHeadNonLP
			Set KillingBlow to 1
	endif
endif

end  

 

The Dawnfang script uses a Global Variable. I can't hardcode those, so I made a new quest, with a quest script, with a quest variable to serve the same function.

 

I made another version of the voices in the head sound which does not loop, because a looping sound can go on forever, and there is no command to stop it like I have heard there was in Morrowind modding.

 

I did so much work that I ended up with a mod:

 

Ravenous Blade

 

You are in the credits, and can study how the scripts and things interact and use anything you want to from my mod to make your mod. I wasn't really sure what all the features you wanted your sword to have were, so I haven't really worked with some parts of your scripts.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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