Jump to content

Scripting help


silverdragon5

Recommended Posts

This mod(http://www.nexusmods.com/skyrim/mods/21765/?) uses a script that gives speech experience when a book is read. However it gives full experience for each individual copy of a book read. So if you had 10 copies of a book the script will give full exp for each read. Does anyone know how the script can be altered so it only gives exp for one copy of the book? Here is the script for reference:

 

Scriptname AdvanceSpeech extends ObjectReference

Int Property SpeechIncrease = 600 Auto
Int SpeechGained = 0

Event OnRead()
if SpeechIncrease < 600
SpeechIncrease = 600
endif

if SpeechGained == 0
Int currentSpeechLevel = Game.GetPlayer().GetActorValue("Speechcraft") as int
if currentSpeechLevel < 5
currentSpeechLevel = 5
endif
float extraSkill = currentSpeechLevel * 0.01
extraSkill = 1 + extraSkill
float incrementSkill = SpeechIncrease * extraSkill

Game.AdvanceSkill("Speechcraft",incrementSkill )
SpeechGained = 1
Debug.Notification("Your speechcraft is now enriched!" )

elseif SpeechGained == 1
Game.AdvanceSkill("Speechcraft",200 )
SpeechGained = 2
Debug.Notification("Yourr speechcraft is improved a bit more...")

else
Debug.Notification("Nothing new to learn from this book.")

endif
endEvent

 

Also could someone tell me how to change the exp gain to be given when the book is closed?

Edited by silverdragon5
Link to comment
Share on other sites

I'm not quite sure what you are trying to achieve here.

 

In the book menu in the Creation kit there is a tab called 'teaches' and you have to select spell or skill. Then you can select the skill from the drop-down menu and it will boost it by 1 point when you read it for the first time like a normal skill book.

 

If that's not you mean can you please try to explain it a little better.

 

Thanks,

 

Anikma.

Link to comment
Share on other sites

  On 3/19/2014 at 10:49 AM, Anikma said:

I'm not quite sure what you are trying to achieve here.

 

In the book menu in the Creation kit there is a tab called 'teaches' and you have to select spell or skill. Then you can select the skill from the drop-down menu and it will boost it by 1 point when you read it for the first time like a normal skill book.

 

If that's not you mean can you please try to explain it a little better.

 

Thanks,

 

Anikma.

 

The mod gives speech skill experience for reading books so you have a means of speech exp other than selling items and the few speech checks in the game. The problem is that say you read Immortal Blood, the script uses a formula to give you exp. Then if you read it again you get less exp. But it does this for every copy of any non- skill book. So if you have 10 copies of immortal blood you get the exp that same exp 10 times over.

 

So I want to see if there's a way to make the script recognize copies of a book you've already read. If not then since I like the idea of this mod I may just lower the exp each read gives so its not overpowered.

 

 

  On 3/19/2014 at 11:44 AM, IsharaMeradin said:

Check how Unread Books Glow works. It might give you a means of determining whether or not the current book is another instance of an already read book or a whole new book.

I'll take a look at it. I may also use that mod along with one that lets you pick up books without reading them so I'll know if I read/got exp for that book already.

 

Also for the second question I asked I meant what would I change Event OnRead() to make the script trigger when the book is closed rather than opened? Would it be OnClose?

Edited by silverdragon5
Link to comment
Share on other sites

Not sure if OnClose() works for books or not.

 

I would probably go with SKSE and use the event OnMenuClose

 

It would be something like:

Event OnInit()
	RegisterForMenu("Book Menu")
EndEvent
 
Event OnMenuClose(String MenuName)
;	Debug.Trace("A registered menu has closed.")
	If MenuName == "Book Menu"
;		Debug.Trace("Book Menu has been registered and has closed.")
		;do your stuff
	EndIf
EndEvent
Link to comment
Share on other sites

OnClose probably won't work for books as stated on CK wiki. Might wanna try GetOpenState.

 

I don't know if equip and unequip can apply to a book's opening and closing.

 

To check if a copy of the book is being read, one of the easy way is to work around it by adding an external element as a way of detection.

Edited by fantasy19
Link to comment
Share on other sites

Isn't GetOpenState for doors?

 

I think unread books glow use a form list to check if a book has been read so maybe the same can be done for this script?

 

I might just use unread books glow, speechcraft exp for reading books and one of the mods that let you pick books up without reading them in combination if I can't figure this out.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...