Forum



Gard am 27.11.2020 15:41 #15600


Hi

Respect all programmers for good work

I would like to ask the main programmers to add some options to the game

I would like the game to be able to preset a specific amount of resources in the main building, a soldier, etc. before the game.
Possibility to enter a specific quantity of 0-500 pieces and for individual players

My point is that I play with less qualified players in my community and I want to give them an advantage over me.

so that the matter is not misused and en masse,
I am only interested in owning such an arrangement myself
and I am willing to pay for its production

Thank you and once again I praise that RTTR exists *Gard


Spike am 27.11.2020 22:50 #15601

Im Ruhestand
You can already achieve this by using lua scripts for you the map you are playing on, no need to pay or something alike ;)

---



Gard am 28.11.2020 00:35 #15602


Ok

Please a little more precise procedure, I have no idea where and how the scripts are written


Spike am 29.11.2020 01:57 #15603

Gard am 29.11.2020 13:27 #15604


Hi

Ok Thanx, I'm already doing it

Editiert von Gard am 29.11.2020 14:26

Gard am 03.12.2020 20:18 #15607


Hallo

https://www.youtube.com/watch?v=TJo8pGvfFY8&t=190s
So I tried this procedure and it works


https://github.com/Spikeone/RttR_Campaigns/blob/master/Campaign_OriginalRoman/MISS200.LUA in those links the procedures don't work for
me and some links are unavailable on that github


However, I can't figure out how to write a script when I want to change resources on other players,

Please also write down how to restrict building restrictions for individual players
??

Editiert von Gard am 09.12.2020 20:36

Spike am 10.12.2020 10:50 #15611

Im Ruhestand
Please refer this one: https://github.com/Spikeone/RttR_Campaigns/blob/master/OtherScripts/ExampleScript_01.LUA

It doesn't do much but you should be able to change it for your needs.

REMEMBER: You have to put the file into the same directory as your map and name it as your map is named, e.g. OMAP01.WLD and OMAP01.LUA

---



Gard am 10.12.2020 23:46 #15612


those saved and directories are clear to me
I didn't know how to write the right script

Okay, I'll try to study it and play with it


Gard am 12.12.2020 14:32 #15613


So I figured it out

rttr.Log("Script started!/n")

function onStart()
        rttr.AddPeople(0,JOB_GENERAL,11)
        rttr.AddPeople(0,JOB_OFFICER,22)
        rttr.AddPeople(0,JOB_SERGEANT,55)
        rttr.AddPeople(0,JOB_PRIVATEFIRSTCLASS,0)
        rttr.AddPeople(0,JOB_PRIVATE,196)
        rttr.AddPeople(0,JOB_PACKDONKEY,28)
        rttr.AddWares(0,GD_WOOD,18)
        rttr.AddWares(0,GD_BOARDS,12)
        rttr.AddWares(0,GD_STONES,14)
        rttr.AddWares(0,GD_COAL,18)
        rttr.AddWares(0,GD_IRONORE,18)
        rttr.AddWares(0,GD_GOLD,30)
        rttr.AddWares(0,GD_COINS,10)
        rttr.AddWares(0,GD_SWORD,0)
        rttr.AddWares(0,GD_SHIEL,0)
        rttr.AddWares(0,GD_HAM,10)
        rttr.AddWares(0,GD_FISH,14)
        rttr.AddWares(0,GD_BREAD,6)
        rttr.AddWares(0,GD_GRAIN,0)
        rttr.AddWares(0,GD_BEER,22)
        rttr.AddWares(0,GD_WATER,22)
        rttr.AddWares(0,GD_BOW,6)
        rttr.AddWares(0,GD_HAMMER,8)
        rttr.AddWares(0,GD_PICKAXE,6)
        rttr.AddWares(0,GD_CRUCIBLE,2)
        rttr.AddWares(0,GD_SAW,2)
        rttr.AddWares(0,GD_BOAT,6)
end

