[REQ] Script to add a perk while Event OnRead()

Post » Mon Jun 18, 2012 2:22 pm

Please help me out people!

I'm trying to write a damn script that gives a perk to the player, but it does nothing at all!

I'm trying to make a book teach you a perk, but this code doesn't work:


Scriptname PerkTomeAlchemyAlchemist11 extends ObjectReference{Event OnRead()	player.addperk Alchemist00 ;tried Editor code too.EndEvent}


Any suggestions?

Also, do you have any idea as to making some of these conditional? Some perks have prerequisites, and I'd like the script to look for them while running.

Thanks a LOT
User avatar
Schel[Anne]FTL
 
Posts: 3384
Joined: Thu Nov 16, 2006 6:53 pm

Post » Mon Jun 18, 2012 12:41 pm

Scriptname PerkTomeAlchemyAlchemist11 extends ObjectreferencePerk Property ThePerk AutoEvent OnRead()    Game.GetPlayer().AddPerk(ThePerk)EndEvent

After Saving and Compiling the script right click the script in the book dialog window and select edit properties. In the new Dialog click on ThePerk then click on edit to the right and select the Alchemist00 Perk.
User avatar
Assumptah George
 
Posts: 3373
Joined: Wed Sep 13, 2006 9:43 am

Post » Mon Jun 18, 2012 3:56 am

Thanks for that! It should make http://skyrim.nexusmods.com/downloads/file.php?id=7417 a lot more streamlined under the hood.
User avatar
Lynne Hinton
 
Posts: 3388
Joined: Wed Nov 15, 2006 4:24 am

Post » Mon Jun 18, 2012 10:44 am

No Problem. And that Mod's a great Idea. I totally agrre with you actually regarding all the perks. Books and Trainers should teach you Perks instead of increasing your skill level.
User avatar
Dalia
 
Posts: 3488
Joined: Mon Oct 23, 2006 12:29 pm

Post » Mon Jun 18, 2012 4:27 am

No Problem. And that Mod's a great Idea. I totally agrre with you actually regarding all the perks. Books and Trainers should teach you Perks instead of increasing your skill level.

I'm currently making just that. All the books are done for now, I just need to script them and distribute them around Skyrim.

By the way, thanks a LOT for the solution!
User avatar
Minako
 
Posts: 3379
Joined: Sun Mar 18, 2007 9:50 pm

Post » Mon Jun 18, 2012 2:27 pm

Another question, how do you make a value of a variable displayed in a message box text?

Scriptname PerkTomeNoPrereq extends ObjectReference  Perk Property ThePerk AutoEvent OnRead()if Game.GetPlayer().HasPerk(ThePerk) == FalseGame.GetPlayer().AddPerk(ThePerk)Debug.MessageBox("You have learned the perk: " + ThePerk)elseDebug.MessageBox("You have already learned this perk.")endifEndEvent

I'd like this one to display the variable 'ThePerk'. But what it does is print the Editor Code of the perk and not the name string. How can you make it display the name string? :biggrin:

Thy :wink:
User avatar
jessica sonny
 
Posts: 3531
Joined: Thu Nov 02, 2006 6:27 pm

Post » Mon Jun 18, 2012 11:08 am

Hmm no idea on that one. A toString function or something of that sort has not crossed my sight yet. Not sure if can acces the actual name of forms via script.
User avatar
Eric Hayes
 
Posts: 3392
Joined: Mon Oct 29, 2007 1:57 am

Post » Mon Jun 18, 2012 6:49 am

Another question, how do you make a value of a variable displayed in a message box text?

Scriptname PerkTomeNoPrereq extends ObjectReference  Perk Property ThePerk AutoEvent OnRead()if Game.GetPlayer().HasPerk(ThePerk) == FalseGame.GetPlayer().AddPerk(ThePerk)Debug.MessageBox("You have learned the perk: " + ThePerk)elseDebug.MessageBox("You have already learned this perk.")endifEndEvent

I'd like this one to display the variable 'ThePerk'. But what it does is print the Editor Code of the perk and not the name string. How can you make it display the name string? :biggrin:

Thy :wink:

Only thing I can think of at the moment is to use a string variable and check if the perk matches one of them. If so, display the appropriate string.
User avatar
tiffany Royal
 
Posts: 3340
Joined: Mon Dec 25, 2006 1:48 pm

Post » Mon Jun 18, 2012 6:38 am

Only thing I can think of at the moment is to use a string variable and check if the perk matches one of them. If so, display the appropriate string.

Yes that will probably do. Although I solved it with properties and a LOT of work. I'm still going through the all the perk books and manually setting 5 properties for each. It works though :D
User avatar
candice keenan
 
Posts: 3510
Joined: Tue Dec 05, 2006 10:43 pm

Post » Mon Jun 18, 2012 5:45 pm

Another question, how do you make a value of a variable displayed in a message box text?

Scriptname PerkTomeNoPrereq extends ObjectReference  Perk Property ThePerk AutoEvent OnRead()if Game.GetPlayer().HasPerk(ThePerk) == FalseGame.GetPlayer().AddPerk(ThePerk)Debug.MessageBox("You have learned the perk: " + ThePerk)elseDebug.MessageBox("You have already learned this perk.")endifEndEvent

I'd like this one to display the variable 'ThePerk'. But what it does is print the Editor Code of the perk and not the name string. How can you make it display the name string? :biggrin:

Thy :wink:
Edit: nevermind, misunderstood.
User avatar
Solène We
 
Posts: 3470
Joined: Tue Mar 27, 2007 7:04 am


Return to V - Skyrim