Help with tweaking the sneaking[message #323065]
|
Mon, 22 July 2013 16:57
|
|
merc05 |
|
Messages:90
Registered:January 2013 |
|
|
Hi guys. I would appreciate some advice on this. What I had in mind was changing some mechanisms regarding real time sneaking. First I wanted to make the game treat enemies collapsed from lack of breath as harmless, the same as it treats guys that are in dying state or have been handcuffed. Second thing is I wanted to change the way sleeping dart works, since now killing an enemy with a silenced pistol will not break stealth but shooting him with a sleep dart and leaving sleeping will. Changes I made are:
opplist.cpp void ManSeesMan
if (!pSoldier->bActive || !pSoldier->bInSector || (pSoldier->stats.bLife < OKLIFE) )
return;
to
if (!pSoldier->bActive || !pSoldier->bInSector || (pSoldier->stats.bLife < OKLIFE) || (pSoldier->bBreath < OKBREATH) )
return;
opplist.cpp void NoticeUnseenAttacker
if ( pAttacker->usAttackingWeapon == DART_GUN )
{
// rarely noticed
if ( SkillCheck( pDefender, NOTICE_DART_CHECK, 0 ) < 0)
{
return;
}
}
// do we need to do checks for life/breath here?
to
//if ( pAttacker->usAttackingWeapon == DART_GUN )
if ( AmmoTypes[pAttacker->inv[pAttacker->ubAttackingHand][0]->data.gun.ubGunAmmoType].dart )
{
// rarely noticed
if ( SkillCheck( pDefender, NOTICE_DART_CHECK, 0 ) < 0)
{
return;
}
}
// do we need to do checks for life/breath here?
if ( pDefender->stats.bLife < OKLIFE || pDefender->bBreath < OKBREATH )
return;
Overhead.cpp BOOLEAN SoldierHasSeenEnemiesLastFewTurns
if ( pSoldier->bActive && pSoldier->bInSector && ( pSoldier->bTeam == gbPlayerNum || ( pSoldier->stats.bLife >= OKLIFE ) ) )
to
if ( pSoldier->bActive && pSoldier->bInSector && ( pSoldier->bTeam == gbPlayerNum || ( pSoldier->stats.bLife >= OKLIFE && ( !gGameSettings.fOptions[TOPTION_ALLOW_REAL_TIME_SNEAK] || pSoldier->bBreath >= OKBREATH ) ) ) )
Overhead.cpp BOOLEAN NobodyAlerted
if ( ( pSoldier->bTeam != gbPlayerNum ) && ( ! pSoldier->aiData.bNeutral ) && (pSoldier->stats.bLife >= OKLIFE) && (pSoldier->aiData.bAlertStatus >= STATUS_RED) )
to
if ( ( pSoldier->bTeam != gbPlayerNum ) && ( ! pSoldier->aiData.bNeutral ) && (pSoldier->stats.bLife >= OKLIFE) && (pSoldier->bBreath >= OKBREATH) && (pSoldier->aiData.bAlertStatus >= STATUS_RED) )
Overhead.cpp BOOLEAN CheckForEndOfCombatMode
if ( pTeamSoldier && pTeamSoldier->stats.bLife >= OKLIFE && !pTeamSoldier->aiData.bNeutral )
to
if ( pTeamSoldier && pTeamSoldier->stats.bLife >= OKLIFE && ( !gGameSettings.fOptions[TOPTION_ALLOW_REAL_TIME_SNEAK] || pTeamSoldier->bBreath >= OKBREATH ) && !pTeamSoldier->aiData.bNeutral )
That basically achieved what I wanted to do. Now I can quit combat after collapsing a foe or use a sleeping dart without triggering an alarm. There is a slight problem though. After I k.o. an opponent and he wakes up he attacks naturally, but after a couple of rounds the game will quit combat mode and go into real-time even when he is not k.o.'ed again. It will start combat a second later. I guess it's the k.o.'ed guys breath gauge getting low and the game starts to recognize him as
Report message to a moderator
|
Corporal 1st Class
|
|
|
|
Re: Help with tweaking the sneaking[message #323123]
|
Tue, 23 July 2013 17:51
|
|
merc05 |
|
Messages:90
Registered:January 2013 |
|
|
Sorry for getting this somewhat incomprehensive. Currently (I mean in a trunk .exe file) the real time sneaking feature is implemented in the way that we have a check NobodyAlerted which tracks if any enemy soldier has went into a red or higher alert state. If it's false and real time sneaking is on then the player can see the enemy and the game will not go into turn based mode, unless the enemy sees us. Also the game doesn't go into turn based mode if an enemy is present but he is either in dying state or handcuffed. So I can roam the map with my merc and kill people silently provided I can take them out in one round.
Now what I want is to be less lethal in taking them out. If you played i.e. Metal Gear Solid aside from killing enemies one could knock them out with martial arts or use a sleeping dart and leave them that way and continue onward. In the way current 1.13 works I can knock an enemy out but I have to either kill him or handcuff him, otherwise the game won't end the turn based mode. That's one thing.
Second thing is the dart pistol we have in JA2. It can instantly put an enemy to sleep (his breath counter goes to 0) but as one can notice putting an enemy down with a sleeping dart still requires killing/handcuffing him in the same round or the NobodyAlerted check will go off and the player is considered discovered ergo real time sneaking can no longer be used.
The changes I want to make are:
- the enemy who is hit with a dart and goes to sleep won't go into higher alert state
- when RT sneaking is on unconscious enemies (lying on the floor due to lack of breath) don't count (the same way as dying and handcuffed ones don't), so if 2 turns pass with no combat and only unconscious enemies are lying around the turn based mode will end as the game considers player doesn't want to finish them off
As you can see I did this by adding the ->bBreath 0 and <10. The game will stop treating him as a threat so, if my merc doesn't attack in 2 consecutive turns and the enemies BP is still in range >0 <10, turn based mode will end. I was thinking of a better condition to treat an enemy as not posing a threat. There is a parameter called bCollapsed but using such a condition messed with tha AI for some reason in a way I described in the firs post (when waking up the enemy would attack me in the first turn of combat, but remain idle afterward). Stuff described in this paragraph is my main problem right now.
The issue I described is not such a big deal and if there is nothing to be done about it I can live with that. If you're asking why I wanted to do those changes - well, I wanted to add some Metal Gear flavor. I've already added a lot stuff from those games including some sci-fi stuff, hence I wanted the soldiers to act more like those morons that you had to sneak past in MG . The most noticeable thing in the gameplay is the ability to take out a soldier from afar with a dart sniper rifle without triggering an alarm, until I get close enough to tie him. Why go all the way for this? Hmm, since Flugente's prisoner system it's justifiable .
Report message to a moderator
|
Corporal 1st Class
|
|
|
|
|
|
|
|
|
|
Re: Help with tweaking the sneaking[message #323325]
|
Sat, 27 July 2013 17:22
|
|
merc05 |
|
Messages:90
Registered:January 2013 |
|
|
I think it's prone since adding a height check prevented the game from exiting to turn based mode, but this (along with other things I've tried like bCollapsed and bBreathCollapsed condition) caused a knocked out soldier to get dumb after recovering. I don't understand what can prevent the AI to attack during consecutive rounds. Maybe it still considers an
Report message to a moderator
|
Corporal 1st Class
|
|
|