Jump to content

Help with my first mod


Recommended Posts

This is entirely possible. Here's the basic script for it, but you will need to play around with the properties. Note that I'm visiting family right now so I'm not able to check that this code compiles fully. If you end up using this script, please give me proper credit in your mod.

 

ScriptName RenMIRVQuestScript extends Quest
 
Projectile Property MIRVProj Auto
ObjectReference Property MIRVProjObj Auto
 
Explosion Property FatManExplosionMIRVpack Auto

Weapon Property MIRVWeap Auto
 
Ammo Property MIRVAmmo Auto

Actor Property PlayerRef Auto

Int MIRVAmmoCount
Int MIRVAmmoCountPrev
 
Event OnInit()
	Self.StartTimer(0, 0.1)
endEvent
 
Event OnTimer(int timerid)
	if (PlayerRef.IsWeaponDrawn() == true && PlayerRef.IsEquipped(MIRVWeap) == true)
		MIRVAmmo = MIRVWeap.GetAmmo()
		MIRVAmmoCountPrev = PlayerRef.GetItemCount(MIRVAmmo)
	else
		MIRVAmmo = none
		MIRVAmmoCount = 0
		MIRVAmmoCountPrev = 0
	endif
	if (MIRVAmmo != none && PlayerRef.IsWeaponDrawn() == true)
		MIRVAmmoCount = PlayerRef.GetItemCount(MIRVAmmo)
		if (MIRVAmmoCount < MIRVAmmoCountPrev && PlayerRef.InIronSights() == false)
			; player fired weapon, so projectile is created
			MIRVAmmoCountPrev = MIRVAmmoCount
			MIRVProjObj = Game.FindClosestReferenceOfTypeFromRef(MIRVProj, PlayerRef, 40000) As ObjectReference
		endif
	endif
	if (MIRVProjObj != none)
		; got the projectile object
		if (PlayerRef.InIronSights() == true)
			MIRVProjObj.PlaceAtMe(FatManExplosionMIRVpack)
			; should place the "explosion" right at the
			; projectile location
			MIRVProjObj.DisableNoWait()
			MIRVProjObj.DeleteWhenAble()
			MIRVProjObj = none
		endif
	endif
	Self.StartTimer(0, 0.1)
endEvent
Edit: Made some small code improvements. Edited by Reneer
Link to comment
Share on other sites

  • Recently Browsing   0 members

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