3. If there are no NPC's on the map and everyone ends his turn who are not sneaking, the combat shall end.
That's a great suggestion slowhand. If you are in sneak, your combat mode is set to off.
Well, technically it is possible, but I couldn't test it, because I did not bother to install a virtual machine to run another client at the same time, or whatever is needed for that.
Here is the code, if you are familiar a little bit installing and running the server, you can try out with ur friends:
- Using the
FOnline: Reloaded - source version 2, go to the "Server/scripts" folder and replace the "void turn_based_process(Map& map, Critter& cr, bool beginTurn)" function in the file named "main.fos" with the following:
// Call on every begin and end turn
void turn_based_process(Map& map, Critter& cr, bool beginTurn)
{
if(beginTurn)
{
if(cr.Timeout[TO_BATTLE] == 0)
cr.TimeoutBase[TO_BATTLE] = 100000000; // setting to initial value (TB_BATTLE_TIMEOUT in fonline.h)
if(!_IsTrueNpc(cr))
SetLvar(cr, LVAR_tb_turn_time, ELAPSED_TIME);
cr.StatBase[ST_MOVE_AP] = cr.Stat[ST_MAX_MOVE_AP];
cr.StatBase[ST_TURN_BASED_AC] = 0;
cr.StatBase[ST_TURN_BASED_HEX] = MAKELONG(cr.HexX, cr.HexY);
if(map.TurnBasedRound > 0)
PlaySound(cr, "icombat1.acm");
// Offline and non-real players (staff) skip turns in TB
if(cr.IsPlayer())
{
if(_IsOffline(cr) || !_IsRealPlayer(cr))
{
_EndTurn(cr);
}
}
}
else
{
uint dist = GetDistantion(cr.HexX, cr.HexY, LOWORD(cr.Stat[ST_TURN_BASED_HEX]), HIWORD(cr.Stat[ST_TURN_BASED_HEX]));
cr.StatBase[ST_TURN_BASED_AC] = 2 * (dist + cr.Stat[ST_CURRENT_AP]) >= cr.Stat[ST_ACTION_POINTS] ? 1 : 0;
if(cr.Stat[ST_TURN_BASED_AC] < 0)
cr.StatBase[ST_TURN_BASED_AC] = 0;
cr.StatBase[ST_MOVE_AP] = 0;
PlaySound(cr, "icombat2.acm");
if (_IsRealPlayer(cr))
{
if (_IsSneaking(cr))
{
Log("Player was sneaking thus end of turn and combat called: " + cr.Name);
cr.ModeBase[MODE_END_COMBAT] = 1;
}
Log("End of turn called: " + cr.Name);
}
}
}
The change part only (is at the end):
if (_IsRealPlayer(cr))
{
if (_IsSneaking(cr))
{
Log("Player was sneaking thus end of turn and combat called: " + cr.Name);
cr.ModeBase[MODE_END_COMBAT] = 1;
}
Log("End of turn called: " + cr.Name);
}
- It might introduce a bug where if the critter de-sneaks and ends turn, it will still try to end combat as well. But as I told you, I could not test it myself.
- I also added a few logs for easier debugging, which you will be able to see on the server, each time a player ends his turn, it will show his name in a new line, if he was sneaking then the message will be different. These shall be removed later, but if anyone wants to test this, it should give them an easier time.
It's up to you now, GL.
Edit:
Another, maybe more elegant solution would be to add the sneak exception to "void turn_based_begin(Map& map)" in main.fos. With the previous solution, the TB round would allow the sneaked players to use up their turns for movement or attack, while this, would not (if the sneakers are at the end of the sequence queue)/