RuaDragonheart Posted February 18, 2006 Share Posted February 18, 2006 I'm trying to make a script where when the player picks up an item, namely a weapon, armor piece, or clothing, the PC sees a message and acquires a spell, but only once. I've managed to so far make it so it'll show the message and give the spell, but every time the item is picked up. I managed to figure out the scripting for it once a LONG time ago, but I no longer remember and Morrowind Scripting for Dummies is pretty much greek to me. Any suggestions on what the full script should look like? Link to comment Share on other sites More sharing options...
Cardboard Box Posted February 18, 2006 Share Posted February 18, 2006 Add a check for the spell in the PCs inventory. Basically, the test looks something likeif ( Player -> GetSpell, "SPELL_ID" ) return else Player -> AddSpell "SPELL_ID" endif Link to comment Share on other sites More sharing options...
RuaDragonheart Posted February 18, 2006 Author Share Posted February 18, 2006 So how would the whole thing look like? I want to add a message box as well, and I don't know scripting well enough to know how the whole thing would look like. Link to comment Share on other sites More sharing options...
Marxist ßastard Posted February 18, 2006 Share Posted February 18, 2006 Box's script would mean that the PC could never delete the spell. Whenever the item is picked up and the spell is deleted, it would be re-added to the player's inventory since getspell would return unsuccessfully. short doonce short onpcadd if ( doonce < 1 ) if ( onpcadd ) set doonce to 1 set onpcadd to 0 player->addspell "OMG LIEK ALL TEH SPALL EFFACTS LIEK A NEWCLEAR MUSSILE!!!11!" messagebox "As you grasp the OMG NUCLAR MUSSILE LANCHAR!!1, you feel a wrenching sensation. As you snap out of it, some arcane phrase suddenly takes hold in your mind." "OK" ; The next ten lines are purely optional if ( player->getintelligence > 60 ) messagebox "You have learned a new spell." elseif ( player->getwillpower > 72 ) messagebox "You resist the urge to say the phrase, but recognize it as some sort of spell. Aptly, you write it into your spellbook." else messagebox "You copy the phrase into your spellbook, for use later. Much later." messagebox "Acting on instinct, you say the phrase. Your voice booms and echoes, and power flows through your lips with each passing syllable. A lot of power, actually... You feel somewhat drained, and are unable to continue." player->playsound "Spell Failure Destruction" player->modcurrentmagicka -40 endif endif endif endif end Link to comment Share on other sites More sharing options...
RuaDragonheart Posted February 18, 2006 Author Share Posted February 18, 2006 How ironic. The person who gives me the code is the same who gave it to me last time. I remember the "spell effects are nuclear" thing. O.o Thanks for your help, it's much appreciated. Link to comment Share on other sites More sharing options...
Marxist ßastard Posted February 19, 2006 Share Posted February 19, 2006 If you're getting an odd situation with menumode with the player's intelligence below 60, and his willpower below 72, use the new version of the script. I've updated it since your post to change the second messagebox's type, reflecting a change I made in the test implementation, but forgot to apply to the post itself. Link to comment Share on other sites More sharing options...
RuaDragonheart Posted February 19, 2006 Author Share Posted February 19, 2006 Nah, it's alright. I didn't have any problems when I tested it out last night, and it worked exactly how I wanted it to. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.