Forum




First you need to find the function, function equip(id, itemslot, itemid, equip) and replace it with the one below.
So after you have done that you can add class = 1, to your items like so.
If you find that something doesn't work please do post.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
addhook("menu","C_menu",-1) function C_menu(id,title,button) if title == "Class" then if button == 1 then if PLAYERS[id].class == 0 then PLAYERS[id].tmp.atk = PLAYERS[id].tmp.atk + 1 PLAYERS[id].tmp.def = PLAYERS[id].tmp.def - 7 PLAYERS[id].tmp.spd = PLAYERS[id].tmp.spd - 6 PLAYERS[id].cAtk2 = PLAYERS[id].cAtk2 + 1 PLAYERS[id].cDef2 = PLAYERS[id].cDef2 - 7 PLAYERS[id].class = 1 else message(id, "You need to reset your class first!") end elseif button == 2 then if PLAYERS[id].class == 0 then PLAYERS[id].tmp.atk = PLAYERS[id].tmp.atk - 0.75 PLAYERS[id].tmp.def = PLAYERS[id].tmp.def + 3 PLAYERS[id].tmp.spd = PLAYERS[id].tmp.spd - 1 PLAYERS[id].cAtk2 = PLAYERS[id].cAtk2 - 0.75 PLAYERS[id].cDef2 = PLAYERS[id].cDef2 + 3 PLAYERS[id].class = 2 else message(id, "You need to reset your class first!") end elseif button == 3 then if PLAYERS[id].class == 0 then PLAYERS[id].tmp.atk = PLAYERS[id].tmp.atk + 0.25 PLAYERS[id].tmp.def = PLAYERS[id].tmp.def + 1 PLAYERS[id].tmp.spd = PLAYERS[id].tmp.spd + 1 PLAYERS[id].cAtk2 = PLAYERS[id].cAtk2 + 0.25 PLAYERS[id].cDef2 = PLAYERS[id].cDef2 + 1 PLAYERS[id].class = 3 else message(id, "You need to reset your class first!") end end end end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
PLAYERINIT = { Experience = 0, Level = 1, Money = 50, HP = 100, MP = 100, FISHLevel = 1, FISHExp = 0, cAtk2 = 0, cDef2 = 0, class = 0, Inventory = {}, Equipment = {}, Spawn = {784, 240}, Tutorial = {}, Info = {}, },
Now, heres what I want to fix:
1. The 'freeimage' (Make it disappear in 5 seconds or somethin)
2. Fix anything wrong in 'id=image' or any other thing.
My problems are:
1. Image does not disappear
2. the 'parse sv_sound2' wont play
Additional info:
If I removed the id=image and freeimage and replaced it with the default (parse('effect "colorsmoke" ' .. player(id, 'x') .. ' ' .. player(id, 'y') .. ' 0 64 0 128 255')) the sound will still play..
Thanks in advance. Sorry, I fail at lua.. (I just know the basics, or somethin)
PS. I know, some positions are random in the script, just to test... huehe
You also need the following to make it work as there is no table called Player yet.
Add Player = {} wherever you want then put Player[id] = {} on join.
Example (Line 1 and 11);

Additional info:
If I removed the id=image and freeimage and replaced it with the default (parse('effect "colorsmoke" ' .. player(id, 'x') .. ' ' .. player(id, 'y') .. ' 0 64 0 128 255')) the sound will still play..
If I removed the id=image and freeimage and replaced it with the default (parse('effect "colorsmoke" ' .. player(id, 'x') .. ' ' .. player(id, 'y') .. ' 0 64 0 128 255')) the sound will still play..
Your freeimage and timer were weird. I've never seen the command addtimer before and I do not recommend using id as the image number if you are working with a script which uses a shitload of images. That is why I made a table for you.

BTW: Sorry for my mistakes, as I said i'm still learning. and about the 'addtimer' I saw it in the script somewhere, so i thought it was a function/hook/somethin
EDIT:
Just noticed something wrong in my script. So if others would use it, it may not work untill they fix it. Huehuhehe protection against some people

