Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----------------------------------------------------------------------------------
- -- Basic LUA-Script for all maps in Siedler 2 - Return to the Roots --
- -- https://www.siedler25.org --
- -- Author: etother (v0.1) --
- -- special thanks to CrazyL, who made the files I learned from (v0.4) --
- -- Also special thanks to the RttR Team, who made this possible --
- ------------------------General Informations - code below-------------------------
- -------------------------------- Lua Version used -------------------------------
- function getRequiredLuaVersion()
- return 1
- end
- -------------------------------- general settings -------------------------------
- function getAllowedChanges() -- change this for enable or disable the checkboxes in settings menu
- return {general=true, addonsAll=true, addonsSome=false, swapping=true, playerState = not isSinglePlayer, ownNation = true, ownColor=true, ownTeam=true, aiNation=true, aiColor=true, aiTeam=true}
- end
- function onSettingsReady()
- rttr:SetGameSettings({
- ["fow"] = EXP_DISABLED,
- ["startWares"] = SWR_ALOT })
- rttr:GetPlayer(1):SetAI(3)
- end
- -------------------- set resources - CURRENTLY FOR PLAYER 2 ONLY-----------------
- function onStart(isFirstStart)
- for i = 0, (rttr:GetPlayerCount() - 1) do -- This is a call for player 1 to player n, Depends on how many players are playing. They will do the code below. "rttr:GetPlayerCount() - 1" could changed by the concrete number of players.
- AddPlayerBld(i, not isFirstStart) -- They do the "function" with the name "AddPlayerBld" also at the start of the game. This is a new defined function, no RttR Standard, need to be written correctly
- AddPlayerRes(i, not isFirstStart) -- They do the "function" with the name "AddPlayerRes" also at the start of the game. This is a new defined function, no RttR Standard, need to be written correctly
- end
- rttr:GetWorld():AddStaticObject(17,101, 502, 0xFFFF, 1)
- rttr:GetWorld():AddStaticObject(17,102, 502, 0xFFFF, 1)
- rttr:GetWorld():AddStaticObject(16,102, 502, 0xFFFF, 1)
- rttr:GetWorld():AddStaticObject(15,101, 502, 0xFFFF, 1)
- rttr:GetWorld():AddStaticObject(17,100, 502, 0xFFFF, 1)
- end
- function AddPlayerBld(p, onLoad) -- The "function" with the name "AddPlayerBld" is done on Loading the game for player p. p is defined by next code
- if(p == 1) then -- Does the code for Player 2
- rttr:GetPlayer(p):SetRestrictedArea(
- nil, nil,
- 0,127,
- 31,127,
- 31,0,
- 0,0,
- nil,nil, -- Anmerkung: die gesetzten Koordinaten sind kein Bestandteil des "Sperrgebiets"
- 11,43,
- 20,43,
- 21,44,
- 12,44,
- 11,43)
- end
- end
- function AddPlayerRes(p, onLoad) -- The "function" with the name "AddPlayerRes" is done on Loading the game for player p. p is defined by next code
- if onLoad then return -- It stops at Loading the Map, Just works at start of game
- end
- if(p == 0) then -- Does the code for Player 1
- rttr:GetPlayer(p):AddWares({
- [GD_BEER ] = 0,
- [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 ] = 0,
- [GD_CLEAVER ] = 0,
- [GD_ROLLINGPIN] = 0,
- [GD_BOW ] = 0,
- [GD_BOAT ] = 0,
- [GD_SWORD ] = 0,
- [GD_IRON ] = 0,
- [GD_FLOUR ] = 0,
- [GD_FISH ] = 0,
- [GD_BREAD ] = 0,
- [GD_SHIELD ] = 0,
- [GD_WOOD ] = 0,
- [GD_BOARDS ] = 0,
- [GD_STONES ] = 0,
- [GD_GRAIN ] = 0,
- [GD_COINS ] = 0,
- [GD_GOLD ] = 0,
- [GD_IRONORE ] = 0,
- [GD_COAL ] = 0,
- [GD_MEAT ] = 0,
- [GD_HAM ] = 0
- })
- rttr:GetPlayer(p):AddPeople({
- [JOB_HELPER ] = 0,
- [JOB_WOODCUTTER ] = 0,
- [JOB_FISHER ] = 0,
- [JOB_FORESTER ] = 0,
- [JOB_CARPENTER ] = 0,
- [JOB_STONEMASON ] = 0,
- [JOB_HUNTER ] = 0,
- [JOB_FARMER ] = 0,
- [JOB_MILLER ] = 0,
- [JOB_BAKER ] = 0,
- [JOB_BUTCHER ] = 0,
- [JOB_MINER ] = 0,
- [JOB_BREWER ] = 0,
- [JOB_PIGBREEDER ] = 0,
- [JOB_DONKEYBREEDER ] = 0,
- [JOB_IRONFOUNDER ] = 0,
- [JOB_MINTER ] = 0,
- [JOB_METALWORKER ] = 0,
- [JOB_ARMORER ] = 0,
- [JOB_BUILDER ] = 0,
- [JOB_PLANER ] = 0,
- [JOB_GEOLOGIST ] = 0,
- [JOB_PRIVATE ] = 0,
- [JOB_PRIVATEFIRSTCLASS ] = 0,
- [JOB_SERGEANT ] = 0,
- [JOB_OFFICER ] = 0,
- [JOB_GENERAL ] = 0,
- [JOB_SCOUT ] = 0,
- [JOB_SHIPWRIGHT ] = 0,
- [JOB_PACKDONKEY ] = 0,
- [JOB_CHARBURNER ] = 0
- })
- end
- if not(p == 0) then -- Do the Code for all other players than Player 1
- rttr:GetPlayer(p):AddWares({
- [GD_BEER ] = 0,
- [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 ] = 0,
- [GD_CLEAVER ] = 0,
- [GD_ROLLINGPIN] = 0,
- [GD_BOW ] = 0,
- [GD_BOAT ] = 0,
- [GD_SWORD ] = 0,
- [GD_IRON ] = 0,
- [GD_FLOUR ] = 0,
- [GD_FISH ] = 0,
- [GD_BREAD ] = 0,
- [GD_SHIELD ] = 0,
- [GD_WOOD ] = 0,
- [GD_BOARDS ] = 0,
- [GD_STONES ] = 0,
- [GD_GRAIN ] = 0,
- [GD_COINS ] = 0,
- [GD_GOLD ] = 0,
- [GD_IRONORE ] = 0,
- [GD_COAL ] = 0,
- [GD_MEAT ] = 0,
- [GD_HAM ] = 0
- })
- rttr:GetPlayer(p):AddPeople({
- [JOB_HELPER ] = 0,
- [JOB_WOODCUTTER ] = 0,
- [JOB_FISHER ] = 0,
- [JOB_FORESTER ] = 0,
- [JOB_CARPENTER ] = 0,
- [JOB_STONEMASON ] = 0,
- [JOB_HUNTER ] = 0,
- [JOB_FARMER ] = 0,
- [JOB_MILLER ] = 0,
- [JOB_BAKER ] = 0,
- [JOB_BUTCHER ] = 0,
- [JOB_MINER ] = 0,
- [JOB_BREWER ] = 0,
- [JOB_PIGBREEDER ] = 0,
- [JOB_DONKEYBREEDER ] = 0,
- [JOB_IRONFOUNDER ] = 0,
- [JOB_MINTER ] = 0,
- [JOB_METALWORKER ] = 0,
- [JOB_ARMORER ] = 0,
- [JOB_BUILDER ] = 0,
- [JOB_PLANER ] = 0,
- [JOB_GEOLOGIST ] = 0,
- [JOB_PRIVATE ] = 0,
- [JOB_PRIVATEFIRSTCLASS ] = 0,
- [JOB_SERGEANT ] = 0,
- [JOB_OFFICER ] = 0,
- [JOB_GENERAL ] = 0,
- [JOB_SCOUT ] = 0,
- [JOB_SHIPWRIGHT ] = 0,
- [JOB_PACKDONKEY ] = 0,
- [JOB_CHARBURNER ] = 0
- })
- end
- end
- function onGameFrame(gf)
- if(gf % 100 ~= 0) then return end
- if(gf == 200) then
- rttr:GetWorld():AddStaticObject(17,101, 502, 0xFFFF, 0)
- rttr:GetWorld():AddStaticObject(17,102, 502, 0xFFFF, 0)
- rttr:GetWorld():AddStaticObject(16,102, 502, 0xFFFF, 0)
- rttr:GetWorld():AddStaticObject(15,101, 502, 0xFFFF, 0)
- rttr:GetWorld():AddStaticObject(17,100, 502, 0xFFFF, 0)
- end
- end
- function onOccupied(p, x, y)
- if( (p == 1) and (x == 14) and (y == 55) ) then -- At Game Start the Restricted Area was defined with "nil, nil", which defines an impassable polygon for the AI. Its still possible for the AI to occupy military buildings. After the Area is occupied by the AI the LUA will set a new Restricted Area. In This Case the AreaRestriction is set to the whole Map
- rttr:GetPlayer(1):SetRestrictedArea( -- Area Restriction is set to the whole Map. For the moment there is no way to undo the Area Restriction from GameStart and GameLoad.
- 0,0,
- 31,0,
- 31,127,
- 127,0,
- 0,0)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement