Jump to content

Weapon kill count Script help


mnixon999

Recommended Posts

I am want to make a Weapon that the enchantment will get stronger as you kill people....

 

Here is how I think it would be set up:

 

Make a Quest with 5 stages.

Make the enchantment have 5 effects with increasing magnitude with conditions GetQuestStage == X

 

For the script I have this so far but nothing is working...

 

-------------------------------------------------------------------------

Scriptname DeathCountScript extends ObjectReference

 

WEAPON Property Dagger Auto

 

Int Property KillCount Auto

 

Event OnDeath(Target akKiller)

If akKiller == Game.GetPlayer() && Game.GetPlayer().GetEquippedWeapon() == Dagger

Killcount += 1

Debug.Notification("Kill count is" + KillCount)

endIf

endEvent

-------------------------------------------------------------------------
Here is what I hope to eventual accomplish with the script:
Check to see if target was killed by player with dagger
Check to see if target has a Grand Soul (not trap it) or Check to see if target is not an animal.
If those two are true the add 1 to the Int KillCount
Then when KillCount reaches X then advance QuestStage
I will also need the Int KillCount to remain the same after saves and not reset to 0
I can give more details if need. Any help is greatly appreciated, thanks!
Link to comment
Share on other sites

Might be late but:

 

Your script, i supose its attached to a magic effect on the weapon's enchantment right? then it has to extend activemagiceffect not objectreference, then on magic effects each time the script runs it makes a new instance of the script so the killcount resets and I don't think you need quest stages at all, here's how i'd do it:

 

On a magic effect of your weapon's enchanment

Scriptname IncrementerScript extends activemagiceffect 

WhateverYouCalledYourQuestScript property myquestscript auto ; filled in ck to point to the quest that holds the fucntion.
WEAPON Property MyDagger Auto  

Event OnDeath(Actor akKiller) ; or maybe OnDying, not sure which one was better.
	If akkiller == Game.getplayer() && Game.GetPlayer().GetEquippedWeapon() == MyDagger ; you can also add other conditions here.
       	myQuestScript.IncrementCounter() ; this function later
	endif
endEvent

Then you have a quest with start game enabled and such and the script called "WhateverYouCalledYourQuestScript" in this case which is the following:

Scriptname WhateverYouCalledYourQuestScript extends Quest  

GlobalVariable Property MyGlobalKillCount Auto ; since it's a global it won't reset to 0 after saves as you said.

Function IncrementCounter()
	MyGlobalKillCount.SetValue(MyGlobalKillCount.GetValue() + 1)
; and the do whatever stuff, check if killcount reached a certain value and do whatever you need to do then.
Endfunction

Then you'd have different magic effects with incrementing magnitudes and checking for a certain killcount on their conditions.

Edited by FrankFamily
Link to comment
Share on other sites

You are not too late by any means. I worked on solving this for hours yesterday with no success.

 

Thank you for replying.

 

Since my last post I have realized that I needed to make the script extend ActiveMagicEffect. Originally I had tried to do this on a Quest then on the weapon itself and not an effect on the weapon. Currently I have been trying to alter the script on soul trap, but that isn't working either.

 

I will try the script you posted soon as I am home. I had messed with the OnDeath script at first but if I remember reading correctly it only works when placed on an Actor. Same with OnDying. Also now that I have the script on a magic effect I don't need to check for GetEquipped so I dropped that.

 

The script on soul trap that I modified looks like this:

--------------------------------------------------------

Event OnEffectStart(Actor Target, Actor Caster)

victim = target

CasterActor = Caster

if bIsEnchantmentEffect == False

DeadAlready = Victim.IsDead()

endif

bUseWait = False

; debug.trace("Is Soultrap target dead? ("+deadAlready+")("+victim+")")

EndEvent

 

 

Event OnEffectFinish(Actor Target, Actor Caster)

AddToKillCount()

trace(self + " is finishing")

if victim

if bUseWait

Utility.Wait(0.25)

endif

if DeadAlready == False

If KillCount <100

if Caster.TrapSoul(victim) == true

Do effects and stuff

else

trace

endif

else

trace

EndIf

else

trace

endif

endif

 

If KillCount <100

KillCount += 1

Debug.Notification("Kill count is " + KillCount)

EndIf

endEvent

 

--------------------------------------------------------

 

This would always return 1 for KillCount for reasons that you clarified but that is where I left off last night.

 

I think I will need to use:

Victim = Target

AlreadyDead == False

Maybe the UtilityWait

IsDead()

 

I am not sure though.

 

How you have it set up on the magic effect and quest to change the value of the KillCount seems like it will be just what I need. I don't think I would have been able to come up with that. I am ok with simple script stuff (I have wrote a few basic stuff for the mod I am working on) but that was beyond my current capabilities.

 

 

