Small Vampire Script Help

Post » Sun Aug 09, 2009 5:27 am

Alright everyone, hoping someone can help me out here real quick. I don't have the script with me, I'm at work. But I'll explain the problem best I can and hopefully someone will understand my rambling.

Simple script, nothing major. I have a small mod I downloaded some time ago that simply corrects the bugs with feeding/vampire changes and corrects them so they act properly, no big deal. Other than that fix it's just basic Vanilla oblivion vampirism.

All I want to do, is make it so that "Stage 1" vampirism (Vampirism25) has an actual av for "Vampirism" of 0. (In otherwords, so that when you are in the first 24 hours after having fed, you look normal - and then at "50" Vampirism, or PCVampire 2, you continue on in Vanilla style vampirism.)

So here's my issue. I changed the spell "Vampirism25" so that the "Vampirism" attribute of it is simply 0, the rest being the same. Giving you all the regular vampirism qualities while looking like your normal self during this "PCVampire 1" first stage.

Well the problem is, there's another part of the script that checks your status and updates it. If PCVampire = 2, and also the AV for Vampirism is 25, it updates to stage 2 and erases the stage 1. No big deal, I change the "getav" from 25 to 0, to match with the changes in the spell for proper detection.

Well then, my problem is that everything works great. Except whenever I wait more than 24 hours and upgrade to the next stage of vampirism, I get an infinite loop of random dreams - in spite of the fact that every dream is supposed to set randomdream to -1 afterwards. This infinite loop of dreams ONLY happens when going from stage 1 (PCVampire 1) to stage 2 (PCVampire 2). All other transformations have the same script, just replacing different spells, but for some reason work just fine.

Please tell me, if you can understand this without seeing the script (again, most of it's just the vanilla script if you want to take a look), what I'm doing wrong - I'd appreciate it. I have no idea why these dreams are randomly looping. As soon as it updates PCVampire to 2, it removes all Vampirism25 ability spells (Vampirism25, Vampirism25Att, etc) and replaces them with Vampirism50 spells. Which are completely untouched. Why it continues to loop dreams so that I can't get out of them is beyond me. Perhaps the Vampirism25 spells aren't removing completely, causing it to eternally detect the Vampirism av to be 0? This should not be, since it removes them as soon as it gives you the dream and adds the stage 2 spells... Perhaps I need to put the removeVampirism25 spells FIRST, before adding the lines for adding the Vampirism 50 spells? Not sure if that matters. I'm not much with scripting.

Cheers and thanks.
User avatar
Jason Rice
 
Posts: 3445
Joined: Thu Aug 16, 2007 3:42 pm

Post » Sun Aug 09, 2009 6:04 am

Ok, here's I think the script I'm working on (I had my wife send it to me. I'm at work and simply can't let this go.) It lost the indents and formatting a bit, but you get the idea.

All I'm doing is changing the spell for Vampirism25 so that it adds a "Vampirism" of 0 - resulting in not looking ugly when you're at stage 1 of being a vampire. You can't feed like this (and that's fine), but it makes it so that at least stage 1 isn't terrible.

Problem is that if, in the section that governs vampire state changes (this is right before it triggers the removal of PCVampire 1 spells and addition of PCVampire 2 spells...), I change:

if ( PCVampire == 2 )
if ( Player.getav vampirism == 25 )


That 25 to "0" to match the Vampirism av according to my changing the spell, it will work perfect - except that when it advances to stage 2 after 24 hours of not feeding, the dreams repeat indefinitely. And I'm not sure why. The thing that triggers the dream, ALSO removes the Vampirism25 spell and replaces them with the Vamp50 spells...which shouldn't trigger anything thereafter without waiting another 24 hours.

...Help?

