Ranokoa Posted December 23, 2009 Share Posted December 23, 2009 I scripted a sword to count how many times it kills someone and at intervals of 10, 25, 50, 100, 250 etc etc it switches with a more powerful duplicate... but.. It causes CTD issues >_< I don't get it. I was play testing, it counts perfect, but when it gets to the first switch it just crashes. Can someone that knows scripting well enough to find out why take a look at it? Reply or PM and I'll message you a DL link. I don't want it publicly released quite yet cause of this issue. Any help would be much appreciated :) Be well, sleep well, fight well, live long.~Ranokoa Link to comment Share on other sites More sharing options...
grmblf Posted December 23, 2009 Share Posted December 23, 2009 Do you unequip the weapon from the player the frame before deleting it? That might help. Link to comment Share on other sites More sharing options...
Ranokoa Posted December 23, 2009 Author Share Posted December 23, 2009 Its more or less Add item, equipt item and remove item all in a row.. I'm no master scripter, how would I force it to dedicate one frame per function? Link to comment Share on other sites More sharing options...
grmblf Posted December 23, 2009 Share Posted December 23, 2009 Assuming that you run a script dedicated to this task it's easy, you only need one variable and increase it "by steps". Better see it in an example: scn xxx short doOnce begin gamemode if doOnce == 0 ;do stuff set doOnce to 1 elseif doOnce == 1 ;do more stuff set doOnce to 2 elseif doOnce == 2 ;etc endif endSo each iteration it performs a different action. You could nest all this block inside an if statement to check if it's time to change the weapon or not, that's up to you. All this will happen so fast that the wait will be unnoticeable, but sometimes it's necessary for the engine. If you run more than one "if" statement maybe you'd like to add a return at the end of each "sub-block", as it's now it's not necessary. Good luck! Link to comment Share on other sites More sharing options...
Ranokoa Posted December 24, 2009 Author Share Posted December 24, 2009 Scn RSwordScript Short DoOnce Begin Gamemode If DeadCount > TotalCount Set TotalCount to DeadCount If (TotalCount == 1) Message "Soul Reaver has extinguished 1 life" Elseif (TotalCount > 1) Message "Soul Reaver has extinguished %.0f lives", TotalCount Endif Endif If TotalCount == 10 && DoOnce == 0 Player.Additem RSword2 1 Player.EquipItem RSword2 Player.RemoveItem RSword1 1 Message "Soul Reaver becomes stronger" Set DoOnce to 1 Elseif TotalCount == 25 && DoOnce == 1 Player.Additem RSword3 1 Player.EquipItem RSword3 Player.RemoveItem RSword2 1 Message "Soul Reaver becomes stronger" Set DoOnce to 2 Elseif TotalCount == 50 && DoOnce == 2 Player.Additem RSword4 1 Player.EquipItem RSword4 Player.RemoveItem RSword3 1 Message "Soul Reaver becomes stronger" Set DoOnce to 3 Elseif TotalCount == 100 && DoOnce == 3 Player.Additem RSword5 1 Player.EquipItem RSword5 Player.RemoveItem RSword4 1 Message "Soul Reaver becomes stronger" Set DoOnce to 4 Elseif TotalCount == 150 && DoOnce == 4 Player.Additem RSword6 1 Player.EquipItem RSword6 Player.RemoveItem RSword5 1 Message "Soul Reaver becomes stronger" Set DoOnce to 5 Elseif TotalCount == 250 && DoOnce == 5 Player.Additem RSword7 1 Player.EquipItem RSword7 Player.RemoveItem RSword6 1 Message "Soul Reaver becomes stronger" Set DoOnce to 6 Elseif TotalCount == 500 && DoOnce == 6 Player.Additem RSword8 1 Player.EquipItem RSword8 Player.RemoveItem RSword7 1 Message "Soul Reaver becomes stronger" Set DoOnce to 7 Elseif TotalCount == 750 && DoOnce == 7 Player.Additem RSword9 1 Player.EquipItem RSword9 Player.RemoveItem RSword8 1 Message "Soul Reaver becomes stronger" Set DoOnce to 8 Elseif TotalCount == 1000 && DoOnce == 8 Player.Additem RSword10 1 Player.EquipItem RSword10 Player.RemoveItem RSword9 1 MessageBox "Soul Reaver has devoured 1,000 souls and has become the strongest weapon in all Tamriel. Devour 4,000 more souls and it will have the power to rival that of the Nine!" Set DoOnce to 9 Endif If TotalCount == 5000 && DoOnce == 9 MessageBox "The power of Soul Reaver has become so immense it triples in strength, and shares it's power with its wielder!" Player.Additem Rsword11 1 Player.EquipItem Rsword11 Player.removeItem RSword10 1 Player.modAV Health 100 Player.modAV Magicka 100 Player.modAV Fatigue 100 Set DoOnce to 10 Endif End Actually it's much like that. Link to comment Share on other sites More sharing options...
Vagrant0 Posted December 24, 2009 Share Posted December 24, 2009 I think the problem might be related to the DeadCount variable. The game might be confusing it with some internal variable used for http://cs.elderscrolls.com/constwiki/index.php/GetDeadCount . You're also using a variable which is not defined within the script (not getting the warning because the variable being used is being mistaken for a special global instead of something which is adjusted through a spell), or used as a variable in something like a quest script. Link to comment Share on other sites More sharing options...
Ranokoa Posted December 24, 2009 Author Share Posted December 24, 2009 Totally did not understand that for some reason. What I did was as that said make 2 globals called DeadCount and TotalCount. They work properly to update how many I killed, but when the switch is made crashes. I made the quest script and attached it to a new quest that starts upon game enable but is hidden, per se. Doesn't show up for the player to know it's there. I attached the correct script on the sword enchantment. Is it supposed to be on the sword ench or on the sword itself? It works as an enchantment but again, its the switch that crashes, not the count. Link to comment Share on other sites More sharing options...
grmblf Posted December 24, 2009 Share Posted December 24, 2009 There's no need for global vars, you could go with quest vars. That might be one problem, not sure though. But the thing is unequipping the sword the frame before removing it from player's inventory. If TotalCount == 10 && doOnce < 2 if DoOnce == 0 Player.Additem RSword2 1 Player.UnequipItem RSword1; I don't remember the syntax for that function, check it on the wiki Set DoOnce to 1 elseif doOnce == 1 Player.EquipItem RSword2 Player.RemoveItem RSword1 1 Message "Soul Reaver becomes stronger" Set DoOnce to 2 endif Elseif TotalCount == 25 && doOnce < 4 if DoOnce == 0 Player.Additem RSword3 1 Player.UnequipItem RSword2; I don't remember the syntax for that function, check it on the wiki Set DoOnce to 3 elseif doOnce == 2 Player.EquipItem RSword3 Player.RemoveItem RSword2 1 Message "Soul Reaver becomes stronger" Set DoOnce to 4 endif [...] Endif Every time the script runs throught this blocks, it only validates one part of the block each iteration, so first frame it runs and add the new sword and unequip the old, next frame remove the old and equip the new one. Anyway, to make sure wich function it is that causes a crash it's useful to print a message after EACH action so you can see where it stops, and comment one of those lines at a time, ie, if you suspect as I do it's removeItem, add a semicolon in front of that line and check if it's still crashing. If it doesn't crash then you know the problem is that one. good luck! Link to comment Share on other sites More sharing options...
Ranokoa Posted December 25, 2009 Author Share Posted December 25, 2009 ohhh this is ganna take a while to do >_< but I think it solves the problem! Makes sense. Had the same problem with a script.. sorta.. doing the.. kinda.. same thing with Fallout3. Removing and adding something in the same frame and equip the new one. Soon as I get the patience to do so I will try that out. Thanks :) PS: Kudos. Whether it works or not is irrelevant, you tried to help :) Hope it does work though lol. Link to comment Share on other sites More sharing options...
Theradyn Posted October 11, 2011 Share Posted October 11, 2011 (edited) Ok, Ok... so I know this post is old and all... but I'm brand new to scripting... like literally... I started maybe 2 hours ago? lol Anyway... I've got this same problem... wondered if anyone has figured it out by now... Here's a looksie at what I'm trying to do... this is the quest script... and in case you guys are wondering... this code, as well as the former guy's code is all from a tutorial from the TES Wiki... Unfortunately, whenever I kill something with this weapon... Oblivion immediately crashes... no warnings, no sound... nothing... just a quick flash of a black screen and that's it. The following code I have as an object code and have attached to the actual weapon itself: Scn 000DeadCountQuestScript Short DoOnce Begin Gamemode If DeadCount > TotalCount Set TotalCount to DeadCount If (TotalCount == 1) Message "Nightsong has extinguished 1 life" Elseif (TotalCount > 1) Message "Nightsong has extinguished %.0f lives", TotalCount Endif Endif If TotalCount == 1 && DoOnce < 2 If DoOnce == 0 Player.Additem 000BLWNightsongBow01 1 Player.UnequipItem 000BLWNightsongBow00 Set DoOnce to 1 Elseif DoOnce == 1 Player.EquipItem 000BLWNightsongBow01 Player.RemoveItem 000BLWNightsongBow00 1 Message "Nightwhisper becomes Nightspeak!" Set DoOnce to 2 Endif Elseif TotalCount == 2 && DoOnce < 4 Player.Additem 000BLWNightsongBow02 1 Player.UnequipItem 000BLWNightsongBow01 Set DoOnce to 3 Elseif DoOnce == 3 Player.EquipItem 000BLWNightsongBow02 Player.RemoveItem 000BLWNightsongBow01 1 Message "Nightwhisper becomes Nightscream!" Set DoOnce to 4 Endif Elseif TotalCount == 3 && DoOnce < 6 Player.Additem 000BLWNightsongBow03 1 Player.UnequipItem 000BLWNightsongBow02 Set DoOnce to 5 Elseif DoOnce == 5 Player.EquipItem 000BLWNightsongBow03 Player.RemoveItem 000BLWNightsongBow02 1 Message "Nightscream becomes Nightfury!" Set DoOnce to 6 Endif Elseif TotalCount == 4 && DoOnce < 8 Player.Additem 000BLWNightsongBow04 1 Player.UnequipItem 000BLWNightsongBow03 Set DoOnce to 7 Elseif DoOnce == 7 Player.EquipItem 000BLWNightsongBow04 Player.RemoveItem 000BLWNightsongBow03 1 Message "Nightfury becomes Nightsong!" Set DoOnce to 8 Endif Elseif TotalCount == 5 && DoOnce < 10 Player.Additem 000BLWNightsongBow05 1 Player.UnequipItem 000BLWNightsongBow04 Set DoOnce to 9 Elseif DoOnce == 9 Player.EquipItem 000BLWNightsongBow05 Player.RemoveItem 000BLWNightsongBow04 1 MessageBox "Nightsong has reached legendary power! But is this it? Perhaps there is still more to unlock." Set DoOnce to 10 Endif If TotalCount == 6 && DoOnce == 10 MessageBox "Nightsong has imbued you with it's essence!" Player.modAV Health 100 Player.setAV Marksman 150 Player.modAV Fatigue 100 Set DoOnce to 6 Endif End This next code is what I'm using as the Enchantment script and have it set as Magic Effect: 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 Any ideas would be very welcome... especially if they are broken down in very, very idiot proof terminologies... I am only 2 hours experienced with barely any coding experience at all... Edited October 11, 2011 by Theradyn Link to comment Share on other sites More sharing options...
Recommended Posts