Jump to content

Requesting Scripting Advice


LazyDreamer

Recommended Posts

Sup everybody. I'm a relatively inexperienced modder/programmer, so I come here seeking advice.

I'm making a mod that changes racial powers and abilities, and one thing I want to do is make it so that Bosmer get an attack buff in werewolf form (due to their connection to nature and the Wild Hunt and all that). However, this is proving problematic. I can't simply add the ability to WoodElfRace like I had hoped, since werewolves are their own race and all of the player's original racial abilities get removed upon transforming. Likewise, I can't just add the ability to the werewolf race without giving the ability to all player races.

Thus, I figured the only way to do this would be with Papyrus, and that it would be easiest to do by editing PlayerWerewolfChangeScript.psc. This is the script that adds all the other werewolf abilities. So, what I then needed was a way to store the player's race before transformation, then to call on that variable to check if it's WoodElfRace, and if it is, to add my attack buff spell to the player. Thankfully, PlayerOriginalRace was already defined in another script, CompanionsHousekeepingScript.psc, which is used when the player transforms back to normal. With all this in mind, I wrote the following code into PlayerWereWolfChangeScript.psc, within the StartTracking function:

OriginalRace = (CompanionsTrackingQuest as CompanionsHousekeepingScript).PlayerOriginalRace
	if (OriginalRace == WoodElfRace)
		Game.GetPlayer().AddSpell(PlayerWerewolfRaceModAbility, false)
	endif

And of course I defined the two race properties and spell property earlier in the script. The script compiles successfully, but the game won't apply the spell to my character (who is a Bosmer).

 

I'm at a loss as to where to go from here. Is there anyone around that's good with Papyrus, or with scripting in general, that can help me out?

Link to comment
Share on other sites

Instead of editing the PlayerWerewolfChangeScript, why not create a start game enabled quest with a player alias. Apply a script to the player alias, something as follows (untested)

 

 

Race Property BretonRace Auto
Race Property WerewolfRace Auto
 
Event OnInit()
Race PlayerRace = Game.GetPlayer().GetRace()
EndEvent
 
Event OnRaceSwitchComplete()
Race NewPlayerRace = Game.GetPlayer().GetRace()
If (PlayerRace == BretonRace) && (NewPlayerRace == WerewolfRace)
Game.GetPlayer().AddSpell(PlayerWerewolfRaceModAbility) ;set to false after certain that it is applying
EndIf
EndEVent

The above does have a limitation that it cannot be activated until after the player has created their character. Otherwise it would return as the Nord race. There could be a work around made, but I would first ensure that you are getting the ability applied.

 

FYI - modifying a stock script mid-game does not always work. This could be what you have encountered. Try your script changes first on a brand new game.

Link to comment
Share on other sites

...

...

The above does have a limitation that it cannot be activated until after the player has created their character. Otherwise it would return as the Nord race. There could be a work around made, but I would first ensure that you are getting the ability applied.

 

FYI - modifying a stock script mid-game does not always work. This could be what you have encountered. Try your script changes first on a brand new game.

 

Thanks for the quick response. I tried using my modified script on a fresh game save, and it still didn't work. I even went through the Companions quest line to become a werewolf the legitimate way. Oh well.

 

I'll give your suggestion a try once my Creation Kit stops breaking every time I try to add scripts. Maybe there's something I need to change in its ini file.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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