Hi there! I'm trying to learn scripting for Skyrim, and boy is it difficult! I've been looking through tutorials; however, it seems all but the simplest scripts don't work for me. Here's a little thing I've been working on:
Scriptname JFTestScript01 extends Object Reference
{Button has varying responses based on player condition and action}
Message Property prizequestion Auto
Message Property prizequestionyes Auto
Message Property prizequestionno Auto
int count ;stores the number of times this object has been activated
int Button
int playersHealth
int PlayersMagicka
int PlayersStamina
Event OnActivate (ObjectReference akActionRef)
count = count + 1
if count == 1 ;initial conversation
Debug.MessageBox("Hello! My name is Button. Pleased to meet you.")
else if count == 2
Debug.MessageBox("Let me tell you a little about myself.")
else if count == 3
Debug.MessageBox("I was once an ordinary button. Then a wizard got bored. The end!")
else if count == 4
Debug.MessageBox("Now, what about you? Let's see...") ;message based on player condition
playersHealth = Game.GetPlayer().GetActorValue("Health")
playersMagicka = Game.GetPlayer().GetActorValue("Magicka")
playersStamina = Game.GetPlayer().GetActorValue("Stamina")
if playersHealth >= 160
Debug.MessageBox("You look tough!")
elseif playersMagicka >= 160
Debug.MessageBox("Know a bit about magic, don't you?")
elseif playersStamina >= 160
Debug.MessageBox("You look strong.")
else
Debug.MessageBox("Bit of a small fry, aren't you?")
endif
else if count == 5
Debug.MessageBox("Still here? Wow, no one talks to me this long! I like you! Press me again, and you'll get a prize!")
else if count == 6
prizequestion.show() ;asks player if they would like 1000 gold
if Button == 0
prizequestionyes.show() ;gives player 1000 gold if they answer in the affirmative
Game.GetPlayer() .AddItem (Gold001, 1000, True)
elseif Button == 1
prizequestionno.show() ; response if player answers in the negative
endif
else
Debug.MessageBox("I'm done talking for now.")
endif
EndEvent
This was supposed to be just a cutesy little thing that combined both the first couple of tutorials on the CK wiki, as well as the first tutorial for scripting on this site. But I can't get it to work!
Everything works up until the fourth message box. Then it stops working! I honestly don't know what I'm doing wrong. There are other things I'd like to do with this script, like adding a coin sound if you get the gold, but I can't get that to work either! If someone could at least give me some direction as to what I'm missing, I would greatly appreciate it. I have actual modding projects I want to work on, but I seem to hit such a barrier when it comes to scripting. It's pretty frustrating. :/