The Elder Scrolls V: Skyrim

The Elder Scrolls V: Skyrim

Find the best mods for your game
Finding and installing your favorite mods is easier than ever before. Mod-makers also enjoy a streamlined process for uploading mods directly to Steam. Click here to learn how.
Creation Kit Scripting Help needed
I am working on a weapon that can keep track of kills and then level up, adding abilities each time, based on certain predetermined variables.

Something along the lines of:

if weapon kills enemy
add kill point

if kill point = 25
add enchantment frost damage +5

if kill point = 50
add enchantment fire damage +10


Any help is greatly appreciated in advance. I am not looking for someone to write my script for me, just more of a point in the right direction. : )
< >
Showing 1-15 of 25 comments
Adura 1 Apr 27, 2014 @ 10:15pm 
I don't remember any script functions that would make this an easy process (but then again my memory is rubbish :P)

Anyway, some things to consider:

use a global variable to record the kill count. You can manipulate it as needed in the script ^^.

This also sounds similar to the Ebony Blade in game, which improves each time you kill a friend NPC. You may want to look it up in the Creation Kit and see what it uses :D Then make your own sword based on that information.
Sareh Shadowborne Apr 27, 2014 @ 10:17pm 
thanks i forgot that skyrim had oneof those, i remember had oblivion had one though
Sareh Shadowborne Apr 27, 2014 @ 10:36pm 
Ok so I went and looked at the Ebony Blade and the only scripting involved was for the quest, the rest of it was handled through enchantments and I didnt see a way to implement my idea this way.
Adura 1 Apr 27, 2014 @ 11:06pm 
The enchantments and quest(s) also use scripting. Quite a lot of it. I took a peak. There's about 4-5 enchantment/spell effects related to the ebony blade, all of them scripted. There's about 2-3 quests used to regulate the blade, all with heavy scripting.

It seems that the kill count is handled by a quest and it's script, since I eventually tracked it down to DA08EbonyBladeTracking. Note that it's a holder function, to be used by other things. It seems the ebony blade's functionality is broken up amongst a handful of quests and spells, and handled largely through scripting.

But I don't really want to do more tracking and decoding then that. :P Hopefully this is a more narrowed down direction for your search.

edit: given how spread out the blade's function is, it might be easier to try and come up with an alternative method to get what you want. *shrug*
Last edited by Adura; Apr 27, 2014 @ 11:08pm
Adura 1 Apr 27, 2014 @ 11:12pm 
Another, probably easier route, may be to check out the soul trapping enchantment scripts. You could at least use that to keep track of how many are killed with the sword (by giving it this modified enchantment).
Sareh Shadowborne Apr 27, 2014 @ 11:12pm 
yeah thanks i have no idea how you found all of that . . . wow . . . i am hoping i can find a way to put it all in one script
Sareh Shadowborne Apr 27, 2014 @ 11:14pm 
i like that last approach then just add in my condition statements . . . could work thanks
Adura 1 Apr 27, 2014 @ 11:16pm 
Here's the soul trap script, attached to the effect. You should be able to easily replace the "soul trapping" section with a variable/global that increases.

Then you just need to find a way to modify the weapon's enchantments, or maybe script in some additional spells to kick in upon the start of the effect. (edit: or add conditions. XD That's much easier. Do that :P)

Here's the soul trap script: ScriptName magicSoulTrapFXScript extends ActiveMagicEffect
{Scripted effect for the Soul Trap Visual FX}

import debug

ImageSpaceModifier property TrapImod auto
{IsMod applied when we trap a soul}
sound property TrapSoundFX auto ; create a sound property we'll point to in the editor
{Sound played when we trap a soul}
VisualEffect property TargetVFX auto
{Visual Effect on Target aiming at Caster}
VisualEffect property CasterVFX auto
{Visual Effect on Caster aming at Target}
EffectShader property CasterFXS auto
{Effect Shader on Caster during Soul trap}
EffectShader property TargetFXS auto
{Effect Shader on Target during Soul trap}
bool property bIsEnchantmentEffect = false auto
{Set this to true if this soul trap is on a weapon enchantment or a spell that can do damage to deal with a fringe case}

actor CasterActor
actor Victim
; objectreference playerref
bool DeadAlready = FALSE
bool bUseWait = True

Event OnEffectStart(Actor Target, Actor Caster)
victim = target
CasterActor = Caster
if bIsEnchantmentEffect == False
DeadAlready = Victim.IsDead()
bUseWait = False
; debug.trace("Is Soultrap target dead? ("+deadAlready+")("+victim+")")

