Jump to content
Heavy Traffic ×

Help making a perk that effects Differect races in different ways?


DaylenTheMaleficar

Recommended Posts

Hey, I'm working on this scripted perk and I want certain values to change for the races, but I can't figure out how to use the raceID's effectively or mod the intiger I'm working with. This is the first time I've ever tried to script anything so sorry if I'm missing obvious things. Here's the relevant bid of code.

Event OnPlayerLoadGame()
	 int x = Game.GetPlayer().GetLevel()
     Race PlayerRace = Game.GetPlayer().GetRace()
     if (PlayerRace == 00013740)
	     MyInterger().Mod(0)
	         MyInterger() += 0
         Return MyInterger()
     elseif (PlayerRace == 00013746)
	     MyInterger().Mod(20)
	         MyInterger() += 20
         Return MyInterger()
     endif
Edited by DaylenTheMaleficar
Link to comment
Share on other sites

First off, what are you trying to do exactly? There may be a way to do it without scripting.

 

Second, you should use properties for the races. Properties are like variables that are set by the form that the script is attached to instead of within the script. (See here.) So you would add this line to your script:

race property MyRace auto

And then when you attach the script to a magic effect (I am assuming you are attaching it to a magic effect, but it's basically the same process regardless of what you attach it to), select the script and click the Properties button.

 

 

 

In the dialogue that opens, select the script and click the Properties button. In the window that opens, select the property and click Edit Value, then select the race from the list. Remember that a PCs race might change multiple times while gaming.

 

 

Link to comment
Share on other sites

Well, what I'm ultimately trying to do is see if I can add stats back into the game. I'm only using endurance and one modified race so I can get my methods straight before diving in with the rest of the stats. Here's what I've got so far:

int property Endurance auto
race property NordRace auto
int NordMod = 20

Event OnPlayerLoadGame()
	 
Event OnPlayerLoadGame()
     Race PlayerRace = Game.GetPlayer().GetRace()
     if (PlayerRace == NordRace)
         Endurance.Mod(NordMod)
     endif
     int x = Game.GetPlayer().GetLevel()
     Return Endurance
     int sum = x + Endurance
     Game.GetPlayer().SetAV("health", sum)
endEvent

I don't know why, but NordRace isn't showing up as a property in the dialogue window, but Endurance is. I'm also getting these errors from the compiler:

(18,16): int is not a known user-defined type (In reference to Endurance.Mod(NordMod))
(21,2): cannot return a int from onplayerloadgame, the function does not return a value (In reverence to Return Endurance)

Do I need to retern enduranceafter it's modified? How is int undefined?

Edited by DaylenTheMaleficar
Link to comment
Share on other sites

You can't run mod on an int. It's a globalvariable function. your property would have to say:

 

GlobalVariable property Endurance auto

 

Then you would have to create a global variable in the object window (under Misc) to fill the property.

 

I suspect NordRace is not showing up in the property window because you have not successfully compiled the script since you added it as a property.

Link to comment
Share on other sites

You have the creation kit, yes? and presumably you can see the object window because that's where you would create an object in order to attach this script to it. On the left hand pane of the obect window there are several categories (actor, item, magic, world data, etc.) One of those categories is miscellaneous. Expand the category and you will see Global Variable nested underneath it. select global variable and you will see all of the global variables in the game. right click and select New. shorts and longs are integers and floats are floats.
Link to comment
Share on other sites

Thank you! The script has compiled successfully, although, for some reason it doesn't seem to want to run. The Papyrus log says:

 

error: Unable to bind script ssAttribDef to AttribQuest (02003875) because their base types do not match

What does that even mean? It means I suck at parents and can't even do basic and obvious s#*!. Ignore this post.

Edited by DaylenTheMaleficar
Link to comment
Share on other sites

  • Recently Browsing   0 members

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