Barathor
Emperor
- Joined
- May 7, 2011
- Messages
- 1,202
I'm not sure what's wrong with this mod and why it's not working correctly.
This is a simple mod (well, was supposed to be simple) which removes the existing affinity reward types from alien skeletons and progenitor ruins, both on land or sea, and replaces them with new ones.
The existing alien skeleton affinity reward was 12-14 XP in a random affinity and the progenitor ruin was a free level in the affinity of your choice (too much, in my opinion).
The new rewards are more "Rising Tide / Hybrid" style and randomly reward a total of 15 XP points either in a single random affinity, 10 XP and 5 XP in two random affinities, or 5 XP in all three affinities. Each of these different instances is its own PlotBonus script. I manipulate the chances of each with the existing weight assignments each expedition site uses to choose a reward.
Skeletons have a greater chance of spreading out the points and Ruins have a greater chance of really pushing a single affinity.
Skeleton weights: 2) single 4) double 4) triple 20) alien unit
(alien unit is 20 to maintain the existing overall balance of the old weights: 1) affinity 2) alien unit.)
Progenitor: 4) single 4) double 2) triple 10) tech
(existing: 1) free level 1) tech.)
I feel by removing the free level reward, randomizing everything, and having a greater chance of spreading out the points, excessive affinity gain through expeditions will be reduced. Spreading out the points instead of just reducing them for a single affinity works better since the reward still feels worthwhile (points are points) and it doesn't shoot a single affinity up too high that often.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
I've attached the mod below. (EDIT: Removed. That was an early development version containing a few additional bugs.)
I checked the database, and all of my new XML entries are being inserted correctly. Also, everything looks like it's tied together correctly.
My three new Lua files look fine, they're nothing very complicated. (Though, once I get this mod working, I'm curious to see how my new text displays in the game, because I've never modded this kind which contains variables.)
This is the error:
This is that part of the code:
The red line is the line the error is referring to. I assume it has to do with plotBonusTable being nil, but I can't figure out why it would be.
EDIT: Oh, also... initially I just had the Lua files in the mod with VFS set to "true". When I received the error, I tried adding them as a "InGameUIAddin" to see if it made a difference. Which should it be, if the above error is resolved? I assumed the former method.
This is a simple mod (well, was supposed to be simple) which removes the existing affinity reward types from alien skeletons and progenitor ruins, both on land or sea, and replaces them with new ones.
The existing alien skeleton affinity reward was 12-14 XP in a random affinity and the progenitor ruin was a free level in the affinity of your choice (too much, in my opinion).
The new rewards are more "Rising Tide / Hybrid" style and randomly reward a total of 15 XP points either in a single random affinity, 10 XP and 5 XP in two random affinities, or 5 XP in all three affinities. Each of these different instances is its own PlotBonus script. I manipulate the chances of each with the existing weight assignments each expedition site uses to choose a reward.
Skeletons have a greater chance of spreading out the points and Ruins have a greater chance of really pushing a single affinity.
Skeleton weights: 2) single 4) double 4) triple 20) alien unit
(alien unit is 20 to maintain the existing overall balance of the old weights: 1) affinity 2) alien unit.)
Progenitor: 4) single 4) double 2) triple 10) tech
(existing: 1) free level 1) tech.)
I feel by removing the free level reward, randomizing everything, and having a greater chance of spreading out the points, excessive affinity gain through expeditions will be reduced. Spreading out the points instead of just reducing them for a single affinity works better since the reward still feels worthwhile (points are points) and it doesn't shoot a single affinity up too high that often.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
I've attached the mod below. (EDIT: Removed. That was an early development version containing a few additional bugs.)
I checked the database, and all of my new XML entries are being inserted correctly. Also, everything looks like it's tied together correctly.
My three new Lua files look fine, they're nothing very complicated. (Though, once I get this mod working, I'm curious to see how my new text displays in the game, because I've never modded this kind which contains variables.)
This is the error:
Code:
Runtime Error: Assets\DLC\Expansion1\Gameplay\Lua\PlotBonusSystem.lua:144: attempt to index a nil value
stack traceback:
Assets\DLC\Expansion1\Gameplay\Lua\PlotBonusSystem.lua:144: in function 'PickExpeditionPlotBonus'
Assets\DLC\Expansion1\Gameplay\Lua\PlotBonusSystem.lua:81: in function 'OnBuildFinished'
This is that part of the code:
Code:
function PickExpeditionPlotBonus(artifactResourceType, plot, player)
local bonuses = {};
local resourceInfo = GameInfo.Resources[artifactResourceType];
if (resourceInfo ~= nil) then
for plotBonusFromResourceInfo in GameInfo.PlotBonus_ResourceChanceWeights("ResourceType = \"" .. resourceInfo.Type .. "\"") do
local plotBonusInfo = GameInfo.PlotBonuses[plotBonusFromResourceInfo.PlotBonusType];
local plotBonusTable = GetPlotBonusTable(plotBonusInfo.ID);
local valid = true;
[COLOR="Red"]if (plotBonusTable.IsValidForPlayerAtPlot ~= nil) then[/COLOR]
if (not plotBonusTable.IsValidForPlayerAtPlot(player, plot)) then
valid = false;
end
end
...
The red line is the line the error is referring to. I assume it has to do with plotBonusTable being nil, but I can't figure out why it would be.
EDIT: Oh, also... initially I just had the Lua files in the mod with VFS set to "true". When I received the error, I tried adding them as a "InGameUIAddin" to see if it made a difference. Which should it be, if the above error is resolved? I assumed the former method.