1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  3. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  4. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  5. Dismiss Notice
  6. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

Extra Human-Player Units at Game Start 1.05

Spawns extra Settler, Scout, and/or Builder units at start of game.

  1. Shadole

    Shadole Chieftain

    Joined:
    Aug 7, 2015
    Messages:
    109
    Sorry I didn't respond sooner, but THANK YOU! Works like a charm for Hotseat but there are two minor hiccups. I was playing with one other human.

    1. Player 2 for some reason gets DOUBLE the units. I set it for players to get 5 extra scouts, builders, and settlers, but player 2 got 10 of each.
    2. If you save and load on the very first turn (Player 1), then upon loading the game player 2 won't get any extra units at all.

    Honestly not a huge deal but I Figured you'd want to hear about any bugs :). We just deleted the extra units for player 2.

    Anyway thank you again gyogen. I really really appreciate you modding that in for me.
     
  2. gyogen2

    gyogen2 Chieftain

    Joined:
    May 8, 2014
    Messages:
    1,201
    It is probably one of the lines I removed, I test and put back in.

    This mod uses a game script which unfortunately currently won't load in a saved game. Since the intention is to grant extra at game start, it works fine for this mod, but that is why load saves won't work.
     
  3. gyogen2

    gyogen2 Chieftain

    Joined:
    May 8, 2014
    Messages:
    1,201
    Remove the line:
    Events.LocalPlayerChanged.Add( OnPlayerTurnActivated );
    at the bottom of the ScoutSpawn.lua and this will stop. I forgot to remove when I changed file.
     
  4. 10_Merlin_01

    10_Merlin_01 Chieftain

    Joined:
    Nov 26, 2016
    Messages:
    3
    Gender:
    Male
    Is there a limit on the number of different units to start the game with? I ask because I wanted to start with 2 settlers, 1 Builder, 1 scout, 1 Slinger and for those pesky barb horseman 2 Spearman for defence.
    I am able to get it to work with the 4 units but as soon as I add the 5th unit it doesn't work. There are no errors or anything it just loads the default settler and warrior.
     
  5. gyogen2

    gyogen2 Chieftain

    Joined:
    May 8, 2014
    Messages:
    1,201
    I personally haven't tried more units, but I'll give it a test this morning and see if there's an issue.
     
  6. gyogen2

    gyogen2 Chieftain

    Joined:
    May 8, 2014
    Messages:
    1,201
    I just tried with six different units and it worked:
    upload_2016-11-28_6-53-53.png
    Might you have accidentally made a mistake in code? There where no errors in lua log?
     
  7. 10_Merlin_01

    10_Merlin_01 Chieftain

    Joined:
    Nov 26, 2016
    Messages:
    3
    Gender:
    Male
    Well, it appears I must have done something wrong then. I know my code knowledge is a bit old. I'll try again

    Where is the Lua log? will that show what didn't load?
     
  8. gyogen2

    gyogen2 Chieftain

    Joined:
    May 8, 2014
    Messages:
    1,201
    In the logs folder, same directory as mod folder. C:\Users\compname\Documents\my games\Sid Meier's Civilization VI\Logs
    The lua log will tell you if there are any errors that are caused by the code.
    The modding log will tell you if the mod loaded/failed
     
  9. 10_Merlin_01

    10_Merlin_01 Chieftain

    Joined:
    Nov 26, 2016
    Messages:
    3
    Gender:
    Male
    Thanks Gyogen2
    I re-download and it's working now. It must have been a typo somewhere but I couldn't see where

    This is a great mod to help against those early horseman barb rush's

    Thanks
     
  10. Mynex

    Mynex Chieftain

    Joined:
    Sep 30, 2010
    Messages:
    287
    @gyogen2 what do I need to change in this code to have it apply to all players (including AI).

    I was trying to do this via XML and... yea, that's a no go. At least not without a lot of hoop jumping. -_-

    (thanks for the nod in the mod description, it's 'he' btw. :D )
     
  11. gyogen2

    gyogen2 Chieftain

    Joined:
    May 8, 2014
    Messages:
    1,201
    Sorry for late response, was out of town. Remove
    if pPlayer:IsHuman() then (and the corresponding "end")
     
  12. Mynex

    Mynex Chieftain

    Joined:
    Sep 30, 2010
    Messages:
    287
    No worries man, that whole pesky Real Life thing comes first. :)

    Thanks once more! :)
     
  13. Wrathofall

    Wrathofall Chieftain

    Joined:
    Dec 6, 2016
    Messages:
    1
    Gender:
    Male
  14. BaronVonKaiser

    BaronVonKaiser Chieftain

    Joined:
    Dec 8, 2016
    Messages:
    4
    Gender:
    Male
    While I was trying this out I bumped the number of builders up to 12 and ran into a an unexpected problem. On one game start I couldn't end my turn because I didn't have anywhere for the builders to go so I was left with a couple still in a stack unable to move.

    I've tried making a few changes to the script to spread the units out but I haven't had any luck yet. This is my first foray into modding and my first time using lua, so I'm not quite sure how to go about this. My initial experiment was as simple of an idea as I could come up with but it didn't work:
    if numSettlers > 0 then
    plotOffSet = 0;
    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()) and plotOffSet >= i then
    break
    end
    plotOffSet = plotOffSet + 1;
    end
    pUnit2 = playerUnits:Create(iSettler, adjacentPlot:GetX(), adjacentPlot:GetY())
    lastPlot = Map.GetPlot(pUnit:GetX(), pUnit:GetY());
    end
    end

    It basically just caused it to stop working altogether and I'm pretty sure thats just because of my complete lack of of experience with lua. Any advice would be welcome!
     
  15. gyogen2

    gyogen2 Chieftain

    Joined:
    May 8, 2014
    Messages:
    1,201
    Don't know if this will help, but you just made me realize mistake with my code. lastPlot should get plot of last unit spawned (so should be pUnit2:Get... not pUnit)

    I'll have to look at it when I have time, but in mean time if that change doesn't work could raise plot unit limit.
     
  16. BaronVonKaiser

    BaronVonKaiser Chieftain

    Joined:
    Dec 8, 2016
    Messages:
    4
    Gender:
    Male
    Thanks for the response @gyogen2 !

    The script just started to make a lot more sense to me now, I actually thought pUnit and pUnit2 were functions of some sort that I wasn't understanding, I think I get it now. I'll definitely play with this later when I get home.

    Additional question if you don't mind, how does the direction parameter work in the GetAdjacentPlot function? Is it just a 1-6 value with 1 being toward the right and continuing around clockwise? If I have any success with the above perhaps I'll try finding a way to get units to spawn around the starting position rather than just to the right of it.
     
  17. gyogen2

    gyogen2 Chieftain

    Joined:
    May 8, 2014
    Messages:
    1,201
    There are defined directiontypes northeast, east, etc. If you look in the map scripts, (such as continents.lua), can get an idea of how they work.

    I had originally done this mod because someone had asked for the ability to spawn a couple extra human units, and hadn't taken the time to refine it for a high number of units.
     
  18. BaronVonKaiser

    BaronVonKaiser Chieftain

    Joined:
    Dec 8, 2016
    Messages:
    4
    Gender:
    Male
    Yeah, I don't think I really need or want that many extra units, it would be a pretty overwhelming advantage, but I'm curious now to see if I can get it to work. It's been kind of fun so far:)

    I've had limited success, my biggest obstacles are how long it takes to test each change (starting a new game) and trying to find debugging info. I read somewhere that errors show up in lua.log but it's inconvenient to sift through.

    My thought at the moment is to place the units one plot from the initial settler in a circle, then 2 plots away from the settler, etc. I have also been toying with splitting the units to be added into builders/settlers and the rest of them, so each plot could have one builder or settler, and one military unit. If I manage to figure it out I'll be sure to share.
     
  19. gyogen2

    gyogen2 Chieftain

    Joined:
    May 8, 2014
    Messages:
    1,201
    just so you know (in case you didn't) you don't have to completely close and restart game. You can go back to main menu, make changes in lua, save then start new game. you can post your lua log if you want, and could look at.
     
  20. gyogen2

    gyogen2 Chieftain

    Joined:
    May 8, 2014
    Messages:
    1,201
    You could also rearrange the position of the create function like so:
    Code:
    repeat
        for direction = 0, 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
                    if numScouts > 0 then
                        pUnit = playerUnits:Create(iScout, adjacentPlot:GetX(), adjacentPlot:GetY());
                        numScouts = numScouts -1
                    end
                end
        end
    until numScouts = 0
    Haven't tested, but should work.
     

Share This Page