I often play SC with my friends, but since we all have different skills, I decided to write a small mod that gives personal advantages (mass & energy production, build rate, maybe health points) to the player on his name.
I found the code for a simple mod with the multipliers for the economy, but the problem is that I need to apply these effects are not all units in the game, but only the player units with a certain name, for example "PlayerFirst"
- Code: Select all
do
local oldModBlueprints = ModBlueprints
function ModBlueprints(all_bps)
oldModBlueprints(all_bps)
local econScale = 2.0
--loop through the blueprints and adjust as desired.
for id,bp in all_bps.Unit do
if bp.Economy.ProductionPerSecondMass then
bp.Economy.ProductionPerSecondMass = bp.Economy.ProductionPerSecondMass * econScale
end
if bp.Economy.ProductionPerSecondEnergy then
bp.Economy.ProductionPerSecondEnergy = bp.Economy.ProductionPerSecondEnergy * econScale
end
end
end
end
I feel that it looks something like this,
- Code: Select all
if (player.playerName == "PlayerFirst")
// some code
It is also interesting to use the effects only for a one fraction, only of UEF for example, that the like
- Code: Select all
if (player.playerFaction == "UEF")
// some code
Since this is my first mod, I do not know how should look like this code to Lua.