function onGameFrame()
        rttr.DisableBuilding(0,BLD_BARRACKS)
        rttr.DisableBuilding(1,BLD_BARRACKS)
        rttr.DisableBuilding(2,BLD_BARRACKS)
        rttr.DisableBuilding(3,BLD_BARRACKS)
        rttr.DisableBuilding(4,BLD_BARRACKS)
        rttr.DisableBuilding(5,BLD_BARRACKS)
        rttr.DisableBuilding(6,BLD_BARRACKS)
        rttr.DisableBuilding(7,BLD_BARRACKS)
end


Thanks for the links

Editiert von Gard am 12.12.2020 14:33

Gard am 22.12.2020 20:31 #15621


HI

I made an update, now it reports an error that I can't

I have no idea where the problem is

[img]https://i.ibb.co/2WBV9zZ/s25client-2020-12-22-20-28-35-29.png[/img]


Spike am 22.12.2020 21:20 #15622

Im Ruhestand
Have a look at the command prompt that opens when starting the game. It shows you where the error is in your script. Also Helping without the script is hard ;)

---



Gard am 23.12.2020 21:27 #15623


HI

It could have milked me =D

Chyba LUA: maybe...Argument mismatch:string      candidate is:
                LuaInterfaceBase,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,

stack traceback:
        [C]: in function 'Log'
        [string "rttr.Log("Script started!n")..."]:1: in main chunk
Nepodařilo se načíst soubor skriptu LUA '"C:UsersGardSaved GamesReturn To The RootsMAPS444.lua"'


Spike am 24.12.2020 15:28 #15625

Im Ruhestand
https://github.com/Return-To-The-Roots/s25client/blob/master/doc/lua/methods.md

It's rttr:Log(<String>) and not rttr.Log(<String>)
Note: You are using a single point instead of a colon.

---



Gard am 24.12.2020 22:54 #15627


It doesn't even work with a colon

Code:

rttr:Log("Script started/!n")

function onStart()
        rttr.AddPeople(0,JOB_GENERAL,11)
        rttr.AddPeople(0,JOB_OFFICER,22)
        rttr.AddPeople(0,JOB_SERGEANT,55)
        rttr.AddPeople(0,JOB_PRIVATEFIRSTCLASS,0)
        rttr.AddPeople(0,JOB_PRIVATE,196)
        rttr.AddPeople(0,JOB_PACKDONKEY,28)
        rttr.AddWares(0,GD_WOOD,18)
        rttr.AddWares(0,GD_BOARDS,12)
        rttr.AddWares(0,GD_STONES,14)
        rttr.AddWares(0,GD_COAL,18)
        rttr.AddWares(0,GD_IRONORE,18)
        rttr.AddWares(0,GD_GOLD,30)
        rttr.AddWares(0,GD_COINS,10)
        rttr.AddWares(0,GD_SWORD,0)
        rttr.AddWares(0,GD_SHIEL,0)
        rttr.AddWares(0,GD_HAM,10)
        rttr.AddWares(0,GD_FISH,14)
        rttr.AddWares(0,GD_BREAD,6)
        rttr.AddWares(0,GD_GRAIN,0)
        rttr.AddWares(0,GD_BEER,22)
        rttr.AddWares(0,GD_WATER,22)
        rttr.AddWares(0,GD_BOW,6)
        rttr.AddWares(0,GD_HAMMER,8)
        rttr.AddWares(0,GD_PICKAXE,6)
        rttr.AddWares(0,GD_CRUCIBLE,2)
        rttr.AddWares(0,GD_SAW,2)
        rttr.AddWares(0,GD_BOAT,6)
end


[img]https://i.ibb.co/C8VR7qr/s25client-2020-12-24-22-50-09-57.png[/img]

Log

Code:

