Forum

> > CS2D > Scripts > Adding lua in-game
Forums overviewCS2D overview Scripts overviewLog in to reply

English Adding lua in-game

11 replies
To the start Previous 1 Next To the start

old Adding lua in-game

Ax3
User Off Offline

Quote
Hi, i have 1 question. How to add lua script in server IN-GAME?

old Re: Adding lua in-game

Tajifun
User Off Offline

Quote
Open your CS2D folder and go to:
sys -> lua -> server.lua

It's a textfile which should look like this:
More >


Write
1
dofile("sys/lua/NAME.lua")

anywhere in it:
More >


Replace "NAME" by the name of your luascript!
Do not use "--"!

old Re: Adding lua in-game

Banaan
User Off Offline

Quote
Err... that doesn't work in-game (I assume Ax3 means 'while playing CS2D' with in-game?).

In b0.1.1.9, DC disabled the option to control Lua through RCon. If you host a listen server (through 'New game'), you can just type
1
lua dofile("sys/lua/NAME.lua")
in your console. If you want to add a Lua script to a dedicated server, you'd have to do it the way Tajifun described.

old Re: Adding lua in-game

Ax3
User Off Offline

Quote
@Tajifun, i know it, i'm not an idiot. ._.
I want one script: if you say, for example, "change_zombie" in console, server changes the map and starts zombie script. If you say "change_standard" in console, server changes the map and stops zombie script. Is this possible?

old Re: Adding lua in-game

Bowlinghead
User Off Offline

Quote
Yes with Lua!
1
2
3
4
5
6
addhook("say","zmb")
function zmb(id,msg)
	if msg=="zombie" then
	dofile("sys/lua/NAME.lua")
	end
end


I think, it's run a Script!
But I know, it works wrong

old Re: Adding lua in-game

EngiN33R
Moderator Off Offline

Quote
1
2
3
4
5
6
7
8
9
addhook("rcon","modechange")
function modechange(cmd)
	if (cmd=="change_zombie") then
		parse("map WHATEVERMAPYOUNEED")
		parse("luareset")
		dofile("sys/lua/URZOMBIESCRIPT.lua")
		dofile("sys/lua/MAYBEACOUPLE.lua")
	end
end

I'm not sure whether it'll work, but still try.

old Re: Adding lua in-game

albachersont
User Off Offline

Quote
>yes it is, but I do not know how to install script RPG Tibia World, I as treble but will not work, does anyone know how to do or even how do you ......
1
--dofile("sys/lua/scriptname.lua")

old Re: Adding lua in-game

EngiN33R
Moderator Off Offline

Quote
Do NOT use translators and do NOT post about your problems in irrelevant threads. But I think you have to remove the -- before the dofile line.

old Re: Adding lua in-game

Bowlinghead
User Off Offline

Quote
The "--" means a commentary. That means the Computer don't read this line. Remove the "--".

The "--" is very helpful for longer Scripts if you forgot what a function mean!
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview