• We are currently performing site maintenance, parts of civfanatics are currently offline, but will come back online in the coming days. For more updates please see here.

Alternative for Events.SerialEventImprovementCreated.Add

Serp

King
Joined
Apr 1, 2015
Messages
666
Hi,

the fortress borders mod and other mods which handle improvments uses the Event:
Events.SerialEventImprovementCreated.Add()

Unfortunately I found out this Event is not multiplayer compatible since it is triggered when someone find an improvement on map and gives out the player who find this improvement... which causes, if you use it in a wrong way, desync (Me and obviously most other modders thought, it is triggered when an improvement is created..not found -.-).

But I need an event that is the same for every human player.
It should be triggered when an improvement is finished (at the same time for all human players).

Is there a way to do this?
 
Have you tried whoward's DLL? Is it possible to use it in Multiplayer? I really have no idea how multiplayer works. :lol:
But if it does, you have:

Spoiler :
Code:
<!-- Events sent when plots change from worker actions (v44) -->
    <!--   GameEvents.TileFeatureChanged.Add(function(iPlotX, iPlotY, iOwner, iOldFeature, iNewFeature) end) -->
    [B]<!--   GameEvents.TileImprovementChanged.Add(function(iPlotX, iPlotY, iOwner, iOldImprovement, iNewImprovement, bPillaged) end) -->[/B]
    <!--   GameEvents.TileOwnershipChanged.Add(function(iPlotX, iPlotY, iOwner, iOldOwner) end) (v46) -->
    <!--   GameEvents.TileRouteChanged.Add(function(iPlotX, iPlotY, iOwner, iOldRoute, iNewRoute, bPillaged) end) -->
 
Use:
Code:
GameEvents.BuildFinished.Add(function(playerID, plotX, plotY, improvementID) end)

Fires twice for Great People Tile Improvements though.
Only fires for BNW, though, so won't work for a MP game where everyone only has G&K or Vanilla. Probably not much of an issue nonetheless.
 
Have you tried whoward's DLL? Is it possible to use it in Multiplayer? I really have no idea how multiplayer works. :lol:
But if it does, you have:

Spoiler :
Code:
<!-- Events sent when plots change from worker actions (v44) -->
    <!--   GameEvents.TileFeatureChanged.Add(function(iPlotX, iPlotY, iOwner, iOldFeature, iNewFeature) end) -->
    [B]<!--   GameEvents.TileImprovementChanged.Add(function(iPlotX, iPlotY, iOwner, iOldImprovement, iNewImprovement, bPillaged) end) -->[/B]
    <!--   GameEvents.TileOwnershipChanged.Add(function(iPlotX, iPlotY, iOwner, iOldOwner) end) (v46) -->
    <!--   GameEvents.TileRouteChanged.Add(function(iPlotX, iPlotY, iOwner, iOldRoute, iNewRoute, bPillaged) end) -->
Yes I use it and it works in multiplayer (not all of his mods, but most of them).

Where to find a list of all new events like this? The search does not find this event in his " DLL - Various Mod Components" thread.

Anyway, I will try JFDs suggestion first, to have a solution that also works without the dll.

Edit:
It works! Thanks :)
 
Back
Top Bottom