Difference between revisions of "AddPerk"

46 bytes added ,  18:21, 17 July 2015
no edit summary
imported>Cipscis
m (terminology + token clarification)
imported>JT
 
(8 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Function
{{Function
|origin = GECK1
|origin = GECK1
|summary = 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.
|summary = 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.
|referenceType = Actor
|name = AddPerk
|arguments = {{FunctionArgument
|returnType = void
    |Name = PerkID
|referenceType = [ActorRefID]
    |Type = ref
|arguments =  
  {{FunctionArgument
  |Name = PerkID
  |Type = ref
   }}
   }}
|example = BuddyRef.AddPerk LittleSlugger
|example = BuddyRef.AddPerk LittleSlugger
 
Buddy now has the benefits of the little slugger perk.
Buddy now has the benefits of the little slugger perk.
}}
}}


==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.
* With Fallout 3 version 1.4 or older: Loading a savegame in which the player has a mod-created perk, when the mod that created it is no longer installed, may crash the game. That issue was fixed in Fallout v1.5. If you know the FormId of the Perk, you can remove it from yourself using the console. Modders are also advised to provide an in-game means for players to remove perks, should they wish to uninstall while keeping older versions of FO3, or at least provide instructions on how to remove the perks.


One way is to add a zero weight token (an unplayable, therefore invisible, piece of armour) to the player: first, an item called, eg "ExampleToken", with an "object" type script like the following is created:
* One simple way is to provide an "uninstaller" esm file, that the user must install, load their game, and save it, before they remove the mod. The esm will do nothing but remove the perks, and contains one quest, called something like "MyPerkRemovalQuest", set to "start game enabled", with a Quest-type script:
    ScriptName ExampleTokenScript
     ScriptName MyPerkRemovalQuestScript
   
    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
     Begin GameMode
         player.addItem ExampleToken 1
         player.RemovePerk MyExamplePerk
         StopQuest ExampleQuest
         StopQuest MyPerkRemovalQuest
     End
     End
*This function is new in the GECK, and was not available in the TES4 Construction Set.


==See Also==
==See Also==
[[RemovePerk]]
*[[RemovePerk]]
*[[HasPerk]]


[[Category:Functions]]
[[Category:Functions]]
[[Category:Functions (GECK 1.1)]]
[[Category:Player Functions]]
[[Category:Player Functions]]
[[Category:Player Functions (GECK 1.1)]]
[[Category:Perk]]
[[Category:Perk]]
Anonymous user