MoonlightArcher Posted November 24, 2013 Share Posted November 24, 2013 Hello! I need help with a certain kind of script. So basically I need a script that allows you to "set the stage on multiple kills". So you have to kill all the enemies in one area before you set the quest to the next stage.This is probably a very simple script, but because I'm not really an expert when it comes to scripts I don't know how to create a script like that. I tried to look at the script from the quest Retaking Thirsk Mead Hall(Dragonborn DLC) Where you have to kill all the rieklings in that area, but that script doesn't make any sense when I open it in NotePad. I hope some of you can help me out with this problem! Link to comment Share on other sites More sharing options...
Xander9009 Posted November 24, 2013 Share Posted November 24, 2013 That quest works like this: Each riekling is assigned an alias. Each of those rieklings calls the function RieklingKilled() in the main quest script when it dies. The main quest script knows how many rieklings there were originally. Each time one is killed and its RieklingKilled() function is called, it checks to see how many are left alive. If the number left alive is 0 or less (just in case), then it sets the stage. If you were thrown by the [], they're just a shortcut. You can fill in multiple aliases to a single property by putting [] at the end of the type when declaring a property to make it an array, then each value in the array (elements) can be called by putting [#] after the name of the property like when you'd normally use it. It just cycles through them. So, if you want to do it the same way, you'll need one alias per bandit/whatever. I don't know how the aliases were filled, but you could simply make the bandits/whatever and fill them manually. Then, to each alias, attach a new script with these three lines Event OnDeath(Actor akKiller) (GetOwningQuest() as 'YourQuestNameHere'QuestScript).BanditKilled() EndEvent Make sure to change it to your quest name (it can actually be anything, but this'll make it easily identifiable). Then make your quest script and call it the same as the name you just used up there. So if you made the line read "(GetOwningQuest() as BanditsAreHorribleQuestScript).BanditKilled()" then you need to make the script's name "BanditsAreHorribleQuestScript". In that script, make the function so it can be called: Function BanditKilled() BanditsAlive.Value -= 1 ModObjectiveGlobal(1, BanditsKilled, 21) if (BanditsAlive.Value <= 0) SetStage(25) endif EndFunction You'll need to make the BanditsAlive and BanditsKilled global variables if you want to use those in your objectives like the Retaking Thirsk quest does, or you can replace that with this script if you just want them to have to be killed Int BanditsAlive = 10 Function BanditKilled() BanditsAlive -= 1 if (BanditsAlive <= 0) SetStage(25) endif EndFunction Now, once everything is filled in, when one of your bandits dies, it'll call the function "BanditKilled()" which will subtract one from the number left alive. Once that number hits 0, the stage will advance. Link to comment Share on other sites More sharing options...
MoonlightArcher Posted November 24, 2013 Author Share Posted November 24, 2013 Thanks! This helped me out a lot! :D Link to comment Share on other sites More sharing options...
Recommended Posts