Moderator: Flashy
hmm, vielleicht damit zB ein paar gewisse Terroristen (Nitrat hat geschrieben:ehh, welchen Sinn ergibt es, das mit den NPC's zu machen ?
MFG....
// neu:
#define MAX_ADDITIONAL_TERRORISTS 5
void DecideActiveTerrorists( void )
{
UINT8 ubLoop, ubLoop2;
UINT8 ubTerrorist;
UINT8 ubNumAdditionalTerrorists, ubNumTerroristsAdded = 0;
UINT32 uiChance, uiLocationChoice;
BOOLEAN fFoundSpot;
// neu:
INT16 sTerroristPlacement[MAX_ADDITIONAL_TERRORISTS][2] = { {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} };
#ifdef CRIPPLED_VERSION
return;
#endif
// one terrorist will always be Elgin
// determine how many more terrorists - 2 to 4 more
// using this stochastic process(!), the chances for terrorists are:
// EASY: 3, 9% 4, 42% 5, 49%
// MEDIUM: 3, 25% 4, 50% 5, 25%
// HARD: 3, 49% 4, 42% 5, 9%
switch( gGameOptions.ubDifficultyLevel )
{
case DIF_LEVEL_EASY:
uiChance = 70;
break;
case DIF_LEVEL_HARD:
uiChance = 30;
break;
default:
uiChance = 50;
break;
}
// add at least 2 more
ubNumAdditionalTerrorists = 2;
for (ubLoop = 0; ubLoop < (MAX_ADDITIONAL_TERRORISTS - 2); ubLoop++)
{
if (Random( 100 ) < uiChance)
{
ubNumAdditionalTerrorists++;
}
}
// neu:
ubNumAdditionalTerrorists = 5;
// ifdefs added by CJC
#ifdef JA2TESTVERSION
ubNumAdditionalTerrorists = 4;
#endif
while ( ubNumTerroristsAdded < ubNumAdditionalTerrorists )
{
ubLoop = 1; // start at beginning of array (well, after Elgin)
// NB terrorist ID of 0 indicates end of array
while ( ubNumTerroristsAdded < ubNumAdditionalTerrorists && gubTerrorists[ ubLoop ] != 0 )
{
ubTerrorist = gubTerrorists[ ubLoop ];
// random 40% chance of adding this terrorist if not yet placed
// neu:
if ( ( gMercProfiles[ ubTerrorist ].sSectorX == 0 ) )
{
fFoundSpot = FALSE;
// Since there are 5 spots per terrorist and a maximum of 5 terrorists, we
// are guaranteed to be able to find a spot for each terrorist since there
// aren't enough other terrorists to use up all the spots for any one
// terrorist
do
{
// pick a random spot, see if it's already been used by another terrorist
uiLocationChoice = Random( NUM_TERRORIST_POSSIBLE_LOCATIONS );
for (ubLoop2 = 0; ubLoop2 < ubNumTerroristsAdded; ubLoop2++)
{
if (sTerroristPlacement[ubLoop2][0] == gsTerroristSector[ubLoop][uiLocationChoice][0] )
{
if (sTerroristPlacement[ubLoop2][1] == gsTerroristSector[ubLoop][uiLocationChoice][1] )
{
continue;
}
}
}
fFoundSpot = TRUE;
} while( !fFoundSpot );
// place terrorist!
gMercProfiles[ ubTerrorist ].sSectorX = gsTerroristSector[ ubLoop ][ uiLocationChoice ][ 0 ];
gMercProfiles[ ubTerrorist ].sSectorY = gsTerroristSector[ ubLoop ][ uiLocationChoice ][ 1 ];
gMercProfiles[ ubTerrorist ].bSectorZ = 0;
sTerroristPlacement[ ubNumTerroristsAdded ][ 0 ] = gMercProfiles[ ubTerrorist ].sSectorX;
sTerroristPlacement[ ubNumTerroristsAdded ][ 1 ] = gMercProfiles[ ubTerrorist ].sSectorY;
ubNumTerroristsAdded++;
}
ubLoop++;
}
// start over if necessary
}
// set total terrorists outstanding in Carmen's info byte
gMercProfiles[ 78 ].bNPCData = 1 + ubNumAdditionalTerrorists;
// store total terrorists
gubNumTerrorists = 1 + ubNumAdditionalTerrorists;
}
Wulfy301 hat geschrieben:C:\ja2\Build\Strategic\Strategic Event Handler.c
if( gMercProfiles[ TONY ].ubLastDateSpokenTo > 0 && !( gWorldSectorX == 5 && gWorldSectorY == MAP_ROW_C && gbWorldSectorZ == 0 ) )
{
// San Mona C5 is not loaded so make Tony possibly not available
if (Random( 4 ))
{
// Tony IS available
SetFactFalse( FACT_TONY_NOT_AVAILABLE );
gMercProfiles[ TONY ].sSectorX = 5;
gMercProfiles[ TONY ].sSectorY = MAP_ROW_C;
}
else
{
// Tony is NOT available
SetFactTrue( FACT_TONY_NOT_AVAILABLE );
gMercProfiles[ TONY ].sSectorX = 0;
gMercProfiles[ TONY ].sSectorY = 0;
}
}
Wenn man den Random-Wert auf Null setzt ist Tony immer im Laden!
Ich habe es ein paar mal versucht und er war jedes Mal da, scheint also hinzuhauen.
f( gMercProfiles[ TONY ].ubLastDateSpokenTo > 0 && !( gWorldSectorX == 5 && gWorldSectorY == MAP_ROW_C && gbWorldSectorZ == 0 ) )
{
// San Mona C5 is not loaded so make Tony possibly not available
if ([highlight]1[/highlight])
{
// Tony IS available
SetFactFalse( FACT_TONY_NOT_AVAILABLE );
gMercProfiles[ TONY ].sSectorX = 5;
gMercProfiles[ TONY ].sSectorY = MAP_ROW_C;
}
else // kommt niemals zum Tragen
{
// Tony is NOT available
SetFactTrue( FACT_TONY_NOT_AVAILABLE );
gMercProfiles[ TONY ].sSectorX = 0;
gMercProfiles[ TONY ].sSectorY = 0;
}
}
Mitglieder in diesem Forum: 0 Mitglieder und 1 Gast