Quick question - is that <text> bug fixed yet, i.e. can I pack CPP or is the update still pending?
Reforestation.lua of the Reforestation (v 8) Mod
line 8: local random = math.random
line 36: if (random(1, 100) < 4) then
to
line 8: local random = Game.Rand
line 36: if (random(100,"") + 1 < 4) then
Plague_Main.lua of Health and Plague (v 19) Mod
line 228: local i = math.random(bestCities);
line 271: local i = math.random(#targetCities)
line 296: name = choices[math.random(#choices)]
line 357: local i = math.random(#sabotageTargets)
to
line 228: local i = Game.Rand(bestCities,"") + 1;
line 271: local i = Game.Rand(#targetCities,"") + 1
line 296: name = choices[Game.Rand(#choices,"") + 1]
line 357: local i = Game.Rand(#sabotageTargets,"") + 1
CivNames.lua of Civ Names by Policies (v 8) Mod
Line 315: pd[p] = math.min(6, math.random(0, p1))
Line 322: local way = math.random(1, 3)
Line 325: pd.FREEDOM = math.min(25, math.random(0, p5))
Line 327: pd.ORDER = math.min(25, math.random(0, p5)) * 2
Line 329: pd.AUTOCRACY = math.min(25, math.random(0, p5))
Line 333: local r = math.random()
Line 337: r = math.random()
Line 341: r = math.random()
Line 345: pd.cities = math.random(1, 2)
Line 350: pd.units = math.sqrt(1, math.random(10000)) / 15
Line 358: pd.religion = Game.GetReligionName(rels[math.random(1, n)])
Line 360: r = math.random()
Line 1015: form = math.random(1, 2)
Line 1443: vassal = math.random(1, 5) == 1
Line 1456: return math.random(1, 5) == 1
to
Line 315: pd[p] = math.min(6, Game.Rand(p1,"") + 1)
Line 322: local way = Game.Rand(3,"") + 1
Line 325: pd.FREEDOM = math.min(25, Game.Rand(p5,"") + 1)
Line 327: pd.ORDER = math.min(25, Game.Rand(p5,"") + 1) * 2
Line 329: pd.AUTOCRACY = math.min(25, Game.Rand(p5,"") + 1)
Line 333: local r = Game.Rand(1000,"") / 1000
Line 337: r = Game.Rand(1000,"") / 1000
Line 341: r = Game.Rand(1000,"") / 1000
Line 345: pd.cities = Game.Rand(2,"") + 1
Line 350: pd.units = math.sqrt(1, Game.Rand(10000,"") + 1) / 15
Line 358: pd.religion = Game.GetReligionName(rels[Game.Rand(n,"") + 1])
Line 360: r = Game.Rand(1000,"") / 1000
Line 1015: form = Game.Rand(2,"") + 1
Line 1443: vassal = Game.Rand(5,"") + 1 == 1
Line 1456: return Game.Rand(5,"") + 1 == 1
@Serp
I've encountered this bug during a multiplayer game using either the normal Fortress Borders and your Vorposten Mod. If a desync occurs after the construction of a vorposten, it can revert to a different human player than the one who built it, even if original owner had a unit posted in the vorposten. The game will come back from the desync with that the original owner's unit kicked out and the vorposten borders reverted to different player. I believe that the desync is being caused by this mod as well, but I have no proof other than a hunch.
Anyone knows how to get Firetuner work in multiplayer?
If I start a singleplayer, the print statements are printed, but in multiplayer (local on two pcs with the same steam account), the firetuner does not work...
I need the print statements to figure out bugs in multiplayer...
I don't know about firetuner, but with logging turned on, it does appear that statements are being written to the log files, like lua.log. Not sure if that helps.
Thanks, this does work
Solved:
I uploaded the fixed main.lua under "known Bugs" in my modpack post http://forums.civfanatics.com/showpost.php?p=13779673&postcount=315 .
I solved it by getting the owner of the unit on the plot, where the vorposten is created, since the worker is standing there.
So I added the lines:
-- iPlayer is wrong in multiplayer, therefore get the player from the unit on this plot. This unit build the improvement
pUnit = pPlot:GetUnit()
Player = pUnit:GetOwner()
(and changed the iPlayer in the function into Player)
When I go to Assets/Gameplay/NewText I have German (because it is my system language) and English (I guess standard for everyone) texts there. So yes, I'm sure my mutli modpack works in english and german. But it would create blank files, if I try to add another language, cause I don't have the textfiles for these languages.
I read that you can set your language on steam for each game and then steam will download the textfiles for these languages. That way you would be able to create a real multi language modpack.
I think the best solution for MPMPM would be to create a textfile for each language that appaear in the game textfiles or in one mod textfile. *
Or/and you could add an additional download, which includes all major language textfiles for the game. And everyone who want to create a multi language version have to download this first (would make sense, if you have to select and download every single language on steam and are not able to download it in a packet...)
edit:
When I make a modpack with german textfiles only, but the mod has no german translation, ingame will be a "text missing" message for the mod textfiles.
I wonder why...
Anyway, I tested something: I deleted one german text entry in the override file (deleted the whole replace tag). Ingame this missing text was replaced by the english one automatically. So I guess, if no english text is in the override, the text is missing. But if an english text is there, it will replace the missing texts.
-> Every modpack, regardless which language it should be, needs the english texts as standard.
* from this test we know, that missing text entries will be replaced by the english ones. So I think blank override files/missing text entries will be no problem...
...but you should test this, if this is also the case for game textfiles... Because when I play with a modpack, that has english language only, my game language is still german, only the mods are english...
... I'm stucked nowI don't know if my last sentence mean, that we don't need all gametextfiles... =/
Quick question - is that <text> bug fixed yet, i.e. can I pack CPP or is the update still pending?
I fixed it and put a pull request here, but it hasen't been merged yet.
For those of you in the know, did I rewrite the code correctly? I switched every instance of math.random to Game.Rand. Everything seems to be working in game so far, but I just want to be sure.
I noticed that there are some math.randoms in the last lua that call for a minimum value of 0 as opposed to 1? Is it possible for Game.Rand to return 0 as an value without losing the correction for mval-1 that comes by adding the '+ 1'?
cicero225 said:Substitute in Game.Rand() for every math.random(). They have slightly different syntax.
Game.Rand( int mval, string log_message) returns a random integer between 0 and mval-1, and inserts the log_message into the lua log. log_message can also just be "" if you want no message.
math.random(), on the other hand, returns either a pseudorandom decimal (double precision) between 0 and 0.9999... or, if called as math.random(mval), gives a random value between 1 and mval.
It's obnoxious, but math.random(mval) need to become Game.Rand(mval,"message")+1, and math.random() needs to become Game.Rand(mval,"message")/mval , where mval is chosen sufficiently high that the change in precision won't matter (1000 is probably safe enough).
Lua stores all numeric values as double precision, so no type conversion is necessary.
Ask me if that doesn't make sense to you.
Edit: Reference links:
http://modiki.civfanatics.com/index....(Civ5_API)
(It doesn't specify the integer range, but the civ 5 source code clearly shows 0 to n-1)
http://www.lua.org/pil/18.html
Anyone knows how to get Firetuner work in multiplayer?
If I start a singleplayer, the print statements are printed, but in multiplayer (local on two pcs with the same steam account), the firetuner does not work...
I need the print statements to figure out bugs in multiplayer...
Excellent! I'll test it out. I noticed there was some other stuff that called for iPlayer in that lua file. You think that other stuff will be fine?
Currently testing civaddiction's modpack, I'll see if it causes less desyncs in there for me.I made a thread here http://forums.civfanatics.com/showthread.php?p=13815777 and got good replies![]()
So I think the problem is solved now (again uploaded to known bugs section).
I replaced the Events.SerialEventImprovementCreated.Add with GameEvents.BuildFinished.Add and this should work
Would be great if someone could test it in all variations, but I think it works.
@ civaddiction:
I see you updated your modpack and put in most of my improved mods, too
You write, that the Barbarian and improvement upgrade mod causes runtime errors.
Are you able to provide more information?
Is it only in mutliplayer or in singleplayer also? And do you now when the errors appaer ? (e.g when a barbarian general is killed or when imrpovement xy is build) ?
Runtime Error: Assets\DLC\MP_MODSPACK\Mods\(BNW) Leugi's Barbarian Inmersion Enhancements (v 1)\Lua\BarbarianEraScripts.lua:318: attempt to call global 'save' (a nil value)
Runtime Error: Assets\DLC\MP_MODSPACK\Mods\(BNW) Leugi's Barbarian Inmersion Enhancements (v 1)\Lua\BarbarianUnhappiness.lua:26: attempt to call global 'load' (a nil value)
Runtime Error: Assets\DLC\MP_MODSPACK\Mods\(BNW) Leugi's Barbarian Inmersion Enhancements (v 1)\Lua\UI\BarbarianCampPopup.lua:22: attempt to call global 'load' (a nil value)
If I get 'missing xml file' and 'missing sniper.dds' errors during loading screen, what exactly does that mean?
Context: I packed v5 of the NoQuitters mod along with about 60 new civilizations, and I get them whenever I start up a game although I didn't get any error during the making of the Modpack.
@Serp
This might not add much but here's what I got from the lua.log in an old modpack I made:
Code:Runtime Error: Assets\DLC\MP_MODSPACK\Mods\(BNW) Leugi's Barbarian Inmersion Enhancements (v 1)\Lua\BarbarianEraScripts.lua:318: attempt to call global 'save' (a nil value) Runtime Error: Assets\DLC\MP_MODSPACK\Mods\(BNW) Leugi's Barbarian Inmersion Enhancements (v 1)\Lua\BarbarianUnhappiness.lua:26: attempt to call global 'load' (a nil value) Runtime Error: Assets\DLC\MP_MODSPACK\Mods\(BNW) Leugi's Barbarian Inmersion Enhancements (v 1)\Lua\UI\BarbarianCampPopup.lua:22: attempt to call global 'load' (a nil value)
It's basically what civaddiction got I think, however you might be able to check if there's some "funny business" going on in the code. I know nothing of Lua so I hope this helps.
thanks.
Both, "Improved Upgrades" and "Barbarian Immersion" use the "SaveUtilis.lua". So this could causing problems.
There is an error in the code. The standard lua interpreter can live with it but LuaJIT does stumble on it: on line 511 to 514 of SaveUtils.lua, the "\[" escapes are wrong and must be replaced by "["