Home » SIRTECH CLASSICS » Jagged Alliance: Unfinished Business » Vanilla Modding » It seems that we need someone to hack into jaggedalliance2.com....
It seems that we need someone to hack into jaggedalliance2.com....[message #101569]
|
Mon, 19 July 2004 00:47
|
|
HQ |
|
Messages:10
Registered:July 2004 |
|
|
It's obvious that the way http://www.jaggedalliance2.com/secrets/index.html explained how to calculate sighting penalty and crouch/prone penalty is very different from the source code...you got to see it yourself. But I bet there are still many players refering to there how to calculate those things...it seems we need a hacker to hack in there to correct the formulas :type: .
Report message to a moderator
|
Private
|
|
|
|
Re: It seems that we need someone to hack into jaggedalliance2.com....[message #101571]
|
Mon, 19 July 2004 19:47
|
|
HQ |
|
Messages:10
Registered:July 2004 |
|
|
Ok, about the sighting penalty, in Weapons.c, line 2793, you'll find this code:
iChance += 3 * ( NORMAL_RANGE - iSightRange ) / CELL_X_SIZE; Note that the other code around this line are disabled. The line above, is the sighting penalty. The NORMAL_RANGE, which can be found at line 50, is defined as 90, so it should be 9 tiles. Adding the things up, the actual sighting penalty should be:
3*(9 - X) (X = tiles away from target) (note: this may actually increase your accuracy if you are in close range, namely within 9 tiles from the target)
Instead of jaggedalliance2.com's "-2% to hit for each tile beyond 5".
About the crouch/prone penalty, first, in Weapons.h, you'll find the following:
#define POINT_BLANK_RANGE 16 Back to Weapons.c, begins at line 2837, you'll find how they calculate your accuracy penalties when your target is crouching/prone/standing (yes, you'll suffer a PENALTY when shooting at a standing target, if you are prone!)
// adjust for crouched/prone target
switch( gAnimControl[ pTarget->usAnimState ].ubHeight )
{
case ANIM_CROUCH:
if ( TANK( pSoldier ) && iRange < MIN_TANK_RANGE )
{
// 13% penalty per tile closer than min range
iChance -= 13 * ( ( MIN_TANK_RANGE - iRange ) / CELL_X_SIZE );
}
else
{
// at anything other than point-blank range
if (iRange > POINT_BLANK_RANGE + 10 * (AIM_PENALTY_TARGET_CROUCHED / 3) )
{
iChance -= AIM_PENALTY_TARGET_CROUCHED;
}
else if (iRange > POINT_BLANK_RANGE)
{
// at close range give same bonus as prone, up to maximum of AIM_PENALTY_TARGET_CROUCHED
iChance -= 3 * ((iRange - POINT_BLANK_RANGE) / CELL_X_SIZE); // penalty -3%/tile
}
}
break;
case ANIM_PRONE:
if ( TANK( pSoldier ) && iRange < MIN_TANK_RANGE )
{
// 25% penalty per tile closer than min range
iChance -= 25 * ( ( MIN_TANK_RANGE - iRange ) / CELL_X_SIZE );
}
else
{
// at anything other than point-blank range
if (iRange > POINT_BLANK_RANGE)
{
// reduce chance to hit with distance to the prone/immersed target
iPenalty = 3 * ((iRange - POINT_BLANK_RANGE) / CELL_X_SIZE); // penalty -3%/tile
iPenalty = __min( iPenalty, AIM_PENALTY_TARGET_PRONE );
iChance -= iPenalty;
}
}
break;
case ANIM_STAND:
// if we are prone and at close range, then penalize shots to the torso or head!
if ( iRange <= MIN_PRONE_RANGE && gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_PRONE )
{
if ( ubAimPos == AIM_SHOT_RANDOM || ubAimPos == AIM_SHOT_GLAND )
{
ubAdjAimPos = AIM_SHOT_TORSO;
}
else
{
ubAdjAimPos = ubAimPos;
}
// lose 10% per height difference, lessened by distance
// e.g. 30% to aim at head at range 1, only 10% at range 3
// or 20% to aim at torso at range 1, no penalty at range 3
// NB torso aim position is 2, so (5-aimpos) is 3, for legs it's 2, for head 4
iChance -= (5 - ubAdjAimPos - iRange / CELL_X_SIZE) * 10;
} To make things short, you'll first suffer 1% penalty if you are aiming at a target 3 tiles away, and then for each additional 1 tile away you'll suffer 3% more, until you reach 20% (if the target is in crouch position) or 40% (if the target is prone). About the penalty of shooting at a standing target, the code already explained it clearly enough.
Report message to a moderator
|
Private
|
|
|
|
Re: It seems that we need someone to hack into jaggedalliance2.com....[message #101573]
|
Tue, 20 July 2004 11:04
|
|
Snap |
|
Messages:286
Registered:September 2000 Location: USA (by way of the Old Wo... |
|
|
Interesting. OK, I finally took a look at the source myself. Regarding the sight range penalty, judging by the comments in the code, it looks like they in fact did something different in UB (JA2.5), which was then ported back to JA2 Gold.
// Effects based on aiming & sight
// From for JA2.5: 3% bonus/penalty for each tile different from range NORMAL_RANGE.
// This doesn't provide a bigger bonus at close range, but stretches it out, making medium
// range less penalized, and longer range more penalized
iChance += 3 * ( NORMAL_RANGE - iSightRange ) / CELL_X_SIZE;
/*
if (iSightRange < NORMAL_RANGE)
{
// bonus to hit of 20% at point blank (would be 25% at range 0);
//at NORMAL_RANGE, bonus is 0
iChance += 25 * (NORMAL_RANGE - iSightRange) / NORMAL_RANGE;
}
else
{
// penalty of 2% / tile
iChance -= (iSightRange - NORMAL_RANGE) / 5;
}
*/ However, the old code still differs from what's on the site, which is something like this:
if (iSightRange > 5) iChance -= (iSightRange/CELL_X_SIZE - 5)*2; Now where does that come from? I couldn't find anything like that in the source.
Report message to a moderator
|
Master Sergeant
|
|
|
|
|
|
|
Goto Forum:
Current Time: Sun Jan 26 17:04:35 GMT+2 2025
Total time taken to generate the page: 0.00972 seconds
|