Difference between revisions of "AddPerk"
Jump to navigation
Jump to search
imported>DewiMorgan (→Notes: copying warning note from category perk) |
imported>DewiMorgan (→Notes: Example codearound for the bug.) |
||
Line 13: | Line 13: | ||
==Notes== | ==Notes== | ||
* | * Loading a savegame in which the player has a mod-ceated perk, when the mod that created it is no longer installed, may crash the game. If you know the FormId of the Perk, you can remove it from yourself using the console. Modders are also strongly advised to provide an in-game means for players to remove perks, should they wish to uninstall. | ||
One way is to add a zero weight token object to the player: first, an item called, eg "ExampleToken", with an "item" type script like the following is created: | |||
ScriptName ExampleTokenScript | |||
Begin OnAdd player | |||
player.AddPerk ExamplePerk | |||
End | |||
Begin OnDrop player | |||
player.RemovePerk ExamplePerk | |||
End | |||
Then a quest called, eg "ExampleQuest" is created and set to "start game enabled", with a "quest" type script: | |||
ScriptName ExampleQuestScript | |||
Begin GameMode | |||
player.addItem ExampleToken 1 | |||
StopQuest ExampleQuest | |||
End | |||
*This function is new in the GECK, and was not available in the TES4 Construction Set. | *This function is new in the GECK, and was not available in the TES4 Construction Set. | ||
Revision as of 18:37, 15 April 2009
< [[::Category:Functions|Category:Functions]]
A function included in the GECK version 1.1.0.36.
Description
Increments the rank of the specified perk on an Actor. If the specified Actor doesn't already have the perk, then it will be added with rank 1.
Syntax
Actor.AddPerk PerkID:ref
Example
BuddyRef.AddPerk LittleSlugger
Buddy now has the benefits of the little slugger perk.
Notes
- Loading a savegame in which the player has a mod-ceated perk, when the mod that created it is no longer installed, may crash the game. If you know the FormId of the Perk, you can remove it from yourself using the console. Modders are also strongly advised to provide an in-game means for players to remove perks, should they wish to uninstall.
One way is to add a zero weight token object to the player: first, an item called, eg "ExampleToken", with an "item" type script like the following is created:
ScriptName ExampleTokenScript
Begin OnAdd player player.AddPerk ExamplePerk End Begin OnDrop player player.RemovePerk ExamplePerk End
Then a quest called, eg "ExampleQuest" is created and set to "start game enabled", with a "quest" type script:
ScriptName ExampleQuestScript
Begin GameMode player.addItem ExampleToken 1 StopQuest ExampleQuest End
- This function is new in the GECK, and was not available in the TES4 Construction Set.