Jamisicus6 Posted June 22, 2010 Share Posted June 22, 2010 I did a bit of scripting last night and I found that the Vampire hunger script I created (I just edited the original Vampire progression script) did not work. For some odd reason, I could contract Porphyric Hemophillia but It would never get rid of that and add vampirism. Here is the script I wrote last night. Please can some one have a look at this to see where I went wrong. Scriptname VampireScript short hasdiseaseshort currentdayshort daycountshort vampdayshort vampupdateshort randomdreamshort doonce float vamphourfloat fQuestDelayTime begin gamemode if ( doonce == 0 ) set randomdream to -1 set fQuestDelayTime to 0.5 set doonce to 1endif if ( PCVampire == -1 ) returnendif ;SCRIPTING FOR ACQUIRING VAMPIRISM;--------------------------------------------------------------------------------------------------------------------- If ( hasdisease == 0 ) if ( Player.IsSpellTarget VampDisease == 1 ) set hasdisease to 1 endifendif ;If player has been cured of disease, reset 'hasdisease' var if ( hasdisease == 1 ) if ( Player.IsSpellTarget VampDisease == 0 ) set hasdisease to 0 endifendif if ( hasdisease == 1 ) if ( currentday == 0 ) set currentday to GameDay else if currentday != gameday set daycount to ( daycount + 1 ) set currentday to GameDay endif endifendif;If hasdisease still == 1, this is the first time the player has been in this state;give him introductory messagebox (TEMP) and reset hasdisease var if ( PCVampire == 1 ) if ( hasdisease == 1 ) if ( GetPCIsSex Male == 1 ) Messagebox "You dream of someone sleeping peacefully in his bed, when a shadowy, gaunt figure silently enters the room. Approaching the bed, the figure leans down and sinks its fangs into the sleeping person. After a few moments, the pale figure rises, blood dripping down his chin. As color flows back into the vampire's face, and his features fill out, you recognize the face as your own. You awake screaming." else Messagebox "You dream of someone sleeping peacefully in his bed, when a shadowy, gaunt figure silently enters the room. Approaching the bed, the figure leans down and sinks its fangs into the sleeping person. After a few moments, the pale figure rises, blood dripping down her chin. As color flows back into the vampire's face, and her features fill out, you recognize the face as your own. You awake screaming." endif set hasdisease to -1 player.removespell VampDisease player.setfactionrank playervampirefaction 0 addtopic CureforVampirism StartQuest MS40 set vampday to GameDay set vamphour to GameHour endifendif ;SCRIPTING FOR STATE CHANGES AS A VAMPIRE;-------------------------------------------------------------------------------------------------------------------- ;First things first. If player has fed, reset Vampirism level to 25 and start the counters over again If ( PCVampire >= 1 ) if ( Player.HasVampireFed == 1 ) Set PCVampire to 1 ;remove any spell from higher states Player.removespell Vampirism50 Player.removespell Vampirehunger1 Player.removespell Vampirism75 Player.removespell Vampirehunger2 Player.removespell Vampirism100 Player.removespell Vampirehunger3 Player.removespell Vampirehunger4 ;re-add state 1 spells Player.addspell Vampirism25 set vampday to GameDay set vamphour to GameHour MessageBox "You feel the Thirst in your throat shrinking into a dull ache. You have no need for blood... Yet..." endifendif ;Run a timer, checking for 24 hour intervals. If 24 hours have passed, increment vampupdate and reset hour/day vars if ( PCVampire >= 1 ) if ( vampday != GameDay ) if ( ( vamphour + 1 ) < GameHour ) set vampupdate to 1 set vampday to GameDay set vamphour to GameHour elseif ( vamphour >= 22 ) if ( vampday + 1 < Gameday ) set vampupdate to 1 set vampday to Gameday set vamphour to GameHour endif endif endifendif ;When VampireState doesn't match Vampirism Effect, update effects if ( PCVampire == 2 ) if ( Player.getav vampirism == 25 ) Player.removespell Vampirism25 Player.addspell Vampirism50 Player.addspell Vampirehunger2 MessageBox "You feel the thirst in your throat, the emptiness of your veins... The need for Blood" endifelseif ( PCVampire == 3 ) if ( Player.getav vampirism == 50 ) Player.removespell Vampirism50 Player.addspell Vampirism75 Player.addspell Vampirehunger2 MessageBox "Your every unnecessary breathe fills you with the Taste of Blood. You can feel your face shrivelling. It will be more difficult to speak to people now... But easier to feed." endifelseif ( PCVampire == 4 ) if ( Player.getav vampirism == 75 ) Player.removespell Vampirism75 Player.removespell Vampirehunger2 Player.Addspell Vampirism100 Player.addspell Vampirehunger3 MessageBox "The need for Blood is so close to over-powering you. Your every thought is of Blood and of your next victim..." endifelseif ( PCVampire ==5 ) if ( Player.getav vampirism == 100 ) Player.removespell Vampirism100 Player.removespell Vampirehunger3 Player.addspell Vampirehunger4 MessageBox "You are more aware of those around you than you have ever thought possible as a mortal. You are now closer to being like a vicious predator than one of your unfortunate prey" Endifendif ;If player is resting after 3 days with disease, increment PCVampire and wake 'im up if ( hasdisease == 1 ) if ( currentday == 0 ) set currentday to GameDay else if currentday != gameday set daycount to ( daycount + 1 ) set currentday to GameDay endif endifendif if ( hasdisease == 1 ) if ( daycount >= 3 ) if ( IsPCSleeping == 1 ) WakeUpPC set PCVampire to 1 endif endifendif ;If player is ready for state change, check for time passing and increment PCVampire if ( PCVampire >= 1 ) if ( PCVampire < 4 ) if ( vampupdate == 1 ) if ( IsTimePassing == 1 ) set PCVampire to ( PCVampire + 1 ) set vampupdate to 0 set vampday to GameDay set vamphour to GameHour endif endif endifendif End Obviously, this forum has re formatted the lines so they are not tabbed but this is the Script I was running which seems to fail with no collisions with other mods (I had none running at the time, only this one.) Thanks in Advance Link to comment Share on other sites More sharing options...
Skevitj Posted June 22, 2010 Share Posted June 22, 2010 My eyes are killing me, was way too close ot the monitor while reading that... I can't pick any obvious faults in it, the individual block's intentions are clear and the syntax looks as it should be. If you can list the bits you changed, and the bits which are direct copies, that should help narrow the location of the bug down. If you're running OBSE, liberal use of PrintToConsole will make diagnosing any problems a lot easier. Ie, create a spell which will cause all variable values to be written to the console when cast, or mabey create a message box whenever a variable changes? Link to comment Share on other sites More sharing options...
Skevitj Posted June 22, 2010 Share Posted June 22, 2010 Unintentional bump... Double post by accident Link to comment Share on other sites More sharing options...
Jamisicus6 Posted June 22, 2010 Author Share Posted June 22, 2010 My eyes are killing me, was way too close ot the monitor while reading that... I can't pick any obvious faults in it, the individual block's intentions are clear and the syntax looks as it should be. If you can list the bits you changed, and the bits which are direct copies, that should help narrow the location of the bug down. If you're running OBSE, liberal use of PrintToConsole will make diagnosing any problems a lot easier. Ie, create a spell which will cause all variable values to be written to the console when cast, or mabey create a message box whenever a variable changes? Thanks Skevitj. I will put some message boxes in to try to diagnose the problem. Tried running it on an already vampired save and fed to see if that helped... It didn't. Hunger didn't change even after a week of wait/resting. Link to comment Share on other sites More sharing options...
Jamisicus6 Posted June 22, 2010 Author Share Posted June 22, 2010 I Have isolated the problem a little more. Porphyric Hemophillia gets caught but the scripting is not making the Character a Vampire after 3 Days. Is there possibly something wrong with the Scripting for becoming a Vampire after the three day incubation period. Anyone with previous experience of creating/editing Vampire Mods would be most welcome to give some insight about now. Link to comment Share on other sites More sharing options...
Jamisicus6 Posted June 22, 2010 Author Share Posted June 22, 2010 My eyes are killing me, was way too close ot the monitor while reading that... I can't pick any obvious faults in it, the individual block's intentions are clear and the syntax looks as it should be. If you can list the bits you changed, and the bits which are direct copies, that should help narrow the location of the bug down.O.K. I changed most of the vampire leveling codes, leaving the addition or removal of the vampire level spells in (Vampirism25, 50, 75, 100). The conversion scripts from having porphyic hemophillia to become a vampire were completely untouched. If you want the general idea of what I used, just check the original Vampire script (the full one not either of the tests). I basically just copied and pasted most of it, with some Messagebox command changes and spell changes) In essence, the only things I changed was to change all Vampire25Att and Vampire25S to the appropriate Vampirehunger level (i.e. Vampirism25 has no hunger level, Vampirism50 has Hunger level 1 etc.) Link to comment Share on other sites More sharing options...
Skevitj Posted June 23, 2010 Share Posted June 23, 2010 (Quick piece of advice: If you need to post something new and there are no more posts, just edit your last one. Threads have been locked before for multiple posts just like yours) That makes me think the error occurs in the block responsible for determining the time delays. On a closer look: if ( hasdisease == 1 ) if ( currentday == 0 ) set currentday to GameDay else if currentday != gameday set daycount to ( daycount + 1 ) set currentday to GameDay endif endifendifThis block appears twice in the code, the currentday!=gameday test should prevent it from changing anything on the second time around though. Unless I'm missing something it's redundant and can be removed (one of the blocks, not both). <br>elseif ( vamphour >= 22 )As far as I'm aware, 0<=GameHour<24 so that 22 should be a 23 it you're trying to catch 25h from 11pm. That's not breaking the script though, since it's redundant from the first if test. While that's all well and good, I can't find anything causing it to hang. I'll have a bit more of a look in a little bit, but it's starting to give me flash backs to the segmentation fault errors which became my arch nemesis while learning C (They just pop up, no idea what part is causing them)... If it gets that bad, I'm gonna need another new monitor, and possibly a cast. Link to comment Share on other sites More sharing options...
Jamisicus6 Posted June 23, 2010 Author Share Posted June 23, 2010 Thanks so far Skevitj. I will run Oblivion with no mods later today to see if it is my install that is corrupted (although how the script is only half running I have no idea). Hope your flashbacks don't get too vivid. :biggrin: Link to comment Share on other sites More sharing options...
Jamisicus6 Posted June 29, 2010 Author Share Posted June 29, 2010 Would separating the coding into two scripts help (acquiring and removing vampirism in one script and the hunger modifications in a separate one)? Link to comment Share on other sites More sharing options...
Skevitj Posted July 1, 2010 Share Posted July 1, 2010 Doubt it, it might make it easier to debug, but since only one "thing" (ie, aquiring vamp, removing vamp or changing level) happens at any time, it's perfectly suited to just one gamemode block. Multiple would probably introduce more problems than it would solve. Honestly, I think your best bet to get it working would just be to scrap it, and try and rewrite it from the stock vamp script, but being very careful to document what values/lines are changed/added. I can't find anything which could possibly cause it to hang. Unless you're testing it on a toon which has had vamparism before and has been cured? Then the -1 from the vamparism cure would prevent you from becoming a vampire again. I've just assumed you tested t from a clean game. Link to comment Share on other sites More sharing options...
Recommended Posts