Home » SIRTECH CLASSICS » Jagged Alliance: Unfinished Business » Vanilla Modding » Marksmanship penalty for damaged weapons
Marksmanship penalty for damaged weapons[message #102225] Fri, 02 September 2005 13:33 Go to next message
Snap is currently offline Snap

 
Messages:286
Registered:September 2000
Location: USA (by way of the Old Wo...
When chance-to-hit (CTH) is calculated in JA2, the penalty for damaged weapon is calculated thus: if the shooter's effective marksm. is higher than the weapon status, then there is no penalty at all; if it is lower, then the penalty is equal to half the difference between the two:

Tactical/Weapons.cpp(2949)

if (iGunCondition >= iMarksmanship)
	// base chance is equal to the shooter's marksmanship skill
	iChance = iMarksmanship;
else
	// base chance is equal to the average of marksmanship & gun's condition!
	iChance = (iMarksmanship + iGunCondition) / 2;
In practice, weapon repair status hardly ever matters, since players tend to keep their guns in pretty good shape. That is why I thought a penalty expressed as a coefficient might work better:

iChance = ( iMarksmanship * iGunCondition ) / 100;
I.e. a gun in 80% condition will reduce effective marksmanship by 20% (there are many other factors that are factored into the CTH later on). If this seems too much, the penalty could be halved (say) as follows:

iChance = ( iMarksmanship * (iGunCondition + 100) ) / 200;
One drawback of this scheme is that enemies will now incur penalty as well. Normally, automatically generated enemies have marksmanship equal to their main gun condition (or the other way around), so that according to the existing scheme they get practically no penalty for damaged guns.

Report message to a moderator

Master Sergeant
Re: Marksmanship penalty for damaged weapons[message #102226] Fri, 02 September 2005 14:04 Go to previous messageGo to next message
Madd_Mugsy

 
Messages:634
Registered:July 2005
Location: Canada
Snap,

Also note this bit of code, which is just a few lines above your quoted code:

iGunCondition = WEAPON_STATUS_MOD( pInHand->bGunStatus );
This says that any condition >= 85 is treated as 100. So the chance=(marks+cond)/100 isn't too strict.

I've gone and added this to preserve the enemy's balance:

	if ( PTR_OURTEAM )
	{
		iChance = ( iMarksmanship * iGunCondition ) / 100;
	}
	else
	{
		if (iGunCondition >= iMarksmanship)
			// base chance is equal to the shooter's marksmanship skill
			iChance = iMarksmanship;
		else
			// base chance is equal to the average of marksmanship & gun's condition!
			iChance = (iMarksmanship + iGunCondition) / 2;
	}

Report message to a moderator

First Sergeant

Re: Marksmanship penalty for damaged weapons[message #102227] Fri, 02 September 2005 18:01 Go to previous messageGo to next message
Snap is currently offline Snap

 
Messages:286
Registered:September 2000
Location: USA (by way of the Old Wo...
Quote:
Originally posted by Madd Mugsy:
This says that any condition >= 85 is treated as 100. So the chance=(marks+cond)/100 isn't too strict.
Oh. I forgot about that. I would remove that check altogether and just use the the gun condition directly - otherwise it will rarely do anything.

Nice solution WRT to enemy penalties. Not exactly fair, but given the reality of the situation I think it's the best one can do.

While we are at it, I was looking at the jamming code (Tactical/Weapons.cpp 940). They disabled code that made jams dependent on gun reliability, and generally watered it down. Why? I think gun jams should be more of a reality in JA2. But most of all, I don't understand this bit of code at the top:

// should jams apply to enemies?
if (pSoldier->uiStatusFlags & SOLDIER_PC)
All this applies only to enemies, or what? Where's the code for others then? I know mercs' guns can jam...

Report message to a moderator

Master Sergeant
Re: Marksmanship penalty for damaged weapons[message #102228] Fri, 02 September 2005 18:35 Go to previous messageGo to next message
Shadow21 is currently offline Shadow21

 
Messages:328
Registered:November 2001
Location: on route to San Hermanos
i think it only aplies to Player Charachters as PC stands for it in my oppinion

Report message to a moderator

Master Sergeant
Re: Marksmanship penalty for damaged weapons[message #102229] Sat, 03 September 2005 04:09 Go to previous messageGo to next message
Madd_Mugsy

 
Messages:634
Registered:July 2005
Location: Canada
Shadow's correct. It's only for mercs.

They took reliability out of the jamming equation, but made unreliable guns decrease in status faster.

Report message to a moderator

First Sergeant

Re: Marksmanship penalty for damaged weapons[message #102230] Sun, 04 September 2005 11:09 Go to previous message
Snap is currently offline Snap

 
Messages:286
Registered:September 2000
Location: USA (by way of the Old Wo...
D'oh! OK, I'll think about this.

Report message to a moderator

Master Sergeant
Previous Topic: Way to increase visual range?
Next Topic: What changes have been made?
Goto Forum:
  


Current Time: Thu Apr 18 20:54:29 GMT+3 2024

Total time taken to generate the page: 0.01385 seconds