Jump to content

Hunting Rifles


Recommended Posts

Hello all,


I have a mod that has been released for quite some time now but am still working on improvements for the mod, it is called VenomousHail's Elemental ammo. The way that it works is a script will run in and on equip of a weapon a menu will pop up and ask what type of ammo you want. I use the same basic script for all weapons and all work except for the hunting rifle. It is like the game doesn't recognize that I am equipping a gun. Is there something different from the hunting rifle compared to all of the other weapons in the game that would cause this not to work properly?


Thanks in advance


Link to comment
Share on other sites

Scriptname SelectAmmoHuntingRifle extends Actor



message property V_HuntingRifleAmmo auto Const

Weapon property V_HuntingRifleWeapon auto const

ObjectMod property mod_HuntingRifle_Chamber_Standard auto Const

ObjectMod property mod_HuntingRifle_Chamber_Acid auto Const

ObjectMod property mod_HuntingRifle_Chamber_Cryo auto Const

ObjectMod property mod_HuntingRifle_Chamber_Electric auto Const

ObjectMod property mod_HuntingRifle_Chamber_Explosive auto Const

ObjectMod property mod_HuntingRifle_Chamber_Frenzy auto Const

ObjectMod property mod_HuntingRifle_Chamber_Incendiary auto Const

ObjectMod property mod_HuntingRifle_Chamber_Paralysis auto Const

ObjectMod property mod_HuntingRifle_Chamber_Poison auto Const

ObjectMod property mod_HuntingRifle_Chamber_Radiation auto Const



Auto State Waiting

Event OnItemEquipped(Form akBaseObject, ObjectReference akReference)

Actor player = Game.GetPlayer()

Weapon gunToMod = player.GetEquippedWeapon()


if (akBaseObject is Weapon && gunToMod == V_HuntingRifleWeapon)

GoToState("Busy")

int ButtonPressed = V_HuntingRifleAmmo.show()

if ButtonPressed == 0

Player.AttachModToInventoryItem(gunToMod, mod_HuntingRifle_Chamber_Standard)

Utility.Wait(0.5)


elseif ButtonPressed == 1

Player.AttachModToInventoryItem(gunToMod, mod_HuntingRifle_Chamber_Acid)

Utility.wait(0.5)


elseif ButtonPressed == 2

Player.AttachModToInventoryItem(gunToMod, mod_HuntingRifle_Chamber_Cryo)

Utility.Wait(0.5)


elseif ButtonPressed == 3

Player.AttachModToInventoryItem(gunToMod, mod_HuntingRifle_Chamber_Electric)

Utility.Wait(0.5)


elseif ButtonPressed == 4

Player.AttachModToInventoryItem(gunToMod, mod_HuntingRifle_Chamber_Explosive)

Utility.Wait(0.5)


elseif ButtonPressed == 5

Player.AttachModToInventoryItem(gunToMod, mod_HuntingRifle_Chamber_Frenzy)

Utility.Wait(0.5)


elseif ButtonPressed == 6

Player.AttachModToInventoryItem(gunToMod, mod_HuntingRifle_Chamber_Incendiary)

Utility.Wait(0.5)


elseif ButtonPressed == 7

Player.AttachModToInventoryItem(gunToMod, mod_HuntingRifle_Chamber_Paralysis)

Utility.Wait(0.5)


elseif ButtonPressed == 8

Player.AttachModToInventoryItem(gunToMod, mod_HuntingRifle_Chamber_Poison)

Utility.Wait(0.5)


elseif ButtonPressed == 9

Player.AttachModToInventoryItem(gunToMod, mod_HuntingRifle_Chamber_Radiation)

Utility.Wait(0.5)


endif

endif

EndEvent

EndState


State Busy

Event OnItemUnequipped(Form akBaseObject, ObjectReference akReference)

if akBaseObject == V_HuntingRifleWeapon

GoToState("Waiting")

endif

EndEvent

EndState


Here is the script if it will help. This script works with all other weapons, so I don't think that it is the script that is wrong I just think that there could be something different about the hunting rifle from other weapons.

Link to comment
Share on other sites

I have a number of scripts that attach OMODs to the HuntingRifle (using formlists rather than direct properties) no problem.

 

Check you have set the V_HuntingRifleWeapon property to the actual 0004f46a weapon.

 

Check that your receiver OMODS are ma_HuntingRifle

Link to comment
Share on other sites

  • Recently Browsing   0 members

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