Home » MODDING HQ 1.13 » Flugente's Magika Workshop » New Feature: Dynamic opinions
Re: New Feature: Dynamic opinions[message #354469 is a reply to message #354466] Wed, 22 August 2018 00:18 Go to previous messageGo to previous message
Flugente

 
Messages:3507
Registered:April 2009
Location: Germany
Some of those are good, some rather meh, and some hard to do. I might use some... at some point. I'm not exactly coding a lot at this point.

As to your question, as I don't have a lot of time, perhaps the code yield sufficient explanation for once:

// depending on what happened in the battle, our mercs might complain or celebrate
void HandleDynamicOpinionBattleFinished( BOOLEAN fBattleWon )
{
	UINT32 ourlosses = 0;
	UINT32 enemylosses = 0;
	UINT32 oursidesize = 0;
	UINT32 enemysidesize = 0;
	
	// pick the 'leader' who gets all the praise (or blame, depending on how this went)
	UINT8 leaderid = GetBestMercLeaderInSector( SECTORX( gCurrentIncident.usSector ), SECTORY( gCurrentIncident.usSector ), (INT8)gCurrentIncident.usLevel );

	if ( leaderid != NOBODY )
	{
		// while it would be logical to also take civilian losses into account, this would lead to mercs always disapproving engaging hostile civilain factions like Kingpin and the Hicks
		for ( UINT16 i = 0; i < CAMPAIGNHISTORY_SD_CIV; ++i )
		{
			ourlosses += 10 * gCurrentIncident.usKills[i];
			ourlosses += gCurrentIncident.usWounds[i];
			ourlosses += 8 * gCurrentIncident.usPrisoners[i];		// having our side being captured is not quite as bad as having them killed

			oursidesize += gCurrentIncident.usParticipants[i];
		}

		for ( UINT16 i = CAMPAIGNHISTORY_SD_ENEMY_ADMIN; i < CAMPAIGNHISTORY_SD_MAX; ++i )
		{
			enemylosses += 10 * gCurrentIncident.usKills[i];
			enemylosses += 11 * gCurrentIncident.usPrisoners[i];	// capturing the enemy is even better than killing them

			enemysidesize += gCurrentIncident.usParticipants[i];
		}

		// if we've taken more losses than the enemy, our mercs will complain - even if we won. Our mercs don't seem to like phyrric victories...
		if ( ourlosses > enemylosses && ourlosses > 75 )
		{
			HandleDynamicOpinionChange( MercPtrs[leaderid], OPINIONEVENT_WORSTCOMMANDEREVER, TRUE, TRUE );
		}
		else
		{
			// our mercs praise their leader if
			// they won the battle
			// the enemy outnumbered them at least 2:1
			// the enemy had at least 4 times their losses
			// the enemy patrol was of significant size (this is supposed to be given for huge battles only)
			if ( fBattleWon && 2 * oursidesize < enemysidesize && 4 * ourlosses < enemylosses && enemylosses > 10 * gGameExternalOptions.iMaxEnemyGroupSize )
			{
				HandleDynamicOpinionChange( MercPtrs[leaderid], OPINIONEVENT_BESTCOMMANDEREVER, TRUE, TRUE );
			}
		}
	}
}



I know now that it could never work between us, as much as we wanted to, it could never be! Not because you're a rabbit, but because you're black.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.

Report message to a moderator

Captain

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message light45.png
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: New merc (kinda): chaos Buns
Next Topic: New feature: new drug system
Goto Forum:
  


Current Time: Tue Dec 03 08:33:29 GMT+2 2024

Total time taken to generate the page: 0.02546 seconds