Deadcount on a weapon
Introduction[edit | edit source]
In this article we are going to create a script to count the total kills of the weapon currently used by the player. This script is going to be quite similar to the Dawnfang/Duskfang script used in the Shivering Isles. The only difference is that we are going to reward the player with a stronger sword each time the sword has killed enough actors, in stead of giving the player just a simple message: “Dawnfang’s/Duskfang’s bloodthirst has been quenched.” These are the things we are going to create before creating the scripts:
- 10 Swords (Every time the player has killed enough actors with the sword we are going to switch it with a stronger version of the sword.)
- 2 Globals (I’ll tell you more about this later.)
I called my sword “Soul Sword”. We are going to create ten swords first. The first sword is weak and I made every sword a bit stronger by adjusting the speed and damage. You can also give the enchantment some magic effects or something. This is how the Dawnfang script looks like, to give you an idea of what we are going to create:
Scn SEDawnfangSpellEffectScript 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 ( SESwordDawnfangKills < 1 ) Set SESwordDawnfangKills to ( SESwordDawnfangKills + 1 ) Message "Dawnfang has extinguished %.0f life.", SESwordDawnfangKills Set KillingBlow to 1 Elseif ( SESwordDawnfangKills >= 1 ) && ( SESwordDawnfangKills < 11 ) Set SESwordDawnfangKills to ( SESwordDawnfangKills + 1 ) Message "Dawnfang has extinguished %.0f lives.", SESwordDawnfangKills Set KillingBlow to 1 Elseif ( SESwordDawnfangKills == 11 ) Set SESwordDawnfangKills to ( SESwordDawnfangKills + 1 ) Message "Dawnfang's bloodthirst has been quenched." Set KillingBlow to 1 Elseif ( SESwordDawnfangKills >= 12 ) Set KillingBlow to 1 Endif Endif Endif End
You might have noticed that there are no short or long Integers for the “SESwordDawnfangKills”. This is because it’s a global. Globals are handeled by scripts in the game. (At least most of them.) And because this script used a global, we are going to do so too. First we will need to go to “Gameplay” then we will go to “Globals”. Now we can create our own globals: Right-click on the left side of the window. Select “New” and create the next two globals:
- EditorID: DeadCount
- Variable Type: Short
- Value: 0
- EditorID: TotalCount
- Variable Type: Short
- Value: 0
We will need the first global to check if the player has killed his target and the second is used for the total amount of kills.
The Script[edit | edit source]
This is the script for the enchantment of the sword. It’s very simple: the only thing it does is checking if the player has killed his target with the sword. If the target is dead, “DeadCount” will be set to “DeadCount + Dead”. Now the “DeadCount” is set to the amount of kills by the sword.
Scn 000DeadCountScript Ref Target Short DoOnce Short Dead Begin ScriptEffectStart Set DoOnce to 0 Set Target to GetSelf End Begin GameMode If DoOnce == 0 If Target.GetDead == 1 Set Dead to 1 Set DeadCount to (DeadCount + Dead) Set DoOnce to 1 Endif Endif Endif End
The Quest Script[edit | edit source]
This is the script I used for the quest; this script consists of three parts:
- The part to display a message
- The part to upgrade the sword
- The part to reward the player for obtaining the last upgrade
It looks complicated but it isn’t: first we are going to create a message that will tell you how many lives the sword has extinguished then we just swap the sword with a stronger one if the player reaches 10, 25, 50, 100, 150, 250, 500, 750, 1000 and at last 5000 with the “TotalCount” global. If the player has killed the target with the sword, “Deadcount” will be set to “DeadCount + 1” and “TotalCount” will be set to “DeadCount”. So if “DeadCount” is higher than “TotalCount” than “TotalCount” will be adjusted to “DeadCount”.
Scn 000DeadCountQuestScript Short DoOnce Begin Gamemode If DeadCount > TotalCount Set TotalCount to DeadCount If (TotalCount == 1) Message "Soul Sword has extinguished 1 life" Elseif (TotalCount > 1) Message "Soul Sword has extinguished %.0f lives", TotalCount Endif Endif If TotalCount == 10 && DoOnce == 0 Player.Additem 002SoulSword 1 Player.EquipItem 002SoulSword Player.RemoveItem 001SoulSword 1 Message "Soul Sword becomes stronger" Set DoOnce to 1 Elseif TotalCount == 25 && DoOnce == 1 Player.Additem 003SoulSword 1 Player.EquipItem 003SoulSword Player.RemoveItem 002SoulSword 1 Message "Soul Sword becomes stronger" Set DoOnce to 2 Elseif TotalCount == 50 && DoOnce == 2 Player.Additem 004SoulSword 1 Player.EquipItem 004SoulSword Player.RemoveItem 003SoulSword 1 Message "Soul Sword becomes stronger" Set DoOnce to 3 Elseif TotalCount == 100 && DoOnce == 3 Player.Additem 005SoulSword 1 Player.EquipItem 005SoulSword Player.RemoveItem 004SoulSword 1 Message "Soul Sword becomes stronger" Set DoOnce to 4 Elseif TotalCount == 150 && DoOnce == 4 Player.Additem 006SoulSword 1 Player.EquipItem 006SoulSword Player.RemoveItem 005SoulSword 1 Message "Soul Sword becomes stronger" Set DoOnce to 5 Elseif TotalCount == 250 && DoOnce == 5 Player.Additem 007SoulSword 1 Player.EquipItem 007SoulSword Player.RemoveItem 006SoulSword 1 Message "Soul Sword becomes stronger" Set DoOnce to 6 Elseif TotalCount == 500 && DoOnce == 6 Player.Additem 008SoulSword 1 Player.EquipItem 008SoulSword Player.RemoveItem 007SoulSword 1 Message "Soul Sword becomes stronger" Set DoOnce to 7 Elseif TotalCount == 750 && DoOnce == 7 Player.Additem 009SoulSword 1 Player.EquipItem 009SoulSword Player.RemoveItem 008SoulSword 1 Message "Soul Sword becomes stronger" Set DoOnce to 8 Elseif TotalCount == 1000 && DoOnce == 8 Player.Additem 010SoulSword 1 Player.EquipItem 010SoulSword Player.RemoveItem 009SoulSword 1 MessageBox "Soul Sword contains now the power of a thousand souls. But there is just one thing left. Soul Sword can grant you a lot of power. But if you want to be even more powerfull then you already are, then you must reach the limit of 5,000 souls!" Set DoOnce to 9 Endif If TotalCount == 5000 && DoOnce == 9 MessageBox "You have become stronger!" Player.modAV Health 100 Player.modAV Magicka 100 Player.modAV Fatigue 100 Set DoOnce to 10 Endif End
Notes[edit | edit source]
If you want to create more than one weapon that is using this script you might want to create new globals if you don’t want them to be mixed up. (Copy “DeadCount” and “TotalCount” and change them into “DeadCount2” and “TotalCount2” or something.) This was a short solution on how to get a deadcount on a weapon. I hope this script was of some use to you. If there are some problems or if you have some questions, please put them on the talk page of this article and not on this page.