edited 1×, last 11.12.12 02:54:17 pm
http://www.youtube.com/watch?v=U4YKUpzVJ5Ycs2dtibia
Im just make an weapon whit teleport function.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
[308] = { name = "wooden dagger[P]", desc = "Less dammage, but more speed. Upgraded with power hit [P].", r = 128, g = 64, b = 0, action = {"power hit [5]","equip"}, slot = 3, eimage = "gfx/weiwen/dagger.png", fimage = "gfx/weiwen/dagger.png", offsetx = 6, offsety = 17, atk = 0.3, speed = -0.25, level = 0, func = { function(id, itemslot, itemid, equip) if PLAYERS[id].MP < 23 then message(id, "You don't have enough mana",'255255255') return end if PLAYERS[id].Level < 0 then message(id, "You need to be level 0.","255255255") return end 			radiusmsg("uses teleport!", self.x, self.y) 			parse("effect \"colorsmoke\" " .. self.x .. " " .. self.y .. " 5 5 255 255 255") 			local dir = math.random(math.pi*2) 			if self:move(dir, 40) or self:move(dir, -40) then 			parse("effect \"colorsmoke\" " .. self.x .. " " .. self.y .. " 5 5 255 255 255") PLAYERS[id].MP = PLAYERS[id].MP - 23 updateHUD(id) end,equip}, },
1
LUA ERROR: sys/lua/cs2dtibia/items.lua:690: unexpected symbol near ','
pls im need you help!!
edited 2×, last 20.12.12 04:44:10 pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
addhook("menu","C_menu",-1) function C_menu(id,title,button) if title == "Class" then if button == 1 then if PLAYERS[id].class == 0 then PLAYERS[id].tmp.atk = PLAYERS[id].tmp.atk + 1 PLAYERS[id].tmp.def = PLAYERS[id].tmp.def - 7 PLAYERS[id].tmp.spd = PLAYERS[id].tmp.spd - 6 PLAYERS[id].cAtk2 = PLAYERS[id].cAtk2 + 1 PLAYERS[id].cDef2 = PLAYERS[id].cDef2 - 7 PLAYERS[id].cSpd2 = PLAYERS[id].cSpd2 - 6 PLAYERS[id].class = 1 else message(id, "You need to reset your class first!") end elseif button == 2 then if PLAYERS[id].class == 0 then PLAYERS[id].tmp.atk = PLAYERS[id].tmp.atk - 0.75 PLAYERS[id].tmp.def = PLAYERS[id].tmp.def + 3 PLAYERS[id].tmp.spd = PLAYERS[id].tmp.spd - 1 PLAYERS[id].cAtk2 = PLAYERS[id].cAtk2 - 0.75 PLAYERS[id].cDef2 = PLAYERS[id].cDef2 + 3 PLAYERS[id].cSpd2 = PLAYERS[id].cSpd2 - 1 PLAYERS[id].class = 2 else message(id, "You need to reset your class first!") end elseif button == 3 then if PLAYERS[id].class == 0 then PLAYERS[id].tmp.atk = PLAYERS[id].tmp.atk + 0.25 PLAYERS[id].tmp.def = PLAYERS[id].tmp.def + 1 PLAYERS[id].tmp.spd = PLAYERS[id].tmp.spd + 1 PLAYERS[id].cAtk2 = PLAYERS[id].cAtk2 + 0.25 PLAYERS[id].cDef2 = PLAYERS[id].cDef2 + 1 PLAYERS[id].cSpd2 = PLAYERS[id].cSpd2 + 1 PLAYERS[id].class = 3 else message(id, "You need to reset your class first!") end end end end
Where do I put this?


@Jynxxx anywhere in any any any where?
Make a new lua file, Past the code, Add a "dofile" to server.lua .
Or just open any script (Functions.lua for example) and go to the bottom/top and past the code.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
addhook("join","EXPjoin") function EXPjoin(id) if loadplayer(id) then print('-- loaded!') else print('-- unable to load!') end PLAYERS[id].tmp = {hp = 100, atk = 1, def = 1, spd = 0, usgn = player(id, "usgn"), equip = {}, exhaust = {}} for k, v in ipairs(CONFIG.SLOTS) do PLAYERS[id].tmp.equip[k] = {} end if PLAYERS[id].class > 0 then PLAYERS[id].tmp.atk = PLAYERS[id].tmp.atk + PLAYERS[id].cAtk2 PLAYERS[id].tmp.def = PLAYERS[id].tmp.def + PLAYERS[id].cDef2 PLAYERS[id].tmp.spd = PLAYERS[id].tmp.spd + PLAYERS[id].cSpd2 end end
I get the error:
Quote
LUA ERROR: sys/lua/cs2dtibia/hooks.lua:171: bad argument #2 to 'format' (string expected, got nil)
edited 4×, last 02.01.13 04:50:50 pm

has possible calculate monster's healt
its an code:
1
player(id, 'name') .. ' deals ' ..dmg.. ' damage to ' . self.name.. ' usng a ' ..wpnName.. '.'
someone here all code?



edited 1×, last 03.01.13 09:07:43 pm
http://www.unrealsoftware.de/forum_posts.php?post=345254&l#jl
1
2
3
4
5
2
3
4
5
local SPAWNS = { 	FULLMAP = {{0, 0}, {150, 150}}, 	BOTTOMHALF = {{0, 100}, {150, 150}}, 	ONIXCAVE = {{165, 30}, {184, 48}}, }
This is in the monsters.lua file.