Resource icon

Extra Human-Player Units at Game Start 1.05

Hmm just thought, it could be bc its a speciality unit tied to Romans.....
 
I just replaced the builder unit with legion and it spawned fine, want to post the code you used, may be something in it.

Really? I just started a game with tanks, so i just thought it was speciality units. Odd that the extra unit code i put in works with warriors and tanks but not legions.
 
local numSettlers = 3 ----------------------------set number of extra starting settlers for player
local numScouts = 3 ----------------------------set number of extra starting scouts
local numLegions = 3 ----------------------------set number of extra starting legions
local numBuilders = 3 ----------------------------set number of extra starting builders

local iScout = GameInfo.Units["UNIT_SCOUT"].Index
local iSettler = GameInfo.Units["UNIT_SETTLER"].Index
local iLegion = GameInfo.Units["UNIT_LEGION"].Index
local iBuilder = GameInfo.Units["UNIT_BUILDER"].Index

function OnPlayerTurnActivated( player, bIsFirstTime )
print("just a test-------------------------------------------------------------------------------");
local pUnit;

if (bIsFirstTime and player == Game.GetLocalPlayer()) then
local currentTurn = Game.GetCurrentGameTurn();
local SpawnTurn = 0;
local playerUnits;
local adjacentPlot;
local unitPlot;
if 1 == currentTurn then
local pPlayer = Players[player]
if pPlayer:IsHuman() then
playerUnits = pPlayer:GetUnits()

print("SpawnTurn", SpawnTurn) ;
for i, unit in playerUnits:Members() do
local unitTypeName = UnitManager.GetTypeName(unit)
print("unitTypeName", unitTypeName) ;
if "LOC_UNIT_SETTLER_NAME" == unitTypeName then
SpawnTurn = 1;
unitPlot = Map.GetPlot(unit:GetX(), unit:GetY());
print("SpawnTurn", SpawnTurn) ;
end
end
end

if SpawnTurn == 1 then
local lastPlot = unitPlot;
if numScouts > 0 then
for i = 1, numScouts do

for direction = 1, DirectionTypes.NUM_DIRECTION_TYPES - 1, 1 do
adjacentPlot = Map.GetAdjacentPlot((lastPlot:GetX() + 1), lastPlot:GetY(), direction);
if (adjacentPlot ~= nil) and not (adjacentPlot:IsWater() or adjacentPlot:IsImpassable()) then
break
end
end
pUnit = playerUnits:Create(iScout, unitPlot:GetX(), unitPlot:GetY())
lastPlot = Map.GetPlot(pUnit:GetX(), pUnit:GetY());
end
end
if numSettlers > 0 then
for i = 1, numSettlers do
for direction = 1, DirectionTypes.NUM_DIRECTION_TYPES - 1, 1 do
adjacentPlot = Map.GetAdjacentPlot((lastPlot:GetX() ), lastPlot:GetY(), direction);
if (adjacentPlot ~= nil) and not (adjacentPlot:IsWater() or adjacentPlot:IsImpassable()) then
break
end
end
pUnit2 = playerUnits:Create(iSettler, adjacentPlot:GetX(), adjacentPlot:GetY())
lastPlot = Map.GetPlot(pUnit:GetX(), pUnit:GetY());
end
end
if numLegions > 0 then
for i = 1, numLegions do
for direction = 1, DirectionTypes.NUM_DIRECTION_TYPES - 1, 1 do
adjacentPlot = Map.GetAdjacentPlot((lastPlot:GetX() ), lastPlot:GetY(), direction);
if (adjacentPlot ~= nil) and not (adjacentPlot:IsWater() or adjacentPlot:IsImpassable()) then
break
end
end
pUnit2 = playerUnits:Create(iLegion, adjacentPlot:GetX(), adjacentPlot:GetY())
lastPlot = Map.GetPlot(pUnit:GetX(), pUnit:GetY());
end
end
if numBuilders > 0 then
for i = 1, numBuilders do
for direction = 1, DirectionTypes.NUM_DIRECTION_TYPES - 1, 1 do
adjacentPlot = Map.GetAdjacentPlot(lastPlot:GetX(), lastPlot:GetY(), direction);
if (adjacentPlot ~= nil) and not (adjacentPlot:IsWater() or adjacentPlot:IsImpassable()) then
break
end
end
pUnit3 = playerUnits:Create(iBuilder, lastPlot:GetX(), lastPlot:GetY())
lastPlot = Map.GetPlot(pUnit:GetX(), pUnit:GetY());
end
end
Events.PlayerTurnActivated.Remove(OnPlayerTurnActivated)

end

end
end
end



function Initialize()
Events.PlayerTurnActivated.Add(OnPlayerTurnActivated)
print("just a test init-------------------------------------------------------------------------------");
end

Initialize();
 
just a heads-up. When my wife and I used this mod in multiplayer, the units would just load in fine. However as soon as we both end the first turn, she drops out of the game, resynching and when she is back, her units are gone...
 
Found a bug. Upon reloading you first turn, let's say to start off with a new tactic or w/e...you lose your bonus units, and start with vanilla units; settler/warrior. :scan:
 
gyogen2 updated Extra Human-Player Units at Game Start with a new update entry:

Update Boosted Human Start

Allows human player to start with extra units, techs, and gold

To edit amounts and techs, change values at top of lua:
Spoiler ScoutSpawn.lua --( never changed file name from original test) :
Code:
local numSettlers = 0  --------------------------------------------set number of extra starting settlers for player
local numScouts   = 5  --------------------------------------------set number of extra starting scouts
local numBuilders = 2 ---------------------------------------------set number...

Read the rest of this update entry...
 
Is there any way to make this apply to Hotseat players? I started a game with another person and only player 1 got the bonus, not player 2.
 
Stupid question (I am new to this): What .lua file do I modify?

I tried adding the basic lines to the GreatestEarthMap.lua but nothing happened. I then unchecked the mod in the options menu, nothing happened, I then put it in a unique .lua file and included from the GreatesEarhMap.lua but nothing happened - so what .lua file do I modify?
 
I cannot find ScoutSpawn.lua in the "mod" folder. Full path would be helpful. MyDocs/Sids/Mods does not contain this file, and steamapps/Sids has no mod folder. Anyone willing to write up idiot proof instructions?

Note: I downloaded Mynex More Starting Points and it is working, but I would really like to understand the basics.
 
gyogen2 submitted a new resource:

Extra Player Units at Game Start - Spawns extra Settler, Scout, and/or Builder units at start of game.



Read more about this resource...

Hi there, I tried your MOD, and change the numbers for settlers, builders, and scouts to 5 each and 3 each but this doesn't seem to take affect in in the game??? I also tried changing the amount of gold and this didn't make a difference either. No matter what I change it seems to stick with 1 x settler, 3 x builders, and 5 x scouts. Any suggestions what I could be doing wrong???
 
Back
Top Bottom