basvanbeu Posted April 1, 2012 Share Posted April 1, 2012 HiIm new to skyrim scripting and have problem with simple script that is going to add an item to the players inventory when he starts his game.In Oblivion there was GameMode. Here it is Event. Event seems smarter, better but also harder.. My question is what kind of Event should I have on this one ? This is how my simple script looks: Scriptname RM1964DialogueScript int RMCount Event SOMETHINGRMCount = 0If RMCount == 0Game.GetPlayer().AddItem(RM1964NordPassport, 1, false)RMCount = RMCount +1EndIfEndEvent Link to comment Share on other sites More sharing options...
fg109 Posted April 1, 2012 Share Posted April 1, 2012 First of all, what kind of script is it? If it's a quest script, your first line should be: Scriptname RM1964DialogueScript extends Quest If it's a script for a dialogue topic, it should be: Scriptname RM1964DialogueScript extends TopicInfo If you're using a quest script, I would use the OnInit event. But the OnInit event fires twice in a row when the quest is started. I don't remember exactly why, but all the variables are reset to their initial values before it runs. So after the first time it fires, RMCount goes back to 0. Which is why instead of using a variable, you should just use GetItemCount to see if the player already has the item. If you're using a topic info script, I don't know. I've never messed with them but I think they're just a combination of the papyrus fragments in the dialogue topic. Instead of actually making a script, I would just put Game.GetPlayer().AddItem(RM1964NordPassport, 1, false) into the fragment. Before you do that though, you would need to compile some fake code like: akSpeaker.Kill() Then add the property for RM1964NordPassport into the script that gets created, before deleting the fake code and putting in your real code. Link to comment Share on other sites More sharing options...
Recommended Posts