Jump to content

How Do I Add 'TeammateDontUseAmmoKeyword' To My Script?


Recommended Posts

I followed Seddon's tutorial on YouTube to make my very first companion. He's just about perfect, except for one small problem, I don't want him to use Ammo, yet for the life of me I can't figure out how to add it in my script.

After days of searching, I finally figured out how to make my companion draw his weapon. But I can't find any examples of how to use TeammateDontUseAmmoKeyword. I tried adding:

Keyword Property TeammateDontUseAmmoKeyword Auto Const

But that didn't work. Anyway, this is my current script.

Scriptname NormanCompanion:NormanCompanionScript extends Quest Conditional

Int Property Status Auto Conditional
{0=Home, 1=Following, 2=Waiting}
ReferenceAlias Property Alias_NormCompanion Auto Const
Faction Property CurrentCompanionFaction auto Const

Keyword Property TeammateReadyWeapon_DO Auto Const

Function HireCompanion()

   Actor Companion = Alias_NormCompanion.GetActorRef()

   Status = 1

   Companion.SetPlayerTeammate(True)
   Companion.AddToFaction(CurrentCompanionFaction)
   Companion.AddKeyword(TeammateReadyWeapon_DO)
   Companion.EvaluatePackage()

EndFunction

Function FireCompanion()

   Actor Companion = Alias_NormCompanion.GetActorRef()

   Status = 0

   Companion.SetPlayerTeammate(False)
   Companion.RemoveFromFaction(CurrentCompanionFaction)
   Companion.RemoveKeyword(TeammateReadyWeapon_DO)
   Companion.EvaluatePackage()

EndFunction

If anybody knows how to do this and can give me an example of what the code should look like, I'd be really grateful.

Link to comment
Share on other sites

Here is a standlone global script fragment example that is callable from the console. Convert GetFormFromFile into properties for a form attached script:


Script SKK_GlobalScript

Function SwitchCurrentCompanionDontUseAmmo() Global ; CallGlobalFunction "SKK_GlobalScript.SwitchCurrentCompanionDontUseAmmo"

Quest Followers = Game.GetFormFromFile(0x00289e4, "Fallout4.esm") as Quest
ReferenceAlias Companion = (Followers as FollowersScript).Companion
ObjectReference CurrentCompanion = Companion.GetReference()

If(CurrentCompanion != None)
    Keyword TeammateDontUseAmmoKeyword = Game.GetFormFromFile(0x0023f1ca, "Fallout4.esm") as Keyword
    If(CurrentCompanion.HasKeyword(TeammateDontUseAmmoKeyword) == false)
        CurrentCompanion.AddKeyword(TeammateDontUseAmmoKeyword)    
    Else
        CurrentCompanion.RemoveKeyword(TeammateDontUseAmmoKeyword)    
    EndIf
    Debug.Trace("SKK_GlobalScript.CurrentCompanionDontUseAmmo updated " + CurrentCompanion)
Endif

EndFunction

 

 

 

  • Like 1
Link to comment
Share on other sites

  • Recently Browsing   0 members

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