Jump to content

Script to prevent certain weapons being used in power armor


Recommended Posts

Hi,

I primarily "make" replacer mods and I was wondering if anyone knew about scripts and the like.

Basically users have reported issues with weapon mods I've added to my levelled list replacers not working correctly with power armor. This is the case, however as I don't play with power armor I didn't notice. Anyway I either have to remove the weapons (they're good so I'd rather not), create animations for power armor (sounds like lots of work) or somehow make it so people cannot use the weapons in power armor.

Now I think this is a good idea from an immersion POV anyway, but its also a quick solution to this problem. Perhaps attach a script to weapons which runs on equipping that checks if the player is wearing power armor and displays an error in the top left of the screen and unequips the weapon. For NPCs a similar script could run but this time it could alter their weapon (I assume add an item and equip? perhaps this "item" could be a dedicated levelled list which could be staggered by level) so they can actually fight the player.

 

Any thoughts on the viability of this approach? And and advice for how is actually best to do something like this from a scripting POV (e.g. are there template scripts I could adapt/etc).

 

Thanks

Link to comment
Share on other sites

I would add an enchantment to your weapons, with a WornHasKeyword condition and the keyword 'ArmorTypePower'. You can use that to fire a script with the UnequipItem function. Have you considered what would happen if the player changes into power armor while they have the weapon equipped though? That may be a little trickier to deal with.

Link to comment
Share on other sites

I use this simple snip for some custom objects stuff that are blocked for PA, attach it to your base weapon forms;

 

Scriptname myPowerArmorUnequipObjectScript extends ObjectReference

Keyword Property pIsPowerArmorFrame Auto Const Mandatory
Message Property pmyMessageName Auto Const Mandatory 
Weapon Property pmyWeaponBaseFormName Auto Const Mandatory 

Event OnEquipped(Actor akActor)
CheckForPowerArmor(akActor)
EndEvent

Event OnUnequipped(Actor akActor)
   Self.UnregisterForAllEvents()
EndEvent

Event OnAnimationEvent(ObjectReference akSource, string asEventName)
CheckForPowerArmor(akSource as Actor)
EndEvent

Function CheckForPowerArmor(Actor akActor)
If(akActor.WornHasKeyword(pIsPowerArmorFrame) == true)
   Self.UnregisterForAllEvents()
   akActor.UnequipItem(akItem = pmyWeaponBaseFormName, abPreventEquip = false, abSilent = false)
   If(akActor == Game.GetPlayer())
      pmyMessageName.Show()
   Endif
Else
    Self.RegisterForAnimationEvent(akSender = akActor, asEventName = "furnitureEnterSlavePA")
EndIf
EndFunction
 

 

 

 

  • Like 1
Link to comment
Share on other sites

  • Recently Browsing   0 members

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