Weapon FX

Post » Tue May 17, 2011 4:49 am

Afternoon all,

I'm currently trying to fathom how to run a screen effect when a weapon is fired.

At current, I was thinking it'd be a case of running a ScriptEffectStart which is applied to an effect of some kind which is then in turn applied to the questioned weapon, but I'm getting a little brain tied.

I can't think of anything vanilla I can base my idea from, so I was wondering if anybody else knew?

Cheers,

Kris

EDIT:- RESOLVED

Foolish bugger, I had a bit of a look and hey presto, found what I needed;

begin GameModeif IsPlayerActionActive 3 == 1	imod YOUR EFFECT GOES HEREendifend


Apply that script to the weapon and you're good to go :)
User avatar
LittleMiss
 
Posts: 3412
Joined: Wed Nov 29, 2006 6:22 am

Post » Tue May 17, 2011 11:28 am

Yep. For other gun-related messing abouts, and getting NPCs to mess about with guns, you might find this snippet useful, lazily copy-pasted from a mini-tutorial in one of my mod's readmes:
The following code, when put on a weapon, gets the reference of its owner (CONT, set by GetContainer) and whether or not it's equipped (ACTIVE).
Then if its got an owner, and it's equipped, it checks to see when the owners animation changes to 'Preparing to fire' (GetAnimAction == 2), then detects when it changes to something else (so they've finished preparing and have actually fired- GetAnimAction != 2).
You can then play around with scripts and variables and what have you to do other things.

---------
ref contshort activeshort animbegin onequipset cont to getcontainerset active to 1endbegin onunequipset active to 0endbegin ondropset cont to 0endbegin gamemodeif(cont)	if(active)		if(cont.GetAnimAction == 2 && anim == 0)			set anim to 1		elseif(cont.getanimaction != 2 && anim == 1)			;WEAPON FIRED			set anim to 0			cont.fireweapon WHATEVER		endif	endifelse	set cont to getcontainer	if(cont)		if(cont.getequipped THISWEAPON)			set active to 1		endif	endifendifend

For example you can put a Cont.GetDistance Player check in the "Weapon fired" block and have NPCs firing the weapon near the player trigger the iMod.
User avatar
OJY
 
Posts: 3462
Joined: Wed May 30, 2007 3:11 pm

Post » Tue May 17, 2011 2:21 am

Ironic and timely that he asked the question like 3 days after you made that post teaching us exactly how you did this very thing with your mods. :)

Good advice BTW, that script will come in Very Handy! I've already recommended it to a friend in a similar predicament.

Cheers!

M
User avatar
louise fortin
 
Posts: 3327
Joined: Wed Apr 04, 2007 4:51 am


Return to Fallout 3