Page 1 of 2

How to "create_unit"

Posted: Tue Sep 24, 2013 3:51 pm
by seregavlg
Hi, when i use :
player = 0
tile = 10,10
create_unit (player,tile, "Armor", 0, nil, -1)

console:
attempt to call global 'create_unit' (a nil value)?

Re: How to "create_unit"

Posted: Tue Sep 24, 2013 4:21 pm
by cazfi
seregavlg wrote:Hi, when i use :
player = 0
tile = 10,10
create_unit (player,tile, "Armor", 0, nil, -1)

console:
attempt to call global 'create_unit' (a nil value)?
Where you try this? Other problems aside (such as that 0 won't work as player-object), note that edit.create_player() is available in server context only (see colour coding in http://freeciv.wikia.com/wiki/Events_Reference_Manual )

Re: How to "create_unit"

Posted: Wed Sep 25, 2013 7:29 pm
by seregavlg
hmm, how i can run script file from server console?

put: find.unit 1 - unknown command
find.unit (1) - unknown command

Re: How to "create_unit"

Posted: Thu Sep 26, 2013 5:50 pm
by seregavlg
hmm, command like this: lua find.player(0) client lua console: lua error:
[string "cmd"]:1: '=' expected near 'find' ???? where i wrong?

Re: How to "create_unit"

Posted: Thu Sep 26, 2013 6:32 pm
by cazfi
seregavlg wrote:hmm, how i can run script file from server console?

put: find.unit 1 - unknown command
find.unit (1) - unknown command

Code: Select all

> help lua
Command: lua  -  Evaluate a line of Freeciv script or a Freeciv script file in the current game.
Synopsis: lua cmd <script line>
          lua file <script file>
          lua <script line> (deprecated)
Level: admin
> lua cmd plr=find.player(0)
> lua cmd tile=find.tile(10,10)
> lua cmd utype=find.unit_type("Archer")
> lua cmd create_unit(plr, tile, utype, 0, nil, -1)

Re: How to "create_unit"

Posted: Sat Sep 28, 2013 7:39 am
by seregavlg
thx, but unit not created.

Re: How to "create_unit"

Posted: Sat Sep 28, 2013 8:07 am
by seregavlg
sorry, when i put id in utype (1)not("workers") unit created

Re: How to "create_unit"

Posted: Sun Sep 29, 2013 10:53 am
by seregavlg
Is it possible to run server console when i create single player game?

Re: How to "create_unit"

Posted: Sun Sep 29, 2013 11:06 am
by HanduMan
seregavlg wrote:Is it possible to run server console when i create single player game?
I'm not exactly sure what you are asking here but...
All games need a server running to be able to play. One is started automatically when you start a game from client.
You can enter server commands in client's chat prompt and the server will reply in there also. So, that is kinda embedded server console, right?
You can also start the server separately, create a single player game and join it with a client. Look for executable named freeciv-server in freeciv installation directory.

Re: How to "create_unit"

Posted: Sun Sep 29, 2013 12:14 pm
by seregavlg
thx, ny q. is:

1. I run freeciv server.exe, launch game
2. connect to this game.
3. save game
4. close client & server
5. start client
6. load game (client wrote "start server")
i see server.exe in task manager, but server console is unavailable