Forum



~aztimh am 28.05.2022 08:58 #16044


Hey! I'm a new player to RTTR! Played Settlers 2 way back in the day and randomly got back into Settlers games again recently.

Discovered this great addon mod randomly because of YouTube!

I was wondering if there are basic LUA scripts for altering the starting warehouse goods for player and AI (like in campaign maps)
without having to learn all the scripting but just altering the numbers for each of the goods/settlers.

Appreciate all the great work going into this amazing game!

- aztimh


Spike am 28.05.2022 11:53 #16046

~Gast am 04.08.2023 08:04 #16220


Hey!

Thanks for the Script!
It worked fine until the last updates.
Now I can´t edit KI Dificulty as well as the ressources don´t seem to be updated as forseen in the script.

What do I need to adapt to make it work under the new version?


This is the script I´m using:

Thanks in advance!

best regards,
Chris



Code:
------------------------------------------------------------------------------
-- LUA-Script which sets building restrictions /wares for players           --
--                                                                          --
-- Author: Spikeone                                                         --
-- Change:                                                                  --
--                                                                          --
------------------------------------------------------------------------------

function getRequiredLuaVersion()
    return 1.3
end

function onSettingsReady()
    rttr:Log("-----------------------n Mission Script loaded... n-----------------------n")
end

function onStart(isFirstStart)
    -- ** iterate over all players **
    for i = 0, rttr:GetNumPlayers() do  
        -- ** CUSTOM function for adding resources **
        addPlayerRes(i, not isFirstStart)
        -- ** CUSTOM function for setting building restrictions **
        addPlayerBld(i, not isFirstStart)
    end
end

function addPlayerBld(p, onLoad)
    -- ** player 1 **
    if(p == 0) then
        rttr:GetPlayer(p):DisableBuilding(BLD_SAWMILL)
    -- ** player 2 **
    elseif (p == 1) then
        rttr:GetPlayer(p):DisableBuilding(BLD_WATCHTOWER)
    end
end