Event OnEffectFinish(Actor Target, Actor Caster)
trace(self + " is finishing")
if victim
if bUseWait
if DeadAlready == False
if Caster.TrapSoul(victim) == true
trace(victim + " is, in fact, dead. Play soul trap visFX") ; play TrapSoundFX sound from player
TrapImod.apply() ; apply isMod at full strength
TargetVFX.Play(victim,4.7,Caster) ; Play TargetVFX and aim them at the player
TargetFXS.Play(victim,2) ; Play Effect Shaders
trace(victim + " is, in fact, dead, But the TrapSoul check failed or came back false")

trace(self + "tried to soulTrap, but " + victim + " is already Dead.")

Last edited by Adura; Apr 27, 2014 @ 11:18pm
Sareh Shadowborne Apr 28, 2014 @ 10:09am 
Thanks :)
Sareh Shadowborne Apr 28, 2014 @ 1:48pm 
I have been looking at a few different tutorials and this is what i am getting:

Scriptname LeveledenchSwrd extends ObjectReference
{Calling Variable}
Int killvar {forgetting how to set to specific variable type}
{checking to see if target dies and adds a counter to pre called variable}
If event ondeath (Actor, Target) = True {true or 1?}
killvar = +1
{Checks precalled variable to check if requirement is met, if it comes out true then it adds an
If killvar >= 25
{not sure how to do it but i would add an effect from the creation kit, such as fire
damage, possibly referencing a property}

Small questions, am I calling my variable right? Is it possible to call a property through scripting or would it just be easier to take the script for the effects and paste them in to my script directly? {just a small note i know my script is going to be long I plan on adding in quite a few different effects} I am just trying to figure out the bones of my code right now.

As always all help is greatly appreciated
Adura 1 Apr 28, 2014 @ 3:24pm 

Couple things:

1) There's 2 ways to declare variables.
The first way is to do so in the script, which you are doing with killvar.
It is usually done in the following format:
(variable type) Property (variable name) (Any value setting) Auto
The auto will seek out if your variable corresponds to something else in the game and fill it.
Actor Property PlayerREF Auto
Quest Property FromQuest Auto
Int Property StageToSetOnPickup = -1 Auto

The second is to declare variables outside of the script (and they will be put into the script for you when you do so.) Right click your attached script in the object window, select properties. A new window pops up. You can add variables from here.

Important note! The properties windows for your script is where variables are handled, in all cases. If you attach a global variable or anything else, you must make sure that those variables have that global variable selected in the properties. (For example: If you want to attach the main quest to a script, you must make a Quest variable, and ensure that it refers to the main quest in the Properties window.)

You have: If event ondeath (Actor, Target) = True {true or 1?}

There are several things that concern me here.

#1: You can't call an If on an event.
An event is when something happens, and will trigger the code in said event.

It should be:
Event OnDeath(Actor akKiller)
{code that runs on death}

#2: OnDeath is an event that only runs when the object that the script is attached to dies. It seems to me that this script is probably attached to your enchanted sword. Since swords don't have health and cannot die, this code will never run.
Last edited by Adura; Apr 28, 2014 @ 3:26pm
Sareh Shadowborne Apr 28, 2014 @ 5:56pm 
ok then is there a way to get my sword script to get the targets status say with something like onactoraction so it knows when the target dies then have it run my counter up one?
Last edited by Sareh Shadowborne; Apr 28, 2014 @ 6:02pm
Adura 1 Apr 28, 2014 @ 6:01pm 
Originally posted by Sareh Shadowborne:
ok then is there a way to get my sword script to get the targets status say with something like OnHit so it knows when the target dies then have it run my counter up one?
OnHit also only works for the attached object, and doesn't work for things like weapons that the player/NPC holds. (It does, however, work for hitting a weapon lying on the ground.) You can recheck this if you want, since my memory is fuzzy on that part. A single Debug.MessageBox("It works") would tell you if it triggers.

You had a solution before :P

Make a new enchantment. Duplicate the soul trap one, copy the attached script to that enchantment. Then, replace the section that does the soul trapping with one that increments a global variable you make. You can then use that global variable to keep track of kills. (Just make sure it's a new script, don't want to edit a vanilla script :P)

Then you can add effects to the enchantent (like fire damage, ice damage, other enchantment effects, etc) with the condition of (killcount >= some number).
Last edited by Adura; Apr 28, 2014 @ 6:01pm
Sareh Shadowborne Apr 28, 2014 @ 6:18pm 
Thank you last night when I read your post with the script I totally read something else. Looking at it now I see what is going on. . . slightly. So I am studying this script till I understand it then will begin to make said changes thank you so much!!!!!
Sareh Shadowborne Apr 30, 2014 @ 12:54pm 
Ok so I have gotten most of this figured out but I am having trouble adding in my magic effect properties. do i do all of my scripting in a single script and the just link it down the line? I have tried probably about 10 diff codes to get it to pull my properties but I have had no luck any sugestions on what to use?
< >
Showing 1-15 of 25 comments
Per page: 15 30 50

Date Posted: Apr 27, 2014 @ 9:53pm
Posts: 25