Scriptname VampireScriptshort hasdiseaseshort currentdayshort daycountshort vampdayshort vampupdateshort randomdreamshort dooncefloat vamphourfloat fQuestDelayTimebegin gamemodeif ( doonce == 0 )set randomdream to -1set fQuestDelayTime to 0.5set doonce to 1endifif ( PCVampire == -1 )returnendif;SCRIPTING FOR ACQUIRING VAMPIRISM;---------------------------------------------------------------------------------------------------------------------If ( hasdisease == 0 )if ( Player.IsSpellTarget VampDisease == 1 )set hasdisease to 1endifendif;If player has been cured of disease, reset 'hasdisease' varif ( hasdisease == 1 )if ( Player.IsSpellTarget VampDisease == 0 )set hasdisease to 0endifendifif ( hasdisease == 1 )if ( currentday == 0 )set currentday to GameDayelseif currentday != gamedayset daycount to ( daycount + 1 )set currentday to GameDayendifendifendif;If hasdisease still == 1, this is the first time the player has been in this state;give him introductory messagebox (TEMP) and reset hasdisease varif ( PCVampire == 1 )if ( hasdisease == 1 )if ( GetPCIssix 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."elseMessagebox "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."endifset hasdisease to -1player.addspell Vampirism25Player.addspell Vampirism25AttPlayer.addspell Vampirism25SkillsPlayer.addspell VampireHuntersSightplayer.removespell VampDiseaseplayer.setfactionrank playervampirefaction 0addtopic CureforVampirismStartQuest MS40set vampday to GameDayset vamphour to GameHourendifendif;SCRIPTING FOR STATE CHANGES AS A VAMPIRE;--------------------------------------------------------------------------------------------------------------------;First things first. If player has fed, reset Vampirism level to 25 and start the counters over againIf ( PCVampire >= 1 )if ( Player.HasVampireFed == 1 )Set PCVampire to 1;remove any spell from higher statesPlayer.removespell Vampirism50Player.removespell Vampirism50AttPlayer.removespell Vampirism50SkillsPlayer.removespell VampireSeductionPlayer.removespell Vampirism75Player.removespell Vampirism75AttPlayer.removespell Vampirism75SkillsPlayer.removespell VampireReignofTerrorPlayer.removespell Vampirism100Player.removespell Vampirism100AttPlayer.removespell Vampirism100SkillsPlayer.removespell VampireEmbraceofShadows;re-add state 1 spellsPlayer.addspell Vampirism25Player.addspell Vampirism25AttPlayer.addspell Vampirism25Skillsset vampupdate to 0set vampday to GameDayset vamphour to GameHourMessageBox "Your hunger for blood has been satisfied... for now."endifendif;Run a timer, checking for 24 hour intervals. If 24 hours have passed, increment vampupdate and reset hour/day varsif ( PCVampire >= 1 )if ( vampday != GameDay ); Following addition fixes a bug where resting precisely 24 hours multiple times with vamphour < 22 can result in non-changeif (vampday + 1 < GameDay)set vampupdate to 1set vampday to GameDayset vamphour to GameHourelseif ( vamphour < GameHour ) ; fix - vamphour is a float, not an int truncated to the hourset vampupdate to 1set vampday to GameDayset vamphour to GameHour; elseif ( vamphour >= 22 ) ; This case is already covered by the above fix. Also 24 hours and a minute ; if ( vampday + 1 < Gameday ) ; (the min for GD to be 2 over vd), is never less than 24 hours.; set vampupdate to 1; set vampday to Gameday; set vamphour to GameHour; endifendifendifendif;When VampireState doesn't match Vampirism Effect, update effectsif ( PCVampire == 2 )if ( Player.getav vampirism == 25 )Player.removespell Vampirism25Player.removespell Vampirism25AttPlayer.removespell Vampirism25SkillsPlayer.addspell Vampirism50Player.addspell Vampirism50AttPlayer.addspell Vampirism50SkillsPlayer.addspell VampireSeductionset randomdream to GetRandomPercentendifelseif ( PCVampire == 3 )if ( Player.getav vampirism == 50 )Player.removespell Vampirism50Player.removespell Vampirism50AttPlayer.removespell Vampirism50SkillsPlayer.addspell Vampirism75Player.addspell Vampirism75AttPlayer.addspell Vampirism75SkillsPlayer.addspell VampireReignofTerrorset randomdream to GetRandomPercentendifelseif ( PCVampire == 4 )if ( Player.getav Vampirism == 75 )Player.removespell Vampirism75Player.removespell Vampirism75AttPlayer.removespell Vampirism75SkillsPlayer.Addspell Vampirism100Player.addspell Vampirism100AttPlayer.addspell Vampirism100SkillsPlayer.addspell VampireEmbraceofShadowsset randomdream to GetRandomPercentendifendif;Pick dream text based on randomdream varif ( randomdream >= 0 )if ( randomdream <= 9 )MessageBox "You dream of long days spent basking in the sunlight of your native lands. You feel the warmth and the heat, and feel your body become refreshed. Then you awaken, knowing it was but a dream."set randomdream to -1elseif ( randomdream <= 19 )MessageBox "In your dream, you see a beautiful young woman holding an infant to her briast. It is only as you draw near that you realize that the woman is a desiccated corpse and the child is purple and bloated, dying of plague. As mother and child crumble to dust, you awaken. "set randomdream to -1elseif ( randomdream <= 29 )MessageBox "In your dream, an old wise-woman treats you for burns on your hands. As she applies a salve to your skin, you feel the tingle of magic as the pain begins to subside. But as you watch, the flesh of your hands begins to bubble, crack, and split, falling in chunks to the floor of her hut. As the wise-woman smiles, you wake up."set randomdream to -1elseif ( randomdream <= 39 )MessageBox "In a dream from your childhood you remember playing hiding games with your young friends on a warm summer afternoon. You hide in your parents’ barn, sure you will not be found. Soon, the sweet smell of hay is replaced by a darker, sickly smell. You move deeper into the barn, only to stumble on the rotting corpses of your parents, their throats ripped out. You try to scream as your parents rise and pull you into an embrace."set randomdream to -1elseif ( randomdream <= 49 )MessageBox "You dream of a sumptuous banquet spread out before you. You feast on a particularly choice cut of roasted meat, and its aroma makes your mouth water. It is only as you cut into the last portion that you see the larvae squirming inside. You cough blood as the larvae begin eating their way out of your stomach."set randomdream to -1elseif ( randomdream <= 59 )MessageBox "You lay on your back, with a blissful feeling of peace swirling through your brain. Your every muscle is relaxed. There is no tension in any part of your body. You feel completely at ease. As your vision comes into focus, you notice others standing around you. As a man leans towards you, you recognize the robes of the Necromancer, and you see a glint of light from his scalpel as it begins to cut through your flesh."set randomdream to -1elseif ( randomdream <= 69 )MessageBox "A warm, gentle breeze causes a tickle on your face, but as you go to brush it off, you find you cannot move your arms. Looking at your skin, you realize that it has turned to a brittle, green glass. Standing perfectly still, you breathe in shallow gulps of air, knowing that moving would cause your skin to shatter into thousands of pieces. The tickle on your face worsens, and you know that you are about to sneeze. As your skin shatters, you wake up sweating."set randomdream to -1elseif ( randomdream <= 79 )MessageBox "In your dream, you open your eyes to a beautiful blue sky. The sun is bright, but you feel cool, even a bit damp. You draw a breath but begin to cough, as you expel blood and dirt that you’ve inhaled into your lungs. As you try to draw another, you see a shovel of dirt being emptied onto your face. The sunlight grows fainter as you view it through the soil that covers your body. You would scream, but your mouth fills with dirt before you can make a sound."set randomdream to -1elseif ( randomdream <= 89 )MessageBox "In your dream, you approach a vampire ancient. Having just completed a perilous task for him, you swell with pride, sure that he will now bestow even greater power upon you. The entire clan’s eyes are upon you. Walking towards the dais where he stands, you realize that your task for him is actually unfinished, and that all of your vampiric powers have left you. You cry out as the clan descends upon you, and the ancient’s fangs rip into the flesh of your throat."set randomdream to -1elseif ( randomdream <= 99 )MessageBox "You dream of walking through the cool night air. Your body cries for blood, having not fed for days. Weakly, you stumble to a small pool. As you bend down to it, you see that it is not water in the pool, but warm, fresh blood, steam rising off of it. You lower your head to drink, but cannot open your mouth. As you realize in horror that your lips have been sewn shut, a pair of cold, white hands reach out from the pool and draw you under."set randomdream to -1endifendifEndBegin MenuMode;If player is resting after 3 days with disease, increment PCVampire and wake 'im upif ( hasdisease == 1 )if ( currentday == 0 )set currentday to GameDayelseif currentday != gamedayset daycount to ( daycount + 1 )set currentday to GameDayendifendifendifif ( hasdisease == 1 )if ( daycount >= 3 )if ( IsPCSleeping == 1 )WakeUpPC set PCVampire to 1endifendifendif;If player is ready for state change, check for time passing and increment PCVampireif ( PCVampire >= 1 )if ( PCVampire < 4 )if ( vampupdate == 1 )if ( IsTimePassing == 1 )set PCVampire to ( PCVampire + 1 )set vampupdate to 0set vampday to GameDayset vamphour to GameHour endifendifendifendifEnd

User avatar
Christine
 
Posts: 3442
Joined: Thu Dec 14, 2006 12:52 am


Return to IV - Oblivion