function addPlayerRes(p, onLoad)
    if onLoad then return end

    -- ** player 1 **
    if (p == 0) then
        -- goods
        rttr:GetPlayer(p):ClearResources()
        rttr:GetPlayer(p):AddWares({
            [GD_BEER      ] = 1000,
            [GD_TONGS     ] = 0,
            [GD_HAMMER    ] = 0,
            [GD_AXE       ] = 0,
            [GD_SAW       ] = 0,
            [GD_PICKAXE   ] = 0,
            [GD_SHOVEL    ] = 0,
            [GD_CRUCIBLE  ] = 0,
            [GD_RODANDLINE] = 0,
            [GD_SCYTHE    ] = 0,
            [GD_WATER     ] = 12,
            [GD_CLEAVER   ] = 0,
            [GD_ROLLINGPIN] = 0,
            [GD_BOW       ] = 0,
            [GD_BOAT      ] = 0,
            [GD_SWORD     ] = 0,
            [GD_IRON      ] = 0,
            [GD_FLOUR     ] = 0,
            [GD_FISH      ] = 2,
            [GD_BREAD     ] = 4,
            [GD_SHIELD    ] = 0,
            [GD_WOOD      ] = 0,
            [GD_BOARDS    ] = 15,
            [GD_STONES    ] = 12,
            [GD_GRAIN     ] = 0,
            [GD_COINS     ] = 0,
            [GD_GOLD      ] = 0,
            [GD_IRONORE   ] = 0,
            [GD_COAL      ] = 20,
            [GD_MEAT      ] = 2,
            [GD_HAM       ] = 0
        })

        -- people
        rttr:GetPlayer(p):AddPeople({
        [JOB_HELPER             ] = 40,
        [JOB_WOODCUTTER         ] = 8,
        [JOB_FISHER             ] = 4,
        [JOB_FORESTER           ] = 4,
        [JOB_CARPENTER          ] = 3,
        [JOB_STONEMASON         ] = 40,
        [JOB_HUNTER             ] = 4,
        [JOB_FARMER             ] = 60,
        [JOB_MILLER             ] = 3,
        [JOB_BAKER              ] = 3,
        [JOB_BUTCHER            ] = 3,
        [JOB_MINER              ] = 80,
        [JOB_BREWER             ] = 0,
        [JOB_PIGBREEDER         ] = 4,
        [JOB_DONKEYBREEDER      ] = 0,
        [JOB_IRONFOUNDER        ] = 4,
        [JOB_MINTER             ] = 40,
        [JOB_METALWORKER        ] = 4,
        [JOB_ARMORER            ] = 4,
        [JOB_BUILDER            ] = 4,
        [JOB_PLANER             ] = 4,
        [JOB_GEOLOGIST          ] = 4,
        [JOB_PRIVATE            ] = 8,
        [JOB_PRIVATEFIRSTCLASS  ] = 0,
        [JOB_SERGEANT           ] = 0,
        [JOB_OFFICER            ] = 0,
        [JOB_GENERAL            ] = 0,
        [JOB_SCOUT              ] = 8,
        [JOB_SHIPWRIGHT         ] = 0,
        [JOB_PACKDONKEY         ] = 15,
        [JOB_CHARBURNER         ] = 0
        })
    -- ** player 2 **
    elseif (p == 1) then
        -- goods
        rttr:GetPlayer(p):ClearResources()
        rttr:GetPlayer(p):AddWares({
            [GD_BEER      ] = 12,
            [GD_TONGS     ] = 0,
            [GD_HAMMER    ] = 0,
            [GD_AXE       ] = 0,
            [GD_SAW       ] = 0,
            [GD_PICKAXE   ] = 0,
            [GD_SHOVEL    ] = 0,
            [GD_CRUCIBLE  ] = 0,
            [GD_RODANDLINE] = 0,
            [GD_SCYTHE    ] = 0,
            [GD_WATER     ] = 12,
            [GD_CLEAVER   ] = 0,
            [GD_ROLLINGPIN] = 0,
            [GD_BOW       ] = 0,
            [GD_BOAT      ] = 0,
            [GD_SWORD     ] = 0,
            [GD_IRON      ] = 0,
            [GD_FLOUR     ] = 0,
            [GD_FISH      ] = 2,
            [GD_BREAD     ] = 4,
            [GD_SHIELD    ] = 0,
            [GD_WOOD      ] = 0,
            [GD_BOARDS    ] = 15,
            [GD_STONES    ] = 12,
            [GD_GRAIN     ] = 0,
            [GD_COINS     ] = 0,
            [GD_GOLD      ] = 1000,
            [GD_IRONORE   ] = 0,
            [GD_COAL      ] = 20,
            [GD_MEAT      ] = 2,
            [GD_HAM       ] = 0
        })

        -- people
        rttr:GetPlayer(p):AddPeople({
        [JOB_HELPER             ] = 40,
        [JOB_WOODCUTTER         ] = 8,
        [JOB_FISHER             ] = 4,
        [JOB_FORESTER           ] = 4,
        [JOB_CARPENTER          ] = 3,
        [JOB_STONEMASON         ] = 4,
        [JOB_HUNTER             ] = 4,
        [JOB_FARMER             ] = 6,
        [JOB_MILLER             ] = 3,
        [JOB_BAKER              ] = 3,
        [JOB_BUTCHER            ] = 3,
        [JOB_MINER              ] = 8,
        [JOB_BREWER             ] = 0,
        [JOB_PIGBREEDER         ] = 4,
        [JOB_DONKEYBREEDER      ] = 0,
        [JOB_IRONFOUNDER        ] = 4,
        [JOB_MINTER             ] = 4,
        [JOB_METALWORKER        ] = 4,
        [JOB_ARMORER            ] = 4,
        [JOB_BUILDER            ] = 4,
        [JOB_PLANER             ] = 4,
        [JOB_GEOLOGIST          ] = 4,
        [JOB_PRIVATE            ] = 1800,
        [JOB_PRIVATEFIRSTCLASS  ] = 1500,
        [JOB_SERGEANT           ] = 0,
        [JOB_OFFICER            ] = 1000,
        [JOB_GENERAL            ] = 1500,
        [JOB_SCOUT              ] = 8,
        [JOB_SHIPWRIGHT         ] = 0,
        [JOB_PACKDONKEY         ] = 15,
        [JOB_CHARBURNER         ] = 0
        })
    -- ** player 3 **
    elseif (p == 2) then
        -- goods
        rttr:GetPlayer(p):ClearResources()
        rttr:GetPlayer(p):AddWares({
            [GD_BEER      ] = 12,
            [GD_TONGS     ] = 0,
            [GD_HAMMER    ] = 50,
            [GD_AXE       ] = 50,
            [GD_SAW       ] = 50,
            [GD_PICKAXE   ] = 50,
            [GD_SHOVEL    ] = 50,
            [GD_CRUCIBLE  ] = 50,
            [GD_RODANDLINE] = 0,
            [GD_SCYTHE    ] = 500,
            [GD_WATER     ] = 12,
            [GD_CLEAVER   ] = 0,
            [GD_ROLLINGPIN] = 0,
            [GD_BOW       ] = 0,
            [GD_BOAT      ] = 0,
            [GD_SWORD     ] = 0,
            [GD_IRON      ] = 0,
            [GD_FLOUR     ] = 0,
            [GD_FISH      ] = 2,
            [GD_BREAD     ] = 4,
            [GD_SHIELD    ] = 0,
            [GD_WOOD      ] = 0,
            [GD_BOARDS    ] = 15,
            [GD_STONES    ] = 12,
            [GD_GRAIN     ] = 0,
            [GD_COINS     ] = 0,
            [GD_GOLD      ] = 1000,
            [GD_IRONORE   ] = 0,
            [GD_COAL      ] = 20,
            [GD_MEAT      ] = 2,
            [GD_HAM       ] = 0
        })

        -- people
        rttr:GetPlayer(p):AddPeople({
        [JOB_HELPER             ] = 40,
        [JOB_WOODCUTTER         ] = 8,
        [JOB_FISHER             ] = 4,
        [JOB_FORESTER           ] = 4,
        [JOB_CARPENTER          ] = 3,
        [JOB_STONEMASON         ] = 40,
        [JOB_HUNTER             ] = 4,
        [JOB_FARMER             ] = 60,
        [JOB_MILLER             ] = 30,
        [JOB_BAKER              ] = 30,
        [JOB_BUTCHER            ] = 30,
        [JOB_MINER              ] = 80,
        [JOB_BREWER             ] = 0,
        [JOB_PIGBREEDER         ] = 4,
        [JOB_DONKEYBREEDER      ] = 0,
        [JOB_IRONFOUNDER        ] = 4,
        [JOB_MINTER             ] = 4,
        [JOB_METALWORKER        ] = 4,
        [JOB_ARMORER            ] = 4,
        [JOB_BUILDER            ] = 4,
        [JOB_PLANER             ] = 4,
        [JOB_GEOLOGIST          ] = 4,
        [JOB_PRIVATE            ] = 8000,
        [JOB_PRIVATEFIRSTCLASS  ] = 1000,
        [JOB_SERGEANT           ] = 1000,
        [JOB_OFFICER            ] = 1000,
        [JOB_GENERAL            ] = 5000,
        [JOB_SCOUT              ] = 8,
        [JOB_SHIPWRIGHT         ] = 0,
        [JOB_PACKDONKEY         ] = 15,
        [JOB_CHARBURNER         ] = 0
        })


    end
end



Spike am 04.08.2023 18:15 #16221

Im Ruhestand
Working fine here (latest nightly 20230803)

---





Feel free to post in English!

Antwort schreiben

Username:
Security code:
Text:

   
  Convert smilies like :), ;) etc. into small graphics?
  Convert WWW-addresses into clickable links?
  Soll Boardcode in ihrer Nachricht aktiviert werden?