The Nexus Forums: Scripting Question - The Nexus Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Scripting Question

#1 User is offline   RuaDragonheart 

  • Enthusiast
  • PipPip
  • Group: Members
  • Posts: 109
  • Joined: 24-July 04

Posted 18 February 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?
0

#2 User is offline   Cardboard Box 

  • Regular
  • PipPip
  • Group: Members
  • Posts: 64
  • Joined: 07-July 05

Posted 18 February 2006 - 10:46 AM

Add a check for the spell in the PCs inventory. Basically, the test looks something like
if ( Player -> GetSpell, "SPELL_ID" )
	return
else
	Player -> AddSpell "SPELL_ID"
endif

0

#3 User is offline   RuaDragonheart 

  • Enthusiast
  • PipPip
  • Group: Members
  • Posts: 109
  • Joined: 24-July 04

Posted 18 February 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.
0

#4 User is offline   Marxist ßastard 

  •                  C:\>
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,621
  • Joined: 27-August 03

Posted 18 February 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.

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

0

#5 User is offline   RuaDragonheart 

  • Enthusiast
  • PipPip
  • Group: Members
  • Posts: 109
  • Joined: 24-July 04

Posted 18 February 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.
0

#6 User is offline   Marxist ßastard 

  •                  C:\>
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,621
  • Joined: 27-August 03

Posted 19 February 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.
0

#7 User is offline   RuaDragonheart 

  • Enthusiast
  • PipPip
  • Group: Members
  • Posts: 109
  • Joined: 24-July 04

Posted 19 February 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.
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Skin by Skinbox
Quality & cheap IPB skins, premade vBulletin styles, cheap Web templates and more! - Skinbox