Jump to content

Recommended Posts

Posted

This is a pretty heavy undertaking for a first scripting effort in Fallout 3, and its probably a wee bit over my head at the moment after how long its been since I've touched any form of scripting in a game, but I still feel like beating it down.

 

Basically, the idea behind this script is to add a swaying effect and recoil to weapons based on several different factors. My question is how can it be efficiently structured to have no slowdown in game-play?

 

I'm not sure how effective it would be, but my idea is to have the script go down and peel information about the following from the player:

Weapon Weight

Broken Limbs and how many

Player Skill

Strength OR Agility

Whether Power Armor is equipped

 

With this information received the script would calculate a value of "Anti-sway" from this value, and then when a movement change was made it would set a certain value of sway to apply to each form of movement and then subtract the "Anti-sway" from that value to stabilize your weapon.

 

In addition, upon firing another script would pull information about the:

Weight

Fire Rate of the Weapon

Gun Condition

Gun Kickback Base (Done using an itemlist to set a certain value for each weapon in the game, I think this would work?? This way I can add hi-cal rifles like the AK that have a heavy kickback, and lower-cal rifles like a M4 that have low kickback independent of weight)

 

and counter it by using that "Anti-sway" value from above.

 

Perhaps this is too far over my head right now, but I would at least like to get an effective script to pump out numbers to tweak for the time being at least. I'll need to study how the already implemented (though not very well used) sway in game works. I'm also taking a look at the "Shooter" mod by Pelinor, which is similar to what I want to do, but not quite the same.

 

 

 

Anyway, this is what I have so far, and if anyone more knowledgeable in the scripting field has a chance to look over it, let me know if this is so far headed in the right direction:

 

ScriptName RecoilScript

float fGimpArms				//Checks to see if arms are broken or not 
float fWeight				//Weapon Weight
reference rArmor			//Reference equipped Armor
reference rEquipped			// Reference equipped Weapon
short iAgility				// Player Agility
short iStrength				// Player Strength
short iSkill						// Equipped Weapon Skill
short iType				// Equipped Weapon Type
short iSway 				// Modifier to the sway value. A negative number here means lower sway, which is good.
	
Begin GameMode				  
(not sure how to introduce this function and have it play on equip, or if that would even be the efficient way to do it. Realistically since its based off stats anytime an effect landed on the player or an item was equipped/unequipped I'd want this value to recalculate)

set iAgility to Player.GetAV Agility
set iStrength to Player.GetAV Strength
set rArmor to Player.GetEquippedObject 2
set rEquipped to Player.GetEquippedObject 5
set iSkill to Player.GetWeaponSkill rEquipped
set iType to Player.GetWeaponType rEquipped
set fWeight to Player.GetWeight rEquipped
set fGimpArmLeft to Player.GetAV LeftArmCondition
set fGimpArmRight to Player.GetAV RightArmCondition

if fWeight > 5											   
set iSway to ((fWeight - 5) * 2)  
elseif fWeight > 9 && fWeight < 11			// If the weapon is 6-10 lbs. It will add an additional 2% sway per pt of weight over 5.
set iSway to 10
elseif fWeight > 10 && < 30					// If the weapon is > 10 lbs, it will add an additional 1% sway per pt of weight over 10.
set iSway to (fWeight) 
elseif fWeight > 29					// If the weapon is >29 lbs, it will stop adding extra weight and cap at 30% sway.
set iSway to 30
endif

if fGimpArmLeft = 0
set iSway to (iSway + 20)			//If you have a broken left arm, mod a negative effect. I'm assuming arms have 100 HP or something.
endif

if fGimpArmRight = 0
set iSway to (iSway + 20)			//If you have a broken right arm, mod a negative effect. I'm assuming arms have 100 HP or something.
endif

(While I know how to get the weapon type of the equipped type I don't know how to call or apply it here for weapon skills)

set iSway to (iSway - (iSkill / 4))			//At 100 skill, you will gain 25% accuracy

if iAgility > iStrength					//If you have a higher agi than str, it will be used to calculate your bonus accuracy.
set iSway to (iSway - iAgility)
elseif iStrength > iAgility
set iSway to (iSway - iStrength)		//If you have a higher str than agi, it will be used to calculate your bonus accuracy.
elseif iStrength = iAgility
set iSway to (iSway - iStrength)		//If you have equal str and agi, the bonus falls back to calculate base off your script.
endif

// At this point I'm not really sure how the player movement is called upon, or if it referencing it would even work in this this situation, so I'm pretty lost on where to go next.

 

Thanks a bunch,

~ II

Posted

Hi, I'm not going to discuss about the script itself, as it's over my head too currently :)

 

About the things affecting the aim/sway:

The limbs that have a relation to weapon skills (arms) already have a Game Setting values, which you can change outside your script, so I highly recommend using that method to clear up your script.

 

As for the script(s):

For this to be the most effective, I would use a new Global Variable that the basic script (run it from a quest using GameMode and 1-5 seconds Processing Delay) sets for the script that runs when weapon is equipped. This script would include everything else than the actual sway/weapon raise and the weapon weight.

 

For the weapons, I wouldn't use scripts in them, as it is a huge amount of work, and can be made much simpler way. Instead use another script that checks the weapon slot of the player (player is actually a container with a lot of slots), and the weight of the weapon in use (FOSE has a function for this) and use the Global Variable you set on the other script for calculations. This script should be run thru a Quest too, using 0.01 or 0.001 Delay and in GameMode.

 

I hope this helps clearing up :)

Posted
  Grandson Of Sam said:
Hi, I'm not going to discuss about the script itself, as it's over my head too currently :)

 

About the things affecting the aim/sway:

The limbs that have a relation to weapon skills (arms) already have a Game Setting values, which you can change outside your script, so I highly recommend using that method to clear up your script.

 

As for the script(s):

For this to be the most effective, I would use a new Global Variable that the basic script (run it from a quest using GameMode and 1-5 seconds Processing Delay) sets for the script that runs when weapon is equipped. This script would include everything else than the actual sway/weapon raise and the weapon weight.

 

For the weapons, I wouldn't use scripts in them, as it is a huge amount of work, and can be made much simpler way. Instead use another script that checks the weapon slot of the player (player is actually a container with a lot of slots), and the weight of the weapon in use (FOSE has a function for this) and use the Global Variable you set on the other script for calculations. This script should be run thru a Quest too, using 0.01 or 0.001 Delay and in GameMode.

 

I hope this helps clearing up :)

 

Thanks :-)

 

That gives me a much clearer picture on how to do it, now, I just have to figure out how to script all that, hah. :-)

  • Recently Browsing   0 members

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