TheWoodenplank Posted November 19, 2019 Share Posted November 19, 2019 (edited) Hi Nexus In a mod I've made, I modify the attributes of various races*, but these changes, of course, also affect NPCsFor example: My mod gives Nords the Unbreakable passive, granting +50 base health. But on legendary difficulty, this tranlates into +150 health for enemy Nords (which is most NPCs in the game...), and the mod inadvertedly makes the game a lot harder. My question: is there a way to only apply racial bonuses to Players, and not NPCs of the same race? Thanks for reading! ------------------------------------------------------------------------------------------------------------------------------------*(I found it unfair that Altmer get +50 Magicka, and all other races start with standard 100/100/100) Edited November 19, 2019 by Littlebigpeach Link to comment Share on other sites More sharing options...
ReDragon2013 Posted November 19, 2019 Share Posted November 19, 2019 (edited) You asked: "is there a way to only apply racial bonuses to Players, and not NPCs of the same race?" Answer: Yes, but you have to use - a new created quest - an alias filled with unique player - a ReferenceAlias script attached to the player alias inside the papyrus script use FormList PROPERTY myRaceList auto ; list of races you want to observe for the player to modify an actorValue Float[] PROPERTY myHealthBoni auto ; array of same length (filled by yourself within CK) as race list above to hold float values for changing EVENT OnInit() ENDEVENT EVENT OnPlayerLoadGame() ENDEVENT EVENT OnRaceSwitchComplete() ; https://www.creationkit.com/index.php?title=OnRaceSwitchComplete_-_Actor ENDEVENTto implement the code.. let your brain working Edited November 19, 2019 by ReDragon2013 Link to comment Share on other sites More sharing options...
TheWoodenplank Posted November 22, 2019 Author Share Posted November 22, 2019 YikesI've never done any scripting with Skyrim's creation kit (exclusively just edited objects), so I might be in over my head here.I don't want to make a faulty mod, which leaves nasty bits of bad script somewhere in peoples' data folders. Link to comment Share on other sites More sharing options...
foamyesque Posted November 23, 2019 Share Posted November 23, 2019 Easiest way would be to add a perk to the player, via an alias. It will require a bit of scripting, but of a very, very simple and straightforward kind. Perks can be conditioned based on things like the actor's race (among many many others), so you wouldn't need to personally track the player's race; the game itself would do it for you. All you'd need to do would be a little bit of run-once stuff in a dummy, start-game-enabled quest: When the quest starts, it adds the perk. Link to comment Share on other sites More sharing options...
TheWoodenplank Posted November 23, 2019 Author Share Posted November 23, 2019 All you'd need to do would be a little bit of run-once stuff in a dummy, start-game-enabled quest: When the quest starts, it adds the perk. So it wouldn't work on an already-started game, right?Also; player race is actually decided a while after the game starts, isn't it? - You have to go through race menu first.. Link to comment Share on other sites More sharing options...
foamyesque Posted November 23, 2019 Share Posted November 23, 2019 (edited) All you'd need to do would be a little bit of run-once stuff in a dummy, start-game-enabled quest: When the quest starts, it adds the perk. So it wouldn't work on an already-started game, right?Also; player race is actually decided a while after the game starts, isn't it? - You have to go through race menu first.. It does work. Start-enabled quests will fire the first time the mod is loaded in a game, regardless of whether the game is a fresh one or loaded from save. The player always has a race. By default, it's Nord, and then changed following the cart ride to whatever the player selects. You can observe this by using the console 'coc' command to start the game instead of the cart ride; if you haven't modded the player record, you'll spawn in as a Nord male in iron armour. However, the condition system can handle that for you. The health bonus portion of the perk can be set to only activate if the player is of the Nord race. Edited November 23, 2019 by foamyesque Link to comment Share on other sites More sharing options...
TheWoodenplank Posted November 27, 2019 Author Share Posted November 27, 2019 (edited) Hi, sorry for the late reply.First time making a quest.Getting it to run on game start seems simple enough, but how does one "fill alias" and add perks based on race?Under "Quest Aliases" I can add a new quest alias, and get some reference to the player.. but I'm unsure what to do with the various menues. The QuestData seems simple enough But in this tab below, I don't know what to fill. I'm not even sure if adding "New Reference Alias" under "Quest Aliases" is the right thing to do... ? Or do I need to add a script, which somehow adds the "spell" to players? Any assistance much appreciated Edited November 27, 2019 by Littlebigpeach Link to comment Share on other sites More sharing options...
foamyesque Posted November 28, 2019 Share Posted November 28, 2019 (edited) OK, so, what you want to do is create an alias and point it at the player, as you've done in the second screenshot there. At this point, you have a few choices in what you want to do. You can add an ability to the player in the Alias Spells list. This would work fine for things like boosting HMS or particular skills; the Altmer Magicka boost is done through an ability, for example, though applied at the race level. If there's some more unique effect that you want to do, you could add a perk proper. Unfortunately perks aren't spells and so can't be added using the other alias stuff, you have to use a script. To do that, hit the Add button in the Scripts list, and when the popup appears, choose [New Script]. You'd think there'd be a default script to do it, but AFAICT there's not. Anyway, this will bring up a naming menu. You'll want to name the script something that a. makes sense to you and b. can be easily distinguished from scripts from other sources. Something like LBP_AddPerk, for example. Don't alter the Extends field. Doing all of that should get you a new script editor popup with a single line saying "scriptname [whatever] extends ReferenceAlias". That's one of the five lines of code needed already done for you. The rest are: Perk Property newPerk Auto Event OnInit() GetRef().AddPerk(newPerk) EndEvent Save & compile, then go back to the alias screen. The script you just created should now be listed. If you select it, the two greyed out buttons, "Remove" and "Properties", will become active. You want to hit Properties, which are how scripts are linked to the actual game data. This will bring up a screen with the 'newPerk' property listed. If you select it, and hit 'Edit Value', you can choose a perk to assign to that property. Select whatever one you want (presumably the one you've made!) and press OK. At this point, for either, hit OK on the alias screen, then OK on the Quest screen. Then save the ESP. I get that this sounds like a lot of steps and it sort of is, but they're only slow when you're learning it. Took me more time to write the lines describing it than it does to actually do 'em.EDIT:Note that this only works with the player. NPCs can't have perks modified dynamically and must have their base actor form edited directly. Edited November 28, 2019 by foamyesque Link to comment Share on other sites More sharing options...
TheWoodenplank Posted November 28, 2019 Author Share Posted November 28, 2019 (edited) Thanks a tonne for all this (very thorough!) explanation. I still have two questions/problems though:1. Do I have to create a quest for every possible race? I.e. one quest checks if player is Redguard... adds perks/spells if they are, a second quest checks for dunmer... and so on. Is there any smart way to combine them all in one quest? Or do I just make 10 quests? (Not that it would be much of a problem... Duplicate!) 2. I seem to run into an error when trying to create a new script with Extends: ReferenceAlias Edited November 28, 2019 by Littlebigpeach Link to comment Share on other sites More sharing options...
foamyesque Posted November 28, 2019 Share Posted November 28, 2019 Thanks a tonne for all this (very thorough!) explanation. I still have two questions/problems though:1. Do I have to create a quest for every possible race? I.e. one quest checks if player is Redguard... adds perks/spells if they are, a second quest checks for dunmer... and so on. Is there any smart way to combine them all in one quest? Or do I just make 10 quests? (Not that it would be much of a problem... Duplicate!) 2. I seem to run into an error when trying to create a new script with Extends: ReferenceAlias ReferenceAlias.JPG 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. Link to comment Share on other sites More sharing options...
Recommended Posts