Jump to content

Making a Rebindable Hotkey fire Projectile A where the cursor is pointing, when gun B is equipped? How do I do that?


Epsilon725

Recommended Posts

For example, take a copied Marksman Rifle that works like it normally does in vanilla FNV, shooting bullets where you're looking. But when you press K, a 20mm Grenade is fired where you're looking. But K only does this when the customized "Marksman Rifle with UnderBarrel Grenade Launcher" is equipped. Pressing K while equipping anything else does nothing.

 

How would I go about setting this up? What scripts do I need?

Link to comment
Share on other sites

https://geckwiki.com/index.php?title=FireWeapon

 

So you pick a weapon with the projectile you want , or make a custom one and custom projectile.

 

But you need to use a reference of the weapon you have equipped , instead of the base-ID

So you need to use this https://geckwiki.com/index.php/GetEquippedObject

Or something like it , if it does not like a base-id getting stored in a ref variable.

 

rMyGun

Set rMyGun to PlayerRef.GetEquippedObject 5

rMyGun.FireWeapon MyWeapon

 

Or can have the projectile come from the center of the PlayerRef , which probably wouldn't be noticed with IronSite mode.

 

PlayerRef.FireWeapon MyWeapon

 

But putting a script on the weapon you have equipped , I think will then use it like an implicit reference.

So the scripting would look something like this ...

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SCN MyDualFireWeaponScript

Int iEquipped

 

Begin OnEquip Player

Set iEquipped to 1

End

 

Begin OnUnequip Player

Set iEquipped to 0

End

 

Begin GameMode

If iEquipped == 1

If IsKeyPressed 37 == 1 ; " K " key

FireWeapon MyWeapon ; weapon with the secondary projectile

endif

endif

End

~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

  • Recently Browsing   0 members

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