I will post an update on the function of it soon as I can. Thanks a lot for the reply!

Edited by mnixon999
Link to comment
Share on other sites

Something else I just realized... The Ebony Blade basically does what I am trying to do. There is a whole lot going on with that blade though. There are like 4 or 5 magic effects, 2 quest trackers, factions, perks and 2 enchantments. Needless to say I was ta little lost looking at all of that. It seems like it uses a hidden perk to check for QuestStage and also GetIsID for the weapon. I could not find anything that looked like a Int that counted or kept track of kills. If you type DA08 in the filter all of it will show up. Maybe if I can make sense of how they did this I could run a similar setup.

Link to comment
Share on other sites

I set up the two scripts you posted. Everything saved/compiled fine. Only thing I added was a debug notification at the end to tell me what the count was. In game it would return "none" over and over. Later when trying to modify the script I got a compile error saying I could not add to none. Nor could I treat a global variable as an Int. not sure what to even try next.
Link to comment
Share on other sites

Going by the DA08 quests, looks like the easiest way to see if your weapon killed someone is use SM Event Node via Kill Actor Event.

Initially you'll probably want a normal StartUp quest.
You'd use this quest to calculate and keep your kill count and change/apply effects and what not as the kill amounts are reached.

Then create a Quest, set it as Kill Actor Event quest.
Then in Object window in SM Event Node -> Kill Actor Event -> create new quest node and add your Kill Actor Event quest to the node.
On the Quest Node add conditions for EventData GetID Player, EventData GetEquipped Your Dagger.

(You may also want add conditions to see if your StartUp quest is running or on a certain stage)
This way when someone is killed the and if by the player and your dagger is equipped then your Kill Actor Event quest is fired.
This quest is just to get the event that your weapon killed someone.
In the Kill Actor Event quest add a Stage that calls your your startup quest function to count your kills and then stop the the Kill Actor Event quest so it's ready to receive the next kill event.

Your startup quest doesn't need to see if it killed someone with your weapon, it only needs to add the kill to the count.
As the Actor Killed event quest has already filtered that someone was killed by your weapon.

Obviously there are some other conditions you want met before adding the kill count, so maybe in the Kill Actor Event quest you can filter whether the kill criteria has been met before telling your startup quest to add to the count.

 

Edit: I did a brief knock up test of the above and it works quite well to keep track of your weapon kills.

I used a quest objective in the Startup quest to display the kill count each kill.

Yep, counts nicely.

Link to comment
Share on other sites

Going by the DA08 quests, looks like the easiest way to see if your weapon killed someone is use SM Event Node via Kill Actor Event.

 

Initially you'll probably want a normal StartUp quest.

You'd use this quest to calculate and keep your kill count and change/apply effects and what not as the kill amounts are reached.

 

Then create a Quest, set it as Kill Actor Event quest.

Then in Object window in SM Event Node -> Kill Actor Event -> create new quest node and add your Kill Actor Event quest to the node.

On the Quest Node add conditions for EventData GetID Player, EventData GetEquipped Your Dagger.

(You may also want add conditions to see if your StartUp quest is running or on a certain stage)

This way when someone is killed the and if by the player and your dagger is equipped then your Kill Actor Event quest is fired.

This quest is just to get the event that your weapon killed someone.

In the Kill Actor Event quest add a Stage that calls your your startup quest function to count your kills and then stop the the Kill Actor Event quest so it's ready to receive the next kill event.

 

Your startup quest doesn't need to see if it killed someone with your weapon, it only needs to add the kill to the count.

As the Actor Killed event quest has already filtered that someone was killed by your weapon.

 

Obviously there are some other conditions you want met before adding the kill count, so maybe in the Kill Actor Event quest you can filter whether the kill criteria has been met before telling your startup quest to add to the count.

 

Edit: I did a brief knock up test of the above and it works quite well to keep track of your weapon kills.

I used a quest objective in the Startup quest to display the kill count each kill.

Yep, counts nicely.

This worked! Kudos to you two for helping me out. I was in the middle of trying to recreate the DA08 set up. So I had made the 2 quests, one being a Kill actor event set up and I had the scripts in place. However, I had no idea about the SM Event Node. This is my first mod(prize weapon for the mod) and I never read or seen the Nodes. So when filtering DA08 that doesnt show and it was the piece I was missing.

 

I do have one other problem that didn't seem to work like it should.... On the weapon enchantment I have 2 DamageMagicka effects. Same magic effect. One has a Magnitude of 5 the other of 10. The conditions are GetVMQuestVariable Quest "StartupQuest" var:: KillCount <= 1 Ran on Subject and the other is >=2. The problem is in game the dagger show both effects as active in the description. I copied this from the DA08 weapon enchantment.

 

Thanks again!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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