Sword in A book

Post » Fri May 27, 2011 11:32 pm

I think this is the third scripting topic I have posted in a week!
God...I wish scripting could stay in my head better, and it wasn't so hard to learn!!!!

anyways, I don't know how easy or hard this is, but to me it sounds rather simple:
The player finds a book with a sword in it. when the player grabs it, in the inventory the item will be in the Misc. tab called "Sword in book". When the player uses it, it gives the player both the book, and the sword. WAIT! but thats not it. the book is supposed to be cursed! so, it should also cast an effect on the player. Just a random magic spell that lasts x amount of time is fine, but if possible, could it give a disease?

if it is possible, post (IN EXTREME!! I cannot emphasize that word enough) detail how I can go about this. or just write the script and I fill in the variables that you do not know. (if you do option B, let me know what variable needs to go there, example, if you need the swords ID, just place "swordsID" so I know to put that in)

thank you all for being so helpful to me in my past posts! Hopefully you will be able to help me again!

(oh and if it is not possible, be sure to let me know, so I don't continue to bug you guys about it)

A script similar to what I am talking found in one of my loaded mods:
Spoiler
scriptname RCSeasonsRandomPresentScript

short RCRandomRoll

begin onEquip
Set RCRandomRoll to GetRandomPercent

if (RCRandomRoll <=75)
MessageBox "The present contained 25 Gold."
player.additem gold001 25
removeme
; player.removeitem RCXmasRandomPresent 1
return
elseif (RCRandomRoll <=80)
MessageBox "The present contained 300 Gold."
player.additem gold001 300
removeme
; player.removeitem RCXmasRandomPresent 1
return
elseif (RCRandomRoll <=83)
MessageBox "The present contained a Blackheart Pendant."
player.additem RCSeasonsBlackheartPendant 1
removeme
; player.removeitem RCXmasRandomPresent 1
return
elseif (RCRandomRoll <=85)
MessageBox "The present contained a Blackheart Ring."
player.additem RCSeasonsBlackheartRing 1
removeme
; player.removeitem RCXmasRandomPresent 1
return
elseif (RCRandomRoll <=88)
MessageBox "The present contained an Rusty Tankard."
player.additem RCSeasonsRustyMug 1
removeme
; player.removeitem RCXmasRandomPresent 1
return
elseif (RCRandomRoll <=90)
MessageBox "The present contained an Enchanted Tankard."
player.additem RCSeasonsMugEn 1
removeme
; player.removeitem RCXmasRandomPresent 1
return
elseif (RCRandomRoll <=93)
MessageBox "The present contained a Yuletide Hat."
player.additem RCXmasHat001 1
removeme
; player.removeitem RCXmasRandomPresent 1
return
elseif (RCRandomRoll <=95)
MessageBox "The present contained an Enchanted Yuletide Hat."
player.additem RCXmasHat003 1
removeme
; player.removeitem RCXmasRandomPresent 1
return
else
MessageBox "The present contained a Snowman mask."
player.additem RCSnowmanMask 1
removeme
; player.removeitem RCXmasRandomPresent 1
return
endif

end


Remove all the random rolls, make a few changes here and there, put in MY item names, and that should work for the book and sword correct?
Now what about the magic effect?

Oh, one last thing.
If I gave someone two .dds files, could you put one (a sword) ontop of the other (a book) to represent the sword in the book? You know, the icon for when this item is in the players inventory.
User avatar
Amy Smith
 
Posts: 3339
Joined: Mon Feb 05, 2007 10:04 pm

Post » Sat May 28, 2011 9:48 am

anyways, I don't know how easy or hard this is, but to me it sounds rather simple:
The player finds a book with a sword in it. when the player grabs it, in the inventory the item will be in the Misc. tab called "Sword in book".


1 Mesh: sword in book.

When the player uses it, it gives the player both the book, and the sword. WAIT! but thats not it. the book is supposed to be cursed! so, it should also cast an effect on the player. Just a random magic spell that lasts x amount of time is fine, but if possible, could it give a disease?

Uses..... How?.... and When?.....Quest?.......1 mesh will turn into 2 others. Resulting 3 meshes. If when "used" add book & sword to player, book is cursed, player is cursed for amount time(indefinite?), sword is sharp & poisoned, go kill demon, demon killed, remove curse, sword is yours. Sell sword for $.

if it is possible, post (IN EXTREME!! I cannot emphasize that word enough) detail how I can go about this. or just write the script and I fill in the variables that you do not know. (if you do option B, let me know what variable needs to go there, example, if you need the swords ID, just place "swordsID" so I know to put that in)

thank you all for being so helpful to me in my past posts! Hopefully you will be able to help me again!

(oh and if it is not possible, be sure to let me know, so I don't continue to bug you guys about it)

A script similar to what I am talking found in one of my loaded mods:


Spoiler

Similar???..... http://cs.elderscrolls.com/constwiki/index.php/Rand....or http://cs.elderscrolls.com/constwiki/index.php/GetRandomPercent What script? Please post the actual script you are using...It helps...a lot for those who are trying to help....NOT someone else's script that may be "borked" for your purposes...
It's a little tricky and takes abit of time to sometimes get a script to work the way you want it to.
spoiler: learn to script- http://cs.elderscrolls.com/constwiki/index.php/Portal:Scripting

Remove all the random rolls, make a few changes here and there, put in MY item names, and that should work for the book and sword correct?
Now what about the magic effect?

Oh, one last thing.
If I gave someone two .dds files, could you put one (a sword) ontop of the other (a book) to represent the sword in the book? You know, the icon for when this item is in the players inventory.

Sure I could guide you through the process:

Get dds convertor.
http://eliteforce2.filefront.com/file/DDS_Converter;29412

Convert both files to png.

Open both in a graphics program. place one upon the other and merge the results(flatten image)

Export or (save as) whatever.dds Save as dxt3 explicit alpha NO mipmaps for the icon. Icons need to be 64x64pixels.
User avatar
maya papps
 
Posts: 3468
Joined: Mon Aug 07, 2006 3:44 pm

Post » Sat May 28, 2011 5:43 am

1 Mesh: sword in book.


Uses..... How?.... and When?.....Quest?.......1 mesh will turn into 2 others. Resulting 3 meshes. If when "used" add book & sword to player, book is cursed, player is cursed for amount time(indefinite?), sword is sharp & poisoned, go kill demon, demon killed, remove curse, sword is yours. Sell sword for $.



Spoiler

Similar???..... http://cs.elderscrolls.com/constwiki/index.php/Rand....or http://cs.elderscrolls.com/constwiki/index.php/GetRandomPercent What script? Please post the actual script you are using...It helps...a lot for those who are trying to help....NOT someone else's script that may be "borked" for your purposes...
It's a little tricky and takes abit of time to sometimes get a script to work the way you want it to.
spoiler: learn to script- http://cs.elderscrolls.com/constwiki/index.php/Portal:Scripting


Sure I could guide you through the process:

Get dds convertor.
http://eliteforce2.filefront.com/file/DDS_Converter;29412

Convert both files to png.

Open both in a graphics program. place one upon the other and merge the results(flatten image)

Export or (save as) whatever.dds Save as dxt3 explicit alpha NO mipmaps for the icon. Icons need to be 64x64pixels.


no, the actual world object would probably be something simple. I don't have texturing knowledge, I don't have the knowledge to make 3D objects for Oblivon, and I know near to nothing about scripting. So the world object would probably be just a book (as unrealistic as that is).
The player finds the sword in the book in a chest, when the player takes, hopefully they won't drop the item, and use it in the inventory. In the inventory it will have the icon should be what was named above, a sword ontop of a book to represent the sword in the book.
When the player equips it (clicks on it) it will remove the item "sword in book" and the player will receive the book, a sword, and either a disease that can be cured by simply going to a wayshrine and getting it removed, or using a potion of cure disease.
If a disease cannot be scripted upon equiping the sword in the book, then the other option is a spell that would slowly kill the player over...I don't know...like 600 seconds.

about the RC43Christmas script, well I don't have a script written. Like I said, I have near to no scripting knowledge. I am able to read some scripting to see if it does what I want, but I can't actually write it.
That script listed does somewhat what I am talking about as far as getting 2 items (it doesn't cast a spell on the player though). Basically in the mod, you can find little christmas presents, when you "equip" them, the actual "Christmas gift" disappears, but the player gains one item from the "random roll".

So I am wondering if I change it so that it is not a random roll, or set 2 random rolls both at a 100% chance, if that would work. (Ofcourse change the script from RC43Christmas to the name of my mod, and change some other things to fit my mod, not that one)

and thank you for teaching me how to make a .dds icon :)

*EDIT:

one last bit of help...It has been a LONG time since I last imported a custom item into the game, so could you refresh me on that too? don't I need a program called like...Nif scope or something?
(btw, the custom item I am using is someone's elses, but YES, I do have permission to use it.)
User avatar
lucile
 
Posts: 3371
Joined: Thu Mar 22, 2007 4:37 pm

Post » Fri May 27, 2011 11:15 pm

(sorry for a second post)

Well, I transformed the RC43Christmas present box script into this script. I am about to test it, but let me know if I need to fix anything. Also, I still need to know how it will add a disease/spell effect to the player.

Spoiler
scriptname CSbookScript

short CSRandomRoll

begin onEquip
Set CSRandomRoll to GetRandomPercent

if (CSRandomRoll <=100)
MessageBox "I pulled the sword out of the book. It seems most of the book is still legible"
player.additem CSbookOfLove 1
player.additem WeapDaedricShortsword 1
removeme
; player.removeitem CSSwordInBook 1
return
endif

end


(both items retrieved are place holders. Once I learned how to import my custom items those items will be replaced with their actual counterpart.)

EDIT:
I'm so impatient! :banghead:
I need answers! I have been googling for answers for the past 2 hours and...well I got somewhat of a result on scripting something add a magic effect, but it won't work on the OnEquip command. I also tried it for Begin Gamemode and it still did not work.
So how does an equip item cast an effect?

And I still can't get answers on importing custom models/textures into the CS. I searched google and didn't really get any results.
User avatar
casey macmillan
 
Posts: 3474
Joined: Fri Feb 09, 2007 7:37 pm

Post » Sat May 28, 2011 10:44 am

Use NifSkope to set the texture paths and what not for the NIF. Then, all you have to do in the CS is select the NIF to correspond to the item. The texture that a model references is not set in the CS...as far as I know. If the mesh is already set to look for the texture, then you do not have to do much. The only texture you set for an item in the CS is the icon, I believe.

Edit: Have you looked at the script for another mod that infects the player or has a curse on Xevent type thing?

Edit:

Spoiler


scriptname CSbookScript

short CSRandomRoll

begin onEquip
Set CSRandomRoll to GetRandomPercent

if (CSRandomRoll <=100)
MessageBox "I pulled the sword out of the book. It seems most of the book is still legible"
player.additem CSbookOfLove 1
player.additem WeapDaedricShortsword 1
removeme
; player.removeitem CSSwordInBook 1
return
endif
end

Begin GameMode
Set CSRandomRoll to 1 ;test the CSCurse
if (CSRandomRoll == 1)
cast CSCurse player
endif
end

end

User avatar
GabiiE Liiziiouz
 
Posts: 3360
Joined: Mon Jan 22, 2007 3:20 am

Post » Sat May 28, 2011 2:07 am

hmmmmm.....sadly that didn't work...
Maybe I should try a different approach. I don't know if it is easier to do it with a book, but maybe, rather than having the effect cast on the player upon "removing" the sword from the book, maybe it would be cast upon reading the book.
User avatar
Eileen Collinson
 
Posts: 3208
Joined: Thu Dec 28, 2006 2:42 am

Post » Sat May 28, 2011 10:24 am

Are you sure the cast is working? That was the whole point of hard coding the variable to the trigger value. Is that part of the script not being executed?

Edit: never mind
User avatar
Lance Vannortwick
 
Posts: 3479
Joined: Thu Sep 27, 2007 5:30 pm

Post » Fri May 27, 2011 9:33 pm

Are you sure the cast is working? That was the whole point of hard coding the variable to the trigger value. Is that part of the script not being executed?

Edit: What happens if you take off that random "end" after the "end if"?


it wouldn't let me save the script without removing one of those "end" so...yes I tried.
I will try putting a vanilla spell instead of the modded one and see what happens.
User avatar
Alan Cutler
 
Posts: 3163
Joined: Sun Jul 01, 2007 9:59 am

Post » Sat May 28, 2011 12:34 am

Have you tried a different http://cs.elderscrolls.com/constwiki/index.php/Begin? one that has to do with the sword being added or something?
User avatar
Emily Shackleton
 
Posts: 3535
Joined: Sun Feb 11, 2007 12:36 am

Post » Fri May 27, 2011 10:04 pm

hmm...thats a good idea. I will try a different one. But I am curious. I the CSCurse is a "disease". and I just tested a "spell" on the script. Might you have to use a specific type of magic for it to work properly?

there is
Ability
Disease
Lesser Power
Power
Spell

to choose from.

EDIT
I think the Vampire Script might hold the answer to what I want. Even better is this mod that I found that converts vamprism into a disease, where - if the disease is to be cured - it will automatically be placed back on the PC...
I don't entirely know what I am doing so please help out.
Here is the original vamp disease script:
Spoiler
Scriptname VampireScript


short hasdisease
short currentday
short daycount
short vampday
short vampupdate
short randomdream
short doonce

float vamphour
float fQuestDelayTime

begin gamemode

if ( doonce == 0 )
set randomdream to -1
set fQuestDelayTime to 0.5
set doonce to 1
endif

if ( PCVampire == -1 )
return
endif


;SCRIPTING FOR ACQUIRING VAMPIRISM
;---------------------------------------------------------------------------------------------------------------------

If ( hasdisease == 0 )
if ( Player.IsSpellTarget VampDisease == 1 )
set hasdisease to 1
endif
endif

;If player has been cured of disease, reset 'hasdisease' var

if ( hasdisease == 1 )
if ( Player.IsSpellTarget VampDisease == 0 )
set hasdisease to 0
endif
endif

if ( hasdisease == 1 )
if ( currentday == 0 )
set currentday to GameDay
else
if currentday != gameday
set daycount to ( daycount + 1 )
set currentday to GameDay
endif
endif
endif
;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 ( 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."
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.addspell Vampirism25
Player.addspell Vampirism25Att
Player.addspell Vampirism25Skills
Player.addspell VampireHuntersSight
player.removespell VampDisease
player.setfactionrank playervampirefaction 0
addtopic CureforVampirism
StartQuest MS40
set vampday to GameDay
set vamphour to GameHour
endif
endif

;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 Vampirism50Att
Player.removespell Vampirism50Skills
Player.removespell VampireSeduction
Player.removespell Vampirism75
Player.removespell Vampirism75Att
Player.removespell Vampirism75Skills
Player.removespell VampireReignofTerror
Player.removespell Vampirism100
Player.removespell Vampirism100Att
Player.removespell Vampirism100Skills
Player.removespell VampireEmbraceofShadows

;re-add state 1 spells

Player.addspell Vampirism25
Player.addspell Vampirism25Att
Player.addspell Vampirism25Skills
set vampday to GameDay
set vamphour to GameHour
MessageBox "Your hunger for blood has been satisfied... for now."
endif
endif

;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
endif
endif



;When VampireState doesn't match Vampirism Effect, update effects

if ( PCVampire == 2 )
if ( Player.getav vampirism == 25 )
Player.removespell Vampirism25
Player.removespell Vampirism25Att
Player.removespell Vampirism25Skills
Player.addspell Vampirism50
Player.addspell Vampirism50Att
Player.addspell Vampirism50Skills
Player.addspell VampireSeduction
set randomdream to GetRandomPercent
endif
elseif ( PCVampire == 3 )
if ( Player.getav vampirism == 50 )
Player.removespell Vampirism50
Player.removespell Vampirism50Att
Player.removespell Vampirism50Skills
Player.addspell Vampirism75
Player.addspell Vampirism75Att
Player.addspell Vampirism75Skills
Player.addspell VampireReignofTerror
set randomdream to GetRandomPercent
endif
elseif ( PCVampire == 4 )
if ( Player.getav Vampirism == 75 )
Player.removespell Vampirism75
Player.removespell Vampirism75Att
Player.removespell Vampirism75Skills
Player.Addspell Vampirism100
Player.addspell Vampirism100Att
Player.addspell Vampirism100Skills
Player.addspell VampireEmbraceofShadows
set randomdream to GetRandomPercent
endif
endif


;Pick dream text based on randomdream var

if ( 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 -1
elseif ( 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 -1
elseif ( 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 -1
elseif ( 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 -1
elseif ( 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 -1
elseif ( 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 -1
elseif ( 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 -1
elseif ( 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 -1
elseif ( 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 -1
elseif ( 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 -1
endif
endif




End


Begin MenuMode

;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
endif
endif


if ( hasdisease == 1 )
if ( daycount >= 3 )
if ( IsPCSleeping == 1 )
WakeUpPC
set PCVampire to 1
endif
endif
endif

;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
endif
endif

End


Here is the modified version that I am looking through for the "add disease" effect that I need to apply to my item. (both scripts are very similar, just have small modifications)
Spoiler
Scriptname VampireScript

short PlayerResistMagic
short PlayerResistDisease


short hasdisease
short currentday
short daycount
short vampday
short vampupdate
short randomdream
short doonce

float vamphour
float fQuestDelayTime

begin gamemode

if ( doonce == 0 )
set randomdream to -1
set fQuestDelayTime to 0.5
set doonce to 1
endif

if ( ( Player.IsSpellTarget Vampirism25 || Player.IsSpellTarget Vampirism25Att || Player.IsSpellTarget Vampirism25Skills ) && PCVampire != 1 )
Player.removespell PCVampirism25
endif

if ( ( Player.IsSpellTarget Vampirism50 || Player.IsSpellTarget Vampirism50Att || Player.IsSpellTarget Vampirism50Skills ) && PCVampire != 2 )
Player.removespell PCVampirism50
endif

if ( ( Player.IsSpellTarget Vampirism75 || Player.IsSpellTarget Vampirism75Att || Player.IsSpellTarget Vampirism75Skills ) && PCVampire != 3 )
Player.removespell PCVampirism75
endif

if ( ( Player.IsSpellTarget Vampirism100 || Player.IsSpellTarget Vampirism100Att || Player.IsSpellTarget Vampirism100Skills ) && PCVampire != 4 )
Player.removespell PCVampirism100
endif

if ( PCVampire == -1 )
return
endif

;SCRIPTING FOR ACQUIRING VAMPIRISM
;---------------------------------------------------------------------------------------------------------------------

If ( hasdisease == 0 )
if ( Player.IsSpellTarget VampDisease == 1 )
set hasdisease to 1
endif
endif

;If player has been cured of disease, reset 'hasdisease' var

if ( hasdisease == 1 )
if ( Player.IsSpellTarget VampDisease == 0 )
set hasdisease to 0
endif
endif

if ( hasdisease == 1 )
if ( currentday == 0 )
set currentday to GameDay
else
if currentday != gameday
set daycount to ( daycount + 1 )
set currentday to GameDay
endif
endif
endif
;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 ( 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."
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
set PlayerResistMagic to player.GetActorValue ResistMagic
set PlayerResistMagic to ( 0 - PlayerResistMagic )
set PlayerResistDisease to player.GetActorValue ResistDisease
set PlayerResistDisease to ( 0 - PlayerResistDisease )
player.ModActorValue ResistMagic PlayerResistMagic
player.ModActorValue ResistDisease PlayerResistDisease
player.addspell PCVampirism25
Player.addspell VampireHuntersSight
set PlayerResistMagic to ( 0 - PlayerResistMagic )
set PlayerResistDisease to ( 0 - PlayerResistDisease )
player.ModActorValue ResistMagic PlayerResistMagic
player.ModActorValue ResistDisease PlayerResistDisease
player.removespell VampDisease
player.setfactionrank playervampirefaction 0
addtopic CureforVampirism
StartQuest MS40
set vampday to GameDay
set vamphour to GameHour
endif
endif

;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 PCVampirism50
Player.removespell VampireSeduction
Player.removespell PCVampirism75
Player.removespell VampireReignofTerror
Player.removespell PCVampirism100
Player.removespell VampireEmbraceofShadows

;re-add state 1 spells

set PlayerResistMagic to player.GetActorValue ResistMagic
set PlayerResistMagic to ( 0 - PlayerResistMagic )
set PlayerResistDisease to player.GetActorValue ResistDisease
set PlayerResistDisease to ( 0 - PlayerResistDisease )
player.ModActorValue ResistMagic PlayerResistMagic
player.ModActorValue ResistDisease PlayerResistDisease
Player.addspell PCVampirism25
set PlayerResistMagic to ( 0 - PlayerResistMagic )
set PlayerResistDisease to ( 0 - PlayerResistDisease )
player.ModActorValue ResistMagic PlayerResistMagic
player.ModActorValue ResistDisease PlayerResistDisease
set vampday to GameDay
set vamphour to GameHour
MessageBox "Your hunger for blood has been satisfied... for now."
endif
endif

;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
endif
endif


;When VampireState doesn't match Vampirism Effect, update effects



;Pick dream text based on randomdream var

if ( 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 -1
elseif ( 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 -1
elseif ( 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 -1
elseif ( 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?f 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 -1
elseif ( 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 -1
elseif ( 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 -1
elseif ( 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 -1
elseif ( 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?fve 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 -1
elseif ( 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?fs 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?fs fangs rip into the flesh of your throat."
set randomdream to -1
elseif ( 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 -1
endif
endif

if ( player.GetActorValue Vampirism != 25 && PCVampire == 1 )
Player.removespell PCVampirism50
Player.removespell PCVampirism75
Player.removespell PCVampirism100
set PlayerResistMagic to player.GetActorValue ResistMagic
set PlayerResistMagic to ( 0 - PlayerResistMagic )
set PlayerResistDisease to player.GetActorValue ResistDisease
set PlayerResistDisease to ( 0 - PlayerResistDisease )
player.ModActorValue ResistMagic PlayerResistMagic
player.ModActorValue ResistDisease PlayerResistDisease
Player.addspell PCVampirism25
set PlayerResistMagic to ( 0 - PlayerResistMagic )
set PlayerResistDisease to ( 0 - PlayerResistDisease )
player.ModActorValue ResistMagic PlayerResistMagic
player.ModActorValue ResistDisease PlayerResistDisease
return
endif

if ( player.GetActorValue Vampirism != 50 && PCVampire == 2 )
Player.removespell PCVampirism25
Player.removespell PCVampirism75
Player.removespell PCVampirism100
set PlayerResistMagic to player.GetActorValue ResistMagic
set PlayerResistMagic to ( 0 - PlayerResistMagic )
set PlayerResistDisease to player.GetActorValue ResistDisease
set PlayerResistDisease to ( 0 - PlayerResistDisease )
player.ModActorValue ResistMagic PlayerResistMagic
player.ModActorValue ResistDisease PlayerResistDisease
Player.addspell PCVampirism50
set PlayerResistMagic to ( 0 - PlayerResistMagic )
set PlayerResistDisease to ( 0 - PlayerResistDisease )
player.ModActorValue ResistMagic PlayerResistMagic
player.ModActorValue ResistDisease PlayerResistDisease
return
endif

if ( player.GetActorValue Vampirism != 75 && PCVampire == 3 )
Player.removespell PCVampirism25
Player.removespell PCVampirism50
Player.removespell PCVampirism100
set PlayerResistMagic to player.GetActorValue ResistMagic
set PlayerResistMagic to ( 0 - PlayerResistMagic )
set PlayerResistDisease to player.GetActorValue ResistDisease
set PlayerResistDisease to ( 0 - PlayerResistDisease )
player.ModActorValue ResistMagic PlayerResistMagic
player.ModActorValue ResistDisease PlayerResistDisease
Player.addspell PCVampirism75
set PlayerResistMagic to ( 0 - PlayerResistMagic )
set PlayerResistDisease to ( 0 - PlayerResistDisease )
player.ModActorValue ResistMagic PlayerResistMagic
player.ModActorValue ResistDisease PlayerResistDisease
return
endif

if ( player.GetActorValue Vampirism != 100 && PCVampire == 4 )
Player.removespell PCVampirism25
Player.removespell PCVampirism50
Player.removespell PCVampirism75
set PlayerResistMagic to player.GetActorValue ResistMagic
set PlayerResistMagic to ( 0 - PlayerResistMagic )
set PlayerResistDisease to player.GetActorValue ResistDisease
set PlayerResistDisease to ( 0 - PlayerResistDisease )
player.ModActorValue ResistMagic PlayerResistMagic
player.ModActorValue ResistDisease PlayerResistDisease
Player.addspell PCVampirism100
set PlayerResistMagic to ( 0 - PlayerResistMagic )
set PlayerResistDisease to ( 0 - PlayerResistDisease )
player.ModActorValue ResistMagic PlayerResistMagic
player.ModActorValue ResistDisease PlayerResistDisease
return
endif

End


Begin MenuMode

;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
endif
endif


if ( hasdisease == 1 )
if ( daycount >= 3 )
if ( IsPCSleeping == 1 )
WakeUpPC
set PCVampire to 1
endif
endif
endif

;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
endif
endif


if ( PCVampire == 2 )
if ( Player.getav vampirism == 25 )
Player.removespell PCVampirism25
set PlayerResistMagic to player.GetActorValue ResistMagic
set PlayerResistMagic to ( 0 - PlayerResistMagic )
set PlayerResistDisease to player.GetActorValue ResistDisease
set PlayerResistDisease to ( 0 - PlayerResistDisease )
player.ModActorValue ResistMagic PlayerResistMagic
player.ModActorValue ResistDisease PlayerResistDisease
Player.addspell PCVampirism50
Player.addspell VampireSeduction
set PlayerResistMagic to ( 0 - PlayerResistMagic )
set PlayerResistDisease to ( 0 - PlayerResistDisease )
player.ModActorValue ResistMagic PlayerResistMagic
player.ModActorValue ResistDisease PlayerResistDisease
set randomdream to GetRandomPercent
endif
elseif ( PCVampire == 3 )
if ( Player.getav vampirism == 50 )
Player.removespell PCVampirism50
set PlayerResistMagic to player.GetActorValue ResistMagic
set PlayerResistMagic to ( 0 - PlayerResistMagic )
set PlayerResistDisease to player.GetActorValue ResistDisease
set PlayerResistDisease to ( 0 - PlayerResistDisease )
player.ModActorValue ResistMagic PlayerResistMagic
player.ModActorValue ResistDisease PlayerResistDisease
Player.addspell PCVampirism75
Player.addspell VampireReignofTerror
set PlayerResistMagic to ( 0 - PlayerResistMagic )
set PlayerResistDisease to ( 0 - PlayerResistDisease )
player.ModActorValue ResistMagic PlayerResistMagic
player.ModActorValue ResistDisease PlayerResistDisease
set randomdream to GetRandomPercent
endif
elseif ( PCVampire == 4 )
if ( Player.getav Vampirism == 75 )
Player.removespell PCVampirism75
set PlayerResistMagic to player.GetActorValue ResistMagic
set PlayerResistMagic to ( 0 - PlayerResistMagic )
set PlayerResistDisease to player.GetActorValue ResistDisease
set PlayerResistDisease to ( 0 - PlayerResistDisease )
player.ModActorValue ResistMagic PlayerResistMagic
player.ModActorValue ResistDisease PlayerResistDisease
Player.addspell PCVampirism100
Player.addspell VampireEmbraceofShadows
set PlayerResistMagic to ( 0 - PlayerResistMagic )
set PlayerResistDisease to ( 0 - PlayerResistDisease )
player.ModActorValue ResistMagic PlayerResistMagic
player.ModActorValue ResistDisease PlayerResistDisease
set randomdream to GetRandomPercent
endif
endif



End




please, please help! I have spent so many hours looking for an answer to this and have had no results thus far.

EDIT:
:celebration: :celebration: :celebration: :celebration: :celebration:
:D :clap: :toughninja:
OH!!! Rejoice, REJOICE!!!! *throws confetti*
The answer was under my nose the whole time!!!!! Oh my god!!! YES!!!! THE ALMIGHTY PURPLEXING SCRIPTING PUZZLE
HAS
BEEN
SOLVED!
it's so simple!!! just like player.additem, all I had to do was change 1 word in that line of script in the CSRandomRoll block and I would also add the spell effect!!!
player.addspell CSCurse! It's so simple!
I was going through all thsi complicated stuff just to figure that one thing out! I feel so AWESOME! SO SUCCESSFULL!!!!

This thread is done :)
User avatar
Jade MacSpade
 
Posts: 3432
Joined: Thu Jul 20, 2006 9:53 pm

Post » Sat May 28, 2011 10:23 am

Congratulations! Good for you. :)
User avatar
Lynette Wilson
 
Posts: 3424
Joined: Fri Jul 14, 2006 4:20 pm

Post » Fri May 27, 2011 11:30 pm

*Looks back at all the faults everyone else has been through because at the point they where at, they where as "unknowing" or "ignorant" as I was*

*and smiles* Knowing I was there once.

I felt frustrated back then also. Don't feel bad. It takes time to learn scripting. Sometimes you want it to work exactly the way you want to. Sometimes that is possible, other times it is "supposedly not". I, most of the time, try to find a work-around to the problem at hand, which in turn, turns into knowledge on both ends of the problem. Say a scripter or modeler or texturer could do their parts. OK. Everyone has the resources, but only one who has the knowledge of how to put it all together to get it to work right (The way the original Idea was intended to work), will get it to work right.

Begin GameMode
...If "It doesn't work the first time"
......Fail
...ElseIf "It half works... Look at what you got and compare."
......Blablabla.whattheheckwhentwrong
...Endif
End

Begin (Re)GameMode
...If "It still isn't working"
......Change Script.study
...Endif
End

Begin (ReRe)GameMode
...If "It still isn't working"
......Change Script.study
...Endif
End

Begin (ReReRe)GameMode
...If "It still isn't working"
......Change Script.study
...Endif
End

Begin (ReReReRe)GameMode
...If "It still isn't working"
......Ask Questions (particular)
......Find Answers (If any)
...ElseIf
......Change Script.study
......Study.more
......Study.evenmore
......TrySomethingNew.(SomethingsSomeoneElseWouldn'tDo).Think
...EndIf

BeginGameMode
...If "I worked on this script for a week or 3 months or 2 mins and it works correctly"
......PartyTime.UntilTheNextLine
ElseIf.............


Congats.
User avatar
tiffany Royal
 
Posts: 3340
Joined: Mon Dec 25, 2006 1:48 pm


Return to IV - Oblivion