Connection to 127.0.0.1:3665
Successfully connected to localhost:3665
>>> NMS_PLAYER_ID(0)
<<< NMS_PLAYER_ID(0)
>>> NMS_SERVER_Type(2, 2098abb3daa54e2c28036c458d528e6abce78096)
<<< NMS_SERVER_Type(2, 2098abb3daa54e2c28036c458d528e6abce78096)
<<< NMS_SERVER_PASSWORD(********)
<<< NMS_SERVER_PASSWORD(********)
>>> NMS_PLAYER_NAME(Gard)
<<< NMS_PLAYER_NAME(Gard)
CLIENT0 >>> SERVER: NMS_PLAYER_NAME(Gard)
>>> NMS_PLAYER_NAME(Gard)
>>> NMS_MAP_INFO
<<< NMS_MAP_INFO
>>> NMS_MAP_CHECKSUM
<<< NMS_MAP_CHECKSUM
CLIENT0 >>> SERVER: NMS_MAP_CHECKSUM(22521298) expected: 22521298, ok: yes
SERVER >>> CLIENT0: NMS_MAP_CHECKSUM(1)
>>> NMS_PLAYER_NEW
SERVER >>> BROADCAST: NMS_PLAYER_NEW(0, Gard)
>>> NMS_PLAYER_LIST(8)
>>> NMS_GGS_CHANGE
>>> NMS_SERVER_NAME(Unlimited Play)
<<< NMS_MAP_CHECKSUM(1)
<<< NMS_SERVER_NAME(Unlimited Play)
<<< NMS_PLAYER_LIST(8)
    0: Gard 1 0 2 4278221275 0 false
    1:  0 0 2 4278221275 0 false
    2:  0 0 2 4278221275 0 false
    3:  0 0 2 4278221275 0 false
    4:  0 0 2 4278221275 0 false
    5:  0 0 2 4278221275 0 false
    6:  0 0 2 4278221275 0 false
    7:  0 0 2 4278221275 0 false
Script started!

Lua script did not provide the function getRequiredLuaVersion()! It is probably outdated.
>>> NMS_PLAYER_SETSTATE(1)
>>> NMS_PLAYER_SETSTATE(2)
>>> NMS_PLAYER_SETSTATE(3)
>>> NMS_PLAYER_SETSTATE(4)
>>> NMS_PLAYER_SETSTATE(5)
>>> NMS_PLAYER_SETSTATE(6)
>>> NMS_PLAYER_SETSTATE(7)
>>> NMS_PLAYER_READY
<<< NMS_GGS_CHANGE
<<< NMS_GGS_CHANGE
<<< NMS_PLAYER_SETSTATE(1)
>>> NMS_PLAYER_NAME(Computer 1 (AI) (easy))
>>> NMS_PLAYER_SET_COLOR
SERVER >>> BROADCAST: NMS_PLAYER_TOGGLECOLOR(1, 4291545856)
>>> NMS_PLAYER_SETSTATE(1)
>>> NMS_PLAYER_READY
<<< NMS_PLAYER_SETSTATE(2)
>>> NMS_PLAYER_NAME(Computer 2 (AI) (easy))
>>> NMS_PLAYER_SET_COLOR
SERVER >>> BROADCAST: NMS_PLAYER_TOGGLECOLOR(2, 4292280320)
>>> NMS_PLAYER_SETSTATE(2)
>>> NMS_PLAYER_READY
<<< NMS_PLAYER_SETSTATE(3)
>>> NMS_PLAYER_NAME(Computer 3 (AI) (easy))
>>> NMS_PLAYER_SET_COLOR
SERVER >>> BROADCAST: NMS_PLAYER_TOGGLECOLOR(3, 4288312766)
>>> NMS_PLAYER_SETSTATE(3)
>>> NMS_PLAYER_READY
<<< NMS_PLAYER_SETSTATE(4)
>>> NMS_PLAYER_NAME(Computer 4 (AI) (easy))
>>> NMS_PLAYER_SET_COLOR
SERVER >>> BROADCAST: NMS_PLAYER_TOGGLECOLOR(4, 4283256141)
>>> NMS_PLAYER_SETSTATE(4)
>>> NMS_PLAYER_READY
<<< NMS_PLAYER_SETSTATE(5)
>>> NMS_PLAYER_NAME(Computer 5 (AI) (easy))
>>> NMS_PLAYER_SET_COLOR
SERVER >>> BROADCAST: NMS_PLAYER_TOGGLECOLOR(5, 4282499953)
>>> NMS_PLAYER_SETSTATE(5)
>>> NMS_PLAYER_READY
<<< NMS_PLAYER_SETSTATE(6)
>>> NMS_PLAYER_NAME(Computer 6 (AI) (easy))
>>> NMS_PLAYER_SET_COLOR
SERVER >>> BROADCAST: NMS_PLAYER_TOGGLECOLOR(6, 4294934528)
>>> NMS_PLAYER_SETSTATE(6)
>>> NMS_PLAYER_READY
<<< NMS_PLAYER_SETSTATE(7)
>>> NMS_PLAYER_NAME(Computer 7 (AI) (easy))
>>> NMS_PLAYER_SET_COLOR
SERVER >>> BROADCAST: NMS_PLAYER_TOGGLECOLOR(7, 4278255615)


