Jump to content

Modifying weapon spread


Rippy

Recommended Posts

I have a script (see end of post) which I've been putting together, with some help from the forums here. It increases the spread momentarily after firing, to simulate recoil, since I'm sick of seeing my assault rifle fire a stream of near-perfect bullets in full auto once I get a high small guns skill.

 

So anyway, my problem is that I noticed it won't start working until the fire button is released. So, if I hold the mouse button down and fire full-auto, it still fires perfectly, but if I start rapidly clicking, the spread increases like I want it to. I've tried IsControlPressed, and the FOSE commands for key and mouse presses, but the same thing happens for all of them. Is this built-in to the game that the spread can't be changed until the weapon stops firing, or is there another command I could perhaps be using? Maybe changing the weapon's spread would work, but then you have to keep track of when they switch weapons, and that doesn't make the weapon model sway. Changing the spread during full-auto is kind of the whole point of this script...

 

Anyway, any help is appreciated, thanks!

 

-Rippy

 

scn RapidFireInaccuracy

int timer
int pentimer
int runonce
float spread

begin GameMode
if runonce == 0
	set spread to GetNumericGameSetting fGunSpreadSkillBase
	set timer to 20
	set pentimer to 5
	set runonce to 1
endif

if player.IsWeaponOut == 0
	RETURN
elseif IsControlPressed 4
	if pentimer == 5
		set pentimer to 0
	endif
	set timer to 0
elseif timer < 20
	set timer to timer + 1
	if pentimer < 5
		set pentimer to pentimer + 1
	endif
	if pentimer == 5
		set spread to spread + 5
		SetNumericGameSetting fGunSpreadSkillBase spread
		set pentimer to 6
	elseif timer == 20
		set spread to spread - 5
		SetNumericGameSetting fGunSpreadSkillBase spread
		set pentimer to 5
	endif
endif
end

 

Edit: Oh and for an unrelated mod, I was wondering:

- How the game differenciates city "non-combat" areas like Megaton, Rivet City, etc, and if there's a command to see if the player is in such an area

- What the best way would be to make NPCs in a certain area alarmed if the player's weapon is drawn. Would I want an explosion effect that runs when IsWeaponOut? I'm not sure what to do from there though, since SendAssaultAlarm is too harsh... is there something similar for a minor crime?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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