The6thMessenger Posted June 1, 2021 Share Posted June 1, 2021 (edited) Hello Can you help me? I have the coding logic, but I don't know how to put this into Papyrus. Scriptname AmmoSwitch extends ActiveMagicEffect Const Form Property ActivatorItem Auto Form myweapon = Actor.GetEquippedWeapon() ObjectMod Property OMOD Auto Form <<WeaponKeyword>>; This formID specifies what keyword is needed Message Property t6MAmmoSwitchDeny Auto Const Message Property t6MAmmoSwitchAllow Auto Const Event OnEffectStart(Actor akTarget, Actor akCaster) If <<Weapon has Weapon Keyword>> Actor.AttachModToInventoryItem(MyWeapon, OMOD) t6MAmmoSwitchAllow.show() <<Initiate Reload>> ;This block makes the player reload weapon ElseIf t6MAmmoSwitchDeny.show() EndIf Game.GetPlayer().AddItem(ActivatorItem, 1, True) ;This block refunds item used EndEvent Basically, upon consumption of a consumable, the script checks the currently equipped weapon for a keyword, then applies a mod, and sends a message. If no keyword is found, then no attachment is made and sends a different message. Also refunds the item used. Those in <<>> are the ones I can't figure out. Please help. Edited June 1, 2021 by The6thMessenger Link to comment Share on other sites More sharing options...
LarannKiar Posted June 2, 2021 Share Posted June 2, 2021 (edited) You can try this: Scriptname AmmoSwitch extends ActiveMagicEffect Const Form Property ActivatorItem Auto Const ;I'd use an activator property instead: "Activator Property ActivatorItem Auto Const" ObjectMod Property MyOMOD Auto Const Message Property t6MAmmoSwitchDeny Auto Const Message Property t6MAmmoSwitchAllow Auto Const Actor Property MyActor Auto Const Keyword Property WeaponKeyword Auto Const ;Form <<WeaponKeyword>>; This formID specifies what keyword is needed ;Use the keyword property instead Event OnEffectStart(Actor akTarget, Actor akCaster) Weapon MyWeapon = MyActor.GetEquippedWeapon() If MyWeapon.HasKeyword(WeaponKeyword) MyActor.AttachModToInventoryItem(MyWeapon, MyOMOD) t6MAmmoSwitchAllow.show() MyActor.UnequipItem(MyWeapon, abSilent = True) ;Forces the actor to unequip their weapon (maybe you can skip this line) MyActor.EquipItem(MyWeapon, abSilent = True) ;Forces the actor to re-equip their weapon (maybe you can skip this line too. It needs testing..) MyActor.DrawWeapon() ;Forces the actor to draw their weapon. Honestly, I don't know if you can "force" the actor to reload their weapon directly. But Unequipping then Re-Equipping "reloads" the weapon.. Else t6MAmmoSwitchDeny.show() EndIf MyActor.AddItem(ActivatorItem, 1, abSilent = True) EndEvent Edited June 2, 2021 by LarannKiar Link to comment Share on other sites More sharing options...
The6thMessenger Posted June 14, 2021 Author Share Posted June 14, 2021 I see, thanks for the help. But I already got this working for a long time. There was also a problem with the engine being unable to modify more than one weapon at the time. A guy name IDontKnow figured this out by isolating the weapon at a temporary container, and then returning it to the player. And that is what I did. Ammo Switching for Weapons Overhaul is online for quite some time. But thanks anyways. Link to comment Share on other sites More sharing options...
LarannKiar Posted June 14, 2021 Share Posted June 14, 2021 I see, thanks for the help. But I already got this working for a long time. There was also a problem with the engine being unable to modify more than one weapon at the time. A guy name IDontKnow figured this out by isolating the weapon at a temporary container, and then returning it to the player. And that is what I did. Ammo Switching for Weapons Overhaul is online for quite some time. But thanks anyways. Well, you asked your question on June 1 and I answered it on June 2 but I'm glad you figured it out "for a long time". :) Link to comment Share on other sites More sharing options...
Recommended Posts