TheWoodenplank Posted November 29, 2019 Author Share Posted November 29, 2019 (edited) You should need just one quest. You can put a condition on all the perks or abilities you add to check the race of the actor it has been given to. They will all then be present but only the correct one will be active. This adds some polling, but it's polling done through the game engine and isn't a noticeable load IME. The error in the second one suggests you don't have your scripts folder set up so the CK can find it. You'll want to check a. that you have a scripts folder, with a pile of .pex files in (you should-- Skyrim won't run otherwise) and b. that the CK's been told where to find it. I managed to fix the first error (of not recognizing the Extends script) - apparently all scripts had been compiled into a .rar file?? And I had to extract it back into the data\scripts\source folder.Now, however, I run into a different issue. I copied the code snippet you gave me, but now the script fails to compile. I feel the GetRef() is the issue. I found an alternate script on the web which goes Actor Property PlayerRef Auto Perk Property newPerk Auto event OnInit() PlayerRef.AddPerk(newPerk) endEvent This seems to be independent of the "extends refenrecealias". But as for properties, there is both a "PlayerRef" and "newPerk" property. The latter is fairly simple, but I imagine the first arises from using PlayerRef instead of an "extends alias"?For the PlayerRef property... Could I leaveit as "Default Script Value" - as it seems to be made for "pointing" to the player? I feel that, with all your help, I'm so damn close. But just not quite there yet. Edited November 29, 2019 by Littlebigpeach Link to comment Share on other sites More sharing options...
foamyesque Posted November 29, 2019 Share Posted November 29, 2019 (edited) Oh, I know what the error is. AddPerk only applies to Actors and GetRef returns an ObjectReference. Sloppy on my part. Replace it with GetActorRef() or (GetRef() as Actor) instead. Sorry! EDIT: Or, yes, you can store the player in a Actor property, as in the code snippet you posted. There's really not much difference for this application either way. Edited November 29, 2019 by foamyesque Link to comment Share on other sites More sharing options...
TheWoodenplank Posted November 29, 2019 Author Share Posted November 29, 2019 (edited) Oh, I know what the error is. AddPerk only applies to Actors and GetRef returns an ObjectReference. Sloppy on my part. Replace it with GetActorRef() or (GetRef() as Actor) instead. Sorry! Okay, my code is now Scriptname RacialAddPerk extends ReferenceAlias {Documentation: This script is used for adding a perk.} Perk Property newPerk Auto Event OnInit() GetActorRef().AddPerk(newPerk) EndEvent And I can add a perk when editing properties. But, last question I swear, how do I add more than one perk? The script just has one property which picks one perk. But I have 10 or so I wish to add - and I can't add the script in multiple times.Please tell me it's not adding the same 4 lines of script nine times over? That seems... wrong. Edited November 29, 2019 by Littlebigpeach Link to comment Share on other sites More sharing options...
foamyesque Posted November 30, 2019 Share Posted November 30, 2019 (edited) Oh, I know what the error is. AddPerk only applies to Actors and GetRef returns an ObjectReference. Sloppy on my part. Replace it with GetActorRef() or (GetRef() as Actor) instead. Sorry! Okay, my code is now Scriptname RacialAddPerk extends ReferenceAlias {Documentation: This script is used for adding a perk.} Perk Property newPerk Auto Event OnInit() GetActorRef().AddPerk(newPerk) EndEvent And I can add a perk when editing properties. But, last question I swear, how do I add more than one perk? The script just has one property which picks one perk. But I have 10 or so I wish to add - and I can't add the script in multiple times.Please tell me it's not adding the same 4 lines of script nine times over? That seems... wrong. Well, if you want to add multiple perks -- I was assuming it was just one that bundled all the effects -- it's not too much more trouble. Code'll need to be switched to use an array. Perk[] Property newPerk Auto Event OnInit() int i = newPerk.Length Actor PlayerRef = Game.GetPlayer() while i > 0 i -= 1 PlayerRef.AddPerk(newPerk[i]) endwhile EndEvent The [] means that newPerk is now an array, which you can fill with as many perks as you like in the CK. The code will then iterate through the list, starting from the last one and working it's way towards the first, and add them all one after the other. To avoid calling GetActorRef() every time I've moved (equivalent thereto in this application) it outside the loop and stored the result in a variable, for speed reasons. Edited November 30, 2019 by foamyesque Link to comment Share on other sites More sharing options...
TheWoodenplank Posted November 30, 2019 Author Share Posted November 30, 2019 Thanks a thousand for all your help!I managed to get the whole thing working smoothly now, and I'm just about ready to release my mod, now that I've tested everything works. You're swell! Link to comment Share on other sites More sharing options...
Recommended Posts