Jump to content

Question: Making an underbarrel grenade launcher script


undyne777

Recommended Posts

Hello all,

 

I am looking to create a script that switches your weapon to use an underbarrel grenade attachment (essentially temporarily replace the weapon with a version that fires grenades). I have looked for guides/posts that detail this, but for some reason I can't find anything helpful.

 

Does anyone have any suggestions on how to do this (or places where I could read up on how to do it?)

 

Thanks in advance!

Link to comment
Share on other sites

well, FOSE has script functions which should be able to help...I'm sure I've seen something like this as a FOSE based mod.

aside from that, well, you might be able to do something with a change in ammo type.

just make its ammo-lists include 25mm grenades or somesuch. or possibly a variant on them that actually references the projectile it needs to use.

 

so yes, very easy assuming I've got this right, but you might end up with a gun that seems to be firing its grenades out of its gun-barrel. it'll look fine if you're not watching too closely though.

Link to comment
Share on other sites

Here's a Rifle/Shotgun script I did for FO3, just playing around. You might start with something like this:

 

scn RHKShogunRifleScript 

Short iSetup 
Short ikey 
Short itoggle 
Float fhealth
short icurKey
float fTimer



BEGIN ONAdd Player

set fTimer to 2
set iSetup to 0

END

 
BEGIN Gamemode  

IF iSetup == 0
	if (fTimer < 0)			;timer prevents CTD
		IF fhealth == 0  
			Set fhealth to .95  
		EndIF  
		Set ikey to 35 ;   H - press H key to switch
		Set iSetup to 1 
	else
		set fTimer to ftimer - GetSecondsPassed
		return
	endif
EndIF  

IF (itoggle == 0)	     
	IF (icurKey && IsKeyPressed icurKey)	;Makes sure key is only registered once
		return
	Else
		set icurKey to 0
	Endif

	IF (IsKeyPressed ikey)
		Set itoggle to 1
		Set icurKey to ikey
	Endif
Endif

IF itoggle == 1
	Set itoggle to 0
	IF Player.getEquipped RHKWeapHuntingRifle == 1 
		Set fhealth to (Player.GetWeaponHealthPerc) / 100
		player.AddItemHealthPercent RHKWeapShotgunCombat 1 fhealth 1 
		player.equipitem  RHKWeapShotgunCombat 0 1 
		Player.removeitem  RHKWeapHuntingRifle 1 1 
	ElseIF player.getEquipped  RHKWeapShotgunCombat == 1 
		Set fhealth to (Player.GetWeaponHealthPerc) / 100
		player.AddItemHealthPercent  RHKWeapHuntingRifle 1 fhealth 1 
		player.equipitem  RHKWeapHuntingRifle 0 1 
		player.RemoveItem   RHKWeapShotgunCombat 1 1
	Else
		if (Player.GetItemCount RHKWeapShotgunCombat)
			Player.AddItemHealthPercent RHKWeapHuntingRifle 1 fhealth 1
			Player.RemoveItem RHKWeapShotgunCombat 1 1
		endif
		Player.EquipItem RHKWeapHuntingRifle 0 1				
	EndIF 
ENDIF 


END

 

Edit:

Both weapons have this script on it.

Link to comment
Share on other sites

Thanks Ruadhan2300 and rickerhk!

 

I'll play around with this/try to figure it out a little bit. I think the hotswap is probably the best bet.

 

I also found an interesting option that Earache explained on another forum that I might look into.

 

Thanks again!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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