RuaDragonheart
Feb 18 2006, 10:23 AM
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?
Cardboard Box
Feb 18 2006, 10:46 AM
Add a check for the spell in the PCs inventory. Basically, the test looks something like
CODE
if ( Player -> GetSpell, "SPELL_ID" )
return
else
Player -> AddSpell "SPELL_ID"
endif
RuaDragonheart
Feb 18 2006, 10:49 AM
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.
Marxist ßastard
Feb 18 2006, 03:12 PM
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.
[codebox]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[/codebox]
RuaDragonheart
Feb 18 2006, 08:44 PM
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.
Marxist ßastard
Feb 19 2006, 09:21 AM
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.
RuaDragonheart
Feb 19 2006, 07:26 PM
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.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.