falloutkid12 Posted September 13, 2017 Share Posted September 13, 2017 I'm trying to make a perk (really just another rank of Pain Train) that prevents your power armor pieces from taking damage by adding the keyword "PowerArmorPreventArmorDamageKeyword" to actors that have said perk. AFAIK, you cannot add keywords to actors using spells/ enchantments, but you can using scripts. Thing is: I'm very new to scripting. I know the basics: What are objects, events, functions, syntax, parameters, etc. What I don't know is how to write the script and implement it so that when an actor gains the perk, the game adds the keyword to actors. I'm also aiming for maximum compatibility, i.e. every NPC/actor that has this perk will attain the keyword, no "player-only" shortcuts. I do have a base script, though it probably means nothing when compiled and added to anything. Scriptname PainTrainNoPADamageScript extends Actor{Adds the PowerArmorPreventArmorDamageKeyword keyword to an actor with the Pain Train rank 4 perk} Keyword Property myKey Auto;myKey is the PowerArmorPreventArmorDamageKeyword i set when I edit the script locally. Function GetActorReference(Actor akActor) akActor.AddKeyword(myKey) EndFunction Link to comment Share on other sites More sharing options...
JonathanOstrus Posted September 13, 2017 Share Posted September 13, 2017 I think you're sort of on the right track. You wouldn't do it with a script extending actor. The way I would envision something like this working would be like this: Add perk to actorperk adds magic effectmagic effect runs scriptscript has onmagiceffectstart which adds keyword property of scriptscript has an onmagiceffectend which removes keyword property of script Some caution note: The above simple demo would not check if the keyword was already on the actor and leave it instead of removing it. So if the script fired on an actor that already had it (like Danse) it would remove it without regard. Link to comment Share on other sites More sharing options...
falloutkid12 Posted September 13, 2017 Author Share Posted September 13, 2017 I think you're sort of on the right track. You wouldn't do it with a script extending actor. The way I would envision something like this working would be like this: Add perk to actorperk adds magic effectmagic effect runs scriptscript has onmagiceffectstart which adds keyword property of scriptscript has an onmagiceffectend which removes keyword property of script Some caution note: The above simple demo would not check if the keyword was already on the actor and leave it instead of removing it. So if the script fired on an actor that already had it (like Danse) it would remove it without regard.Thank you for your help! I'll try reworking the script and get back with some results! EDIT: After watching a few video tutorials and getting further acquainted with the Papyrus language, I managed to get a working script/perk! Again, thank you for your help BigAndFlabby! (here's the script, if anyone wants it) Scriptname "set to whatever you want, be sure to name your file exactly the same when saving!" extends ActiveMagicEffect ;;;;; Sets the keyword to use. Keyword Property myKeyword auto const mandatory{Set this to the Keyword you want to add to the actor when they obtan the perk.} ;;;;; Sets the Perk that is required to add the keyword to the actor Perk Property myPerk auto const mandatory{Set this to the perk that your actor(s) must have to have the keyword added to.} ;;;;; Trigger for MGEF application Event OnEffectStart(Actor akTarget, Actor akCaster)If akTarget.HasPerk(myPerk)akTarget.AddKeyword(myKeyword);Debug.Notification("Keyword"+myKeyword+"has been applied to"+akTarget)EndIfEndEvent Link to comment Share on other sites More sharing options...
Recommended Posts