What's the difference between game_events.lua and game_diplomacy.lua?
Moderators: Slitherine Core, The Lordz
What's the difference between game_events.lua and game_diplomacy.lua?
Hi! Anyone can explain what's the difference between game_events.lua and game_diplomacy.lua? Many events are scripted in these two files, aznd I have no idea why Moreover, I think many times the same event is defined in different ways in these two files... why?
Re: What's the difference between game_events.lua and game_diplomacy.lua?
Don't call me anyone.
game_events.lua handles all events that can trigger at the start of a turn or are triggered by moving or attacking units, declarations of war and surrender events.
Many of these are disabled but were not deleted for reference purposes.
game_diplomacy.lua handles the choice events, intel, influence, alignment calculations and other stuff.
game_events.lua handles all events that can trigger at the start of a turn or are triggered by moving or attacking units, declarations of war and surrender events.
Many of these are disabled but were not deleted for reference purposes.
game_diplomacy.lua handles the choice events, intel, influence, alignment calculations and other stuff.
Slitherine's Commander the Great War - Director's Cut: POTZBLITZ mod!
FIND IT HERE: http://www.slitherine.com/forum/viewtopic.php?f=218&t=77884&p=662610#p662610
Re: What's the difference between game_events.lua and game_diplomacy.lua?
You are right Robotron
Ok, but why there are some events in both files? For example, spawning units in Kerenski and the irish revolt events are defined in both files.... why?
Ok, but why there are some events in both files? For example, spawning units in Kerenski and the irish revolt events are defined in both files.... why?
Re: What's the difference between game_events.lua and game_diplomacy.lua?
Many events for spawning units have two versions:
one for singleplayer (in game_diplomacy.lua) which can be triggered at any time during a turn.
and one for multiplayer (in game_events.lua) which MUST be triggered at the START of a turn or else the game will crash during the other player's replay phase.
You can see whether a function or statement is viable for single or multiplayer by looking for occurrences of:
if game.type == Game.TYPE_SINGLE then
(...)
end
or
if game.type == Game.TYPE_PBEM then
(...)
end
one for singleplayer (in game_diplomacy.lua) which can be triggered at any time during a turn.
and one for multiplayer (in game_events.lua) which MUST be triggered at the START of a turn or else the game will crash during the other player's replay phase.
You can see whether a function or statement is viable for single or multiplayer by looking for occurrences of:
if game.type == Game.TYPE_SINGLE then
(...)
end
or
if game.type == Game.TYPE_PBEM then
(...)
end
Slitherine's Commander the Great War - Director's Cut: POTZBLITZ mod!
FIND IT HERE: http://www.slitherine.com/forum/viewtopic.php?f=218&t=77884&p=662610#p662610
Re: What's the difference between game_events.lua and game_diplomacy.lua?
So, if an event is repeated in both files is because the version in game_diplomacy.lua is only for single player games and the version in game_events.lua is only for PBEM games?
Re: What's the difference between game_events.lua and game_diplomacy.lua?
For events about spawning units, yes.
There are however many functions in game_events.lua that are obsolete and are no longer called from TriggerTurnEvents.
To see whether a function is obsolete just perform an automated search of the whole scripts folder using notepad++ (takes only 1 second)
Seach for the name of the function followed by ()
For example: Kerenski()
If there are no hits, then that function is no longer getting called from anywhere and no longer needed and therefore obsolete.
function Kerenski() is obsolete like most other unit spawning events for multiplayer since V9, it has been integrated into function Offensives() in game_events.lua
There are however many functions in game_events.lua that are obsolete and are no longer called from TriggerTurnEvents.
To see whether a function is obsolete just perform an automated search of the whole scripts folder using notepad++ (takes only 1 second)
Seach for the name of the function followed by ()
For example: Kerenski()
If there are no hits, then that function is no longer getting called from anywhere and no longer needed and therefore obsolete.
function Kerenski() is obsolete like most other unit spawning events for multiplayer since V9, it has been integrated into function Offensives() in game_events.lua
Slitherine's Commander the Great War - Director's Cut: POTZBLITZ mod!
FIND IT HERE: http://www.slitherine.com/forum/viewtopic.php?f=218&t=77884&p=662610#p662610
Re: What's the difference between game_events.lua and game_diplomacy.lua?
Ok Robotron, thanks again.