Editiert von FloSoft am 25.12.2020 10:42

FloSoft am 25.12.2020 10:41 #15628

Großmeister
Zitat:

Lua script did not provide the function getRequiredLuaVersion()! It is probably outdated.


---
mfg
Flo



Spike am 25.12.2020 10:55 #15629

Im Ruhestand
To clear that up see https://github.com/Spikeone/RttR_Campaigns/blob/master/Campaign_OriginalRoman/MISS200.LUA

The first function is getRequiredLuaVersion(), you have to add that one as well.

---



Gard am 25.12.2020 15:06 #15630


I wrote this down

Nevertheless, it is said that the lua script cannot be loaded

I'm sorry to bother you for too long, but I'm not at all familiar with it

In the pattern that is on the github, I do not know what everything must and does not have to be written there

Code:
function getRequiredLuaVersion()
    return 1.3
end

function addPlayerRes(p, onLoad)
    if onLoad then return end
    
    if(p == 0) then                
        
        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     ] = 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 addPlayerBld(p, onLoad)
    
    if(p == 0) then
        rttr:GetPlayer(p):DisableBuilding(BLD_BARRACKS,)
    end
end


Link 444lua.txt
https://uloz.to/file/h9pEbTUdBumo/444-lua

Editiert von Gard am 25.12.2020 15:10

Spike am 25.12.2020 15:32 #15631

Im Ruhestand
The console tells you the exact line where you find the error.

Zitat:
Lua error: [string "function getRequiredLuaVersion()..."]:84: unexpected symbol near ')'


And in line 84 there is this:
Zitat:
rttr:GetPlayer(p):DisableBuilding(BLD_BARRACKS,)


When having a look at: https://github.com/Return-To-The-Roots/s25client/blob/master/doc/lua/methods.md#gameplayer
You will find that the functions signature is: DisableBuilding(type)

So: In short, you added a comma after BLD_BARRACKS which causes the script to not load at all.

Also please refer https://github.com/Return-To-The-Roots/s25client/blob/master/doc/lua/events.md for events, currently your functions are never called.

As said, you may simply change this script for your needs: https://github.com/Spikeone/RttR_Campaigns/blob/master/OtherScripts/ExampleScript_01.LUA

---



Gard am 25.12.2020 17:30 #15632


it works now

https://github.com/Spikeone/RttR_Campaigns/blob/master/OtherScripts/ExampleScript_01.LUA

Jop wanted a specific pattern, this helped me

VERY THANX

one more question, please
is there any way to increase the number of players on the map? The current maximum is 7 players and I wonder if it can be increased to
10 players


Spike am 26.12.2020 10:47 #15633

Im Ruhestand
Zitat:
is there any way to increase the number of players on the map? The current maximum is 7 players and I wonder if it can be increased to 10 players

Currently the limit is 10 - but not supported by RttR (it may crash). 8 is working quite fine (see bigslaughter).

---



Gard am 26.12.2020 22:21 #15634


Yes, I have 8 players set up on my own maps

It confused me because the editor offers to start a location above 8 places


Gard am 30.12.2020 22:26 #15637


HI

Please have another problem
after entering these scripts I can't set the AI level of the opponent before the game, I can't set the goals of the game or hide or
uncover the maps.

Editiert von Gard am 08.01.2021 13:09

Spike am 08.01.2021 18:51 #15662

Gard am 09.01.2021 21:53 #15665


Yep it works now

Thanx




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?