DreusFar Posted January 14, 2013 Share Posted January 14, 2013 Is there a way to allow the player to change racial powers of his character, possibly using a book that you can read and choose which racial power to add?Maybe with papyrus but I don't know how to call the racial power, is there something like "GetRacePower" function or something like that? Link to comment Share on other sites More sharing options...
BigKevSexyMan Posted January 15, 2013 Share Posted January 15, 2013 I think racial powers are technically spells, so all you have to do is add the spell you want. Link to comment Share on other sites More sharing options...
Plastrader Posted January 15, 2013 Share Posted January 15, 2013 Is there a way to allow the player to change racial powers of his character, possibly using a book that you can read and choose which racial power to add?Maybe with papyrus but I don't know how to call the racial power, is there something like "GetRacePower" function or something like that?There are two functions that may be of interest:RemoveSpell - Actorand:AddSpell - Actor Then to figure out which race uses what spells.I couldn't find any scripting functions to cover this but they can be found in the CKObject Window>Character>RaceOn the General Data - tab you have "Specials" which lists the spells connected to this race. I haven't tested this if it actually works, but now you have something to look at atleast :) Link to comment Share on other sites More sharing options...
DreusFar Posted January 15, 2013 Author Share Posted January 15, 2013 (edited) First of all thank you for your answers, this is what I wrote: Scriptname RacialPower extends ObjectReference Message Property ChoiceMessage auto Event OnActivate(ObjectReference reader) int choice = ChoiceMessage.show() if (choice == 0) ; do nothing elseif (choice == 1) ; Absorb spell Game.GetPlayer().AddSpell(PowerBretonAbsorbSpell) elseif (choice == 2) ; Berserk Game.GetPlayer().AddSpell(RaceOrcBerserk) elseif (choice == 3) ; Histskin Game.GetPlayer().AddSpell(PowerArgonianHistskin) elseif (choice == 4) ; Flame cloak Game.GetPlayer().AddSpell(PowerDarkElfFlameCloak) elseif (choice Highborn Game.GetPlayer().AddSpell(PowerHighElfMagickaRegen) elseif (choice == 6) ; Pacify Game.GetPlayer().AddSpell(PowerImperialPacify) elseif (choice == 7) ; Nighteye Game.GetPlayer().AddSpell(PowerKhajiitNightEye) elseif (choice == 8.) ; Battle cry Game.GetPlayer().AddSpell(PowerNordBattleCry) elseif (choice == 9) ; Stamina regeneration Game.GetPlayer().AddSpell(PowerRedguardStaminaRegen) elseif (choice == 10) ; Command animal Game.GetPlayer().AddSpell(PowerWoodElfCommandAnimal) endif EndEvent And the compilation failed with this message: Starting 1 compile threads for 1 files...Compiling "RacialPower"...C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\RacialPower.psc(15,28): variable PowerBretonAbsorbSpell is undefinedC:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\RacialPower.psc(19,28): variable RaceOrcBerserk is undefinedC:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\RacialPower.psc(23,28): variable PowerArgonianHistskin is undefinedC:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\RacialPower.psc(27,28): variable PowerDarkElfFlameCloak is undefinedC:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\RacialPower.psc(31,28): variable PowerHighElfMagickaRegen is undefinedC:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\RacialPower.psc(35,28): variable PowerImperialPacify is undefinedC:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\RacialPower.psc(39,28): variable PowerKhajiitNightEye is undefinedC:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\RacialPower.psc(43,28): variable PowerNordBattleCry is undefinedC:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\RacialPower.psc(47,28): variable PowerRedguardStaminaRegen is undefinedC:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\RacialPower.psc(51,28): variable PowerWoodElfCommandAnimal is undefinedNo output generated for RacialPower, compilation failed. Batch compile of 1 files finished. 0 succeeded, 1 failed.Failed on RacialPower So what's wrong? those variables that it says are undefined I copied them from the ID of the corresponding RacePower spell Edited January 15, 2013 by DreusFar Link to comment Share on other sites More sharing options...
Plastrader Posted January 16, 2013 Share Posted January 16, 2013 (edited) So what's wrong? those variables that it says are undefined I copied them from the ID of the corresponding RacePower spellAs the error message say "variable PowerBretonAbsorbSpell is undefined"I thought all spells were already defined as variables that you could use too, but unfortunately that's not true. You need to play around with properties. 1: Find and select your script2: Click "Properties"3: The "Properties for script" dialogue is opened. Click "Add property"4: The "Add Script Property" dialogue is opened. Use the drop down to select "SPELL"(or type it in) as your "Type" Write pPowerBretonAbsorbSpell as your "Name". This way is "quick" way of doing it which I'll explain below. Click OK5: Now you're sent back to the "Properties for script" dialogue. As you see "Pick Object" is already selected for your "PowerBretonAbsorbSpell"-spell, this is because you namned the property "pPowerBretonAbsorbSpell" So basically naming the properties p<Spell name> will let the CK pick up the corresponding spell automatically, so you don't have to scroll through x^y number of items. Neat hu? (Thanks bethesta for that one btw) Click OK6: Edit the source for your script. Now you see the property "SPELL Property pPowerBretonAbsorbSpell Auto" Repeat step 1 - 4 for all your spells.Then change the variable names you have with these properties. Hope this helps(and works)Attached to this post are a few screenshots for your reference Edited January 16, 2013 by Plastrader Link to comment Share on other sites More sharing options...
DreusFar Posted January 16, 2013 Author Share Posted January 16, 2013 (edited) thank you again for answering me, I did what you said, and then I put the new book in game but when I open it doesn't make me choose any racial power (compilation succeeds) Here the script: Scriptname PoteriRaziali extends ObjectReference SPELL Property pPowerBretonAbsorbSpell Auto SPELL Property pRaceOrcBerserk Auto SPELL Property pPowerArgonianHistskin Auto SPELL Property pPowerDarkElfFlameCloak Auto SPELL Property pPowerHighElfMagickaRegen Auto SPELL Property pPowerImperialPacify Auto SPELL Property pPowerKhajiitNightEye Auto SPELL Property pPowerNordBattleCry Auto SPELL Property pPowerRedguardStaminaRegen Auto SPELL Property pPowerWoodElfCommandAnimal Auto Message Property ChoiceMessage auto Event OnActivate(ObjectReference reader) int choice = ChoiceMessage.show() if (choice == 0) ; do nothing elseif (choice == 1) ; Absorb spell Game.GetPlayer().AddSpell(pPowerBretonAbsorbSpell) elseif (choice == 2) ; Berserk Game.GetPlayer().AddSpell(pRaceOrcBerserk) elseif (choice == 3) ; Histskin Game.GetPlayer().AddSpell(pPowerArgonianHistskin) elseif (choice == 4) ; Flame cloak Game.GetPlayer().AddSpell(pPowerDarkElfFlameCloak) elseif (choice Highborn Game.GetPlayer().AddSpell(pPowerHighElfMagickaRegen) elseif (choice == 6) ; Pacify Game.GetPlayer().AddSpell(pPowerImperialPacify) elseif (choice == 7) ; Nighteye Game.GetPlayer().AddSpell(pPowerKhajiitNightEye) elseif (choice == 8.) ; Battle cry Game.GetPlayer().AddSpell(pPowerNordBattleCry) elseif (choice == 9) ; Stamina regeneration Game.GetPlayer().AddSpell(pPowerRedguardStaminaRegen) elseif (choice == 10) ; Command animal Game.GetPlayer().AddSpell(pPowerWoodElfCommandAnimal) endif EndEvent At end of this post a screenshot of properties window (I think it's how you told me to do but maybe it isn't). I tried to look at Oghma infinium's script because my book once opened should give ten options as oghma gives three options, so I thought they were similar, but sincerely I didn't manage to understand very much from that, maybe is needed a function for reading books or something like that, I even don't know, any idea? Edited January 16, 2013 by DreusFar Link to comment Share on other sites More sharing options...
Sjogga Posted January 16, 2013 Share Posted January 16, 2013 (edited) Try using OnRead instead of OnActivate By the looks of it you also need to create a Message-form in the ObjectWindow (Miscellaneous->Message). This must then be set as the ChoiceMessage script property. Edited January 16, 2013 by Sjogga Link to comment Share on other sites More sharing options...
Plastrader Posted January 17, 2013 Share Posted January 17, 2013 (edited) I tried to look at Oghma infinium's script because my book once opened should give ten options as oghma gives three options, so I thought they were similar, but sincerely I didn't manage to understand very much from that, maybe is needed a function for reading books or something like that, I even don't know, any idea?Yes the properties looks good. Unfortunately the CK and how things are connected to eachother is a 10000 piece jigsaw puzzle for me at the moment so I can't help you with this.Have a look at the link Sjogga posted :) And you're welcome, I'm glad to assist. Btw, here's some posting tips if you're interested.the [ code][/ code] (ignore the whitespaces) tag is a neat feature. That tag will let you post text with tab and so on so you can copy paste from your editor. but still keep the format. Good for posting code(naturally) and it'll even add some coloured text as it was an editor Either type it manually or select the text/code and use the "<>" icon in the post editor And if you feel that your code or text is awfully long you can use(click show) [ spoiler](Again ignore whitespaces)My exceptionally long text here, such as load order or list of mods, or dx diag or.. well...This tag doesn't have a corresponding icon in the post editor for some reason.[/ spoiler] Edited January 17, 2013 by Plastrader Link to comment Share on other sites More sharing options...
bloomingdedalus Posted January 17, 2013 Share Posted January 17, 2013 thank you again for answering me, I did what you said, and then I put the new book in game but when I open it doesn't make me choose any racial power (compilation succeeds) Here the script: Scriptname PoteriRaziali extends ObjectReference SPELL Property pPowerBretonAbsorbSpell Auto SPELL Property pRaceOrcBerserk Auto SPELL Property pPowerArgonianHistskin Auto SPELL Property pPowerDarkElfFlameCloak Auto SPELL Property pPowerHighElfMagickaRegen Auto SPELL Property pPowerImperialPacify Auto SPELL Property pPowerKhajiitNightEye Auto SPELL Property pPowerNordBattleCry Auto SPELL Property pPowerRedguardStaminaRegen Auto SPELL Property pPowerWoodElfCommandAnimal Auto Message Property ChoiceMessage auto Event OnActivate(ObjectReference reader) int choice = ChoiceMessage.show() if (choice == 0) ; do nothing elseif (choice == 1) ; Absorb spell Game.GetPlayer().AddSpell(pPowerBretonAbsorbSpell) elseif (choice == 2) ; Berserk Game.GetPlayer().AddSpell(pRaceOrcBerserk) elseif (choice == 3) ; Histskin Game.GetPlayer().AddSpell(pPowerArgonianHistskin) elseif (choice == 4) ; Flame cloak Game.GetPlayer().AddSpell(pPowerDarkElfFlameCloak) elseif (choice Highborn Game.GetPlayer().AddSpell(pPowerHighElfMagickaRegen) elseif (choice == 6) ; Pacify Game.GetPlayer().AddSpell(pPowerImperialPacify) elseif (choice == 7) ; Nighteye Game.GetPlayer().AddSpell(pPowerKhajiitNightEye) elseif (choice == 8.) ; Battle cry Game.GetPlayer().AddSpell(pPowerNordBattleCry) elseif (choice == 9) ; Stamina regeneration Game.GetPlayer().AddSpell(pPowerRedguardStaminaRegen) elseif (choice == 10) ; Command animal Game.GetPlayer().AddSpell(pPowerWoodElfCommandAnimal) endif EndEvent At end of this post a screenshot of properties window (I think it's how you told me to do but maybe it isn't). I tried to look at Oghma infinium's script because my book once opened should give ten options as oghma gives three options, so I thought they were similar, but sincerely I didn't manage to understand very much from that, maybe is needed a function for reading books or something like that, I even don't know, any idea? It appears you have not defined the message box property yet if your screenshot is correct. That will certainly prevent anything from occurring. It doesn't naturally know what message your directing it to, just like it doesn't naturally know what spell you mean. You have to select the property and pick the message box you created. If you include the full name of your message box prefaced by a p (it may work no matter what letter you use, I'm not sure) then "Auto-Fill" should pick the message itself. Link to comment Share on other sites More sharing options...
DreusFar Posted January 17, 2013 Author Share Posted January 17, 2013 thank you very much to all of you, I have almost done it, only two problems remain, the first, probably unsolvable, is that when I create the options of the message I can write a maximum of 10 options while I would need 11. The second is that my intention is to give the player the ability to choose up to three racial powers, and once the player has chosen three powers he can lose one of those powers reading again the book, so later he can choose another power (in synthesis a maximum of three powers). But with my script when the player should choose which power he wants to lose if he chooses from the options a power he didn't have yet, then he can read again the book andget another power, so more than three powers. Here the script: Scriptname PoteriRaziali extends ObjectReference SPELL Property pPowerBretonAbsorbSpell Auto SPELL Property pRaceOrcBerserk Auto SPELL Property pPowerArgonianHistskin Auto SPELL Property pPowerDarkElfFlameCloak Auto SPELL Property pPowerHighElfMagickaRegen Auto SPELL Property pPowerImperialPacify Auto SPELL Property pPowerKhajiitNightEye Auto SPELL Property pPowerNordBattleCry Auto SPELL Property pPowerRedguardStaminaRegen Auto SPELL Property pPowerWoodElfCommandAnimal Auto Message Property ChoiceMessage auto Message Property Rimozione Auto int count = 0 Event OnEquipped(Actor reader) if (count < 4) int choice = ChoiceMessage.show() if (choice == 0) ; do nothing elseif (choice == 1) ; Assorbi incantesimo Game.GetPlayer().AddSpell(pPowerBretonAbsorbSpell) count = count + 1 elseif (choice == 2) ; Berserk Game.GetPlayer().AddSpell(pRaceOrcBerserk) count = count + 1 elseif (choice == 3) ; Pelle di Hist Game.GetPlayer().AddSpell(pPowerArgonianHistskin) count = count + 1 elseif (choice == 4) ; Manto infuocato Game.GetPlayer().AddSpell(pPowerDarkElfFlameCloak) count = count + 1 elseif (choice == 5) ; Nobile di nascita Game.GetPlayer().AddSpell(pPowerHighElfMagickaRegen) count = count + 1 elseif (choice == 6) ; Voce dell'imperatore Game.GetPlayer().AddSpell(pPowerImperialPacify) count = count + 1 elseif (choice == 7) ; Occhio notturno Game.GetPlayer().AddSpell(pPowerKhajiitNightEye) count = count + 1 elseif (choice == 8) ; Grido di battaglia Game.GetPlayer().AddSpell(pPowerNordBattleCry) count = count + 1 elseif (choice == 9) ; Scatto di adrenalina Game.GetPlayer().AddSpell(pPowerRedguardStaminaRegen) count = count + 1 elseif (choice == 10) ; Comanda animale Game.GetPlayer().AddSpell(pPowerWoodElfCommandAnimal) count = count + 1 endif elseif (count >= 4) int unchoice = Rimozione.show() if (unchoice == 0) ; do nothing elseif (unchoice == 1) ; Assorbi incantesimo Game.GetPlayer().RemoveSpell(pPowerBretonAbsorbSpell) count = count - 1 elseif (unchoice == 2) ; Berserk Game.GetPlayer().RemoveSpell(pRaceOrcBerserk) count = count - 1 elseif (unchoice == 3) ; Pelle di Hist Game.GetPlayer().RemoveSpell(pPowerArgonianHistskin) count = count - 1 elseif (unchoice == 4) ; Manto infuocato Game.GetPlayer().RemoveSpell(pPowerDarkElfFlameCloak) count = count - 1 elseif (unchoice == 5) ; Nobile di nascita Game.GetPlayer().RemoveSpell(pPowerHighElfMagickaRegen) count = count - 1 elseif (unchoice == 6) ; Voce dell'imperatore Game.GetPlayer().RemoveSpell(pPowerImperialPacify) count = count - 1 elseif (unchoice == 7) ; Occhio notturno Game.GetPlayer().RemoveSpell(pPowerKhajiitNightEye) count = count - 1 elseif (unchoice == 8) ; Grido di battaglia Game.GetPlayer().RemoveSpell(pPowerNordBattleCry) count = count - 1 elseif (unchoice == 9) ; Scatto di adrenalina Game.GetPlayer().RemoveSpell(pPowerRedguardStaminaRegen) count = count - 1 elseif (unchoice == 10) ; Comanda animale Game.GetPlayer().RemoveSpell(pPowerWoodElfCommandAnimal) count = count - 1 endif endif EndEvent And here again properties window Link to comment Share on other sites More sharing options...
Recommended Posts