This thread is so people can request or ask for help in their tibia edit, Yes I will do full work of what you will request but please all I ask is to just explain fully of what you want.
So recent thread of people asking about fishing/classes/etc.
Classes is just like the classes in the sample folder, in my opinion if it works then use it, It doesn't need to look all good or work efficiently, it just needs to work!
So to show people how to make their fishing...
Fishing
Add this in your items.lua
You will need to add your own image to the item above.
To use the newly added item press f3 and click on the item. After doing that you may fish by pressing the fish button. (You must BE faced towards the water!)
Then add this in your functions.lua
Then in your config.lua add these lines in the table called PLAYERINIT..
If done correctly your PLAYERINIT table should look like..
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
43
44
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
43
44
[520] = { 		name = "Fishing Pole", 		desc = "Used for fishing.", 		--r = 0, g = 0, b = 0, 		action = {"Equip","Fish"}, 		slot = 3, 		twohand = true, 		eimage = "gfx/rpp_tibia/items/pole_e.png", 		fimage = "gfx/rpp_tibia/items/pole_d.png", 		offsety = 9, 		func = {equip,function(id,itemslot,itemid,equip) 			local direction = math.floor((((PLAYERS[id].FISHLevel+5) / 160)^0.7)*100) 			local x, y = player(id, "tilex"), player(id, "tiley") 			local a = (player(id,"rot") + 270) % 360 			a = a/45 			if ( a > 7.5 or a < 0.5 ) then 				x = x + 1 			elseif ( a >= 0.5 and a <= 1.5 ) then 				x = x + 1; y = y + 1 			elseif ( a > 1.5 and a <= 2.5 ) then 				y = y + 1 			elseif ( a > 2.5 and a <= 3.5 ) then 				x = x - 1; y = y + 1 			elseif ( a > 3.5 and a <= 4.5 ) then 				x = x - 1 			elseif ( a > 4.5 and a <= 5.5 ) then 				x = x - 1; y = y - 1 			elseif ( a > 5.5 and a <= 6.5 ) then 				y = y - 1 			else 				x = x + 1; y = y - 1 			end 			if tile(x, y, 'frame') ~= 34 then message(id, "You cannot fish here",'255255255') return end 			local pos = player(id,"x") .. " " .. player(id,"y") 			local chance = math.floor( ((PLAYERS[id].FISHLevel/160)^0.5)*100) 			if math.random(0, 99) < chance then 				msg2(id,"©255100000You caught a fish.") 				additem(id,609) 				addFISHexp(id,3) 			else 				msg2(id,"©255100000You didn't catch a fish.") 			end 		end}, 	},
To use the newly added item press f3 and click on the item. After doing that you may fish by pressing the fish button. (You must BE faced towards the water!)
Then add this in your functions.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function addFISHexp(id, exp) 	if PLAYERS[id].FISHLevel <= 9 then 		PLAYERS[id].FISHExp = PLAYERS[id].FISHExp + exp 		local prevlevel = PLAYERS[id].FISHLevel 		while PLAYERS[id].FISHExp >= EXPTABLE[PLAYERS[id].FISHLevel+1] do 			PLAYERS[id].FISHLevel = PLAYERS[id].FISHLevel + 1 			local pos = player(id,"x") .. " " .. player(id,"y") 			parse("effect \"colorsmoke\" " .. pos .. " 32 32 0 0 255") 			message(id, "Fishing skill has leveled up to " .. PLAYERS[id].FISHLevel .. "!") 		end 		if prevlevel ~= PLAYERS[id].FISHLevel then 			parse('effect "colorsmoke" ' .. player(id, 'x') .. ' ' .. player(id, 'y') .. ' 0 64 30 144 255') 		end 		return true 	else 		return false 	end end
Then in your config.lua add these lines in the table called PLAYERINIT..
1
2
2
FISHLevel = 1, FISHExp = 0,
If done correctly your PLAYERINIT table should look like..
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
PLAYERINIT = { 		Experience = 0, 		Level = 1, 		Money = 50, 		HP = 100, 		MP = 100, 		FISHLevel = 1, 		FISHExp = 0, 		Inventory = {}, 		Equipment = {}, 		Spawn = {784, 240}, 		Tutorial = {}, 		Info = {}, 	},
Now on to classes...
Like I said before the classes don't have to look all good or well coded, they just have to work!
Classes
Yes a simple menu can make your classes work.
You might be noticing what cAtk2/cDef2/cSpd2 is, well it's where I add the classes stats that get added so when the player would reset their class they wouldn't be able to exploit it.
So we need to add that stuff to the PLAYERINIT table in the config.lua file.
If you added the fishing into your file then it should look like...
Then you might ask, "I want the people to see their class on their screen."
So in order to add it to their hud you will need to add this...
What I do to update the players hud constantly is by using the ms100 hook...
Also the player's class atk/def/spd will not add automatically, so you will need to add a couple of lines into the join hook located in the hooks.lua file...
Now to let the player choose his/her class you will need to add an npc in the map, to do so you need to go into the npcs.lua file and add this...
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
Yes a simple menu can make your classes work.
You might be noticing what cAtk2/cDef2/cSpd2 is, well it's where I add the classes stats that get added so when the player would reset their class they wouldn't be able to exploit it.
So we need to add that stuff to the PLAYERINIT table in the config.lua file.
If you added the fishing into your file then it should look like...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
PLAYERINIT = { 		Experience = 0, 		Level = 1, 		Money = 50, 		HP = 100, 		MP = 100, 		FISHLevel = 1, 		FISHExp = 0, 		cAtk2 = 0, 		cDef2 = 0, 		cSpd = 0, 		class = 0, 		Inventory = {}, 		Equipment = {}, 		Spawn = {784, 240}, 		Tutorial = {}, 		Info = {}, 	},
Then you might ask, "I want the people to see their class on their screen."
So in order to add it to their hud you will need to add this...
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
function updateEXTRAS(id) 	hudtxt2(id, 18, PLAYERS[id].FISHLevel, '255255000', 250, 435, 2) 	hudtxt2(id, 19, "Fishing", '255255255', 150, 435, 0) 	if PLAYERS[id].class == 0 then 		hudtxt2(id, 34, "Noobie", '255255000', 378, 421, 2) 		hudtxt2(id, 35, "Class", '255255255', 278, 421, 0) 	elseif PLAYERS[id].class == 1 then 		hudtxt2(id, 34, "Fighter", '255255000', 378, 421, 2) 		hudtxt2(id, 35, "Class", '255255255', 278, 421, 0) 	elseif PLAYERS[id].class == 2 then 		hudtxt2(id, 34, "Defender", '255255000', 378, 421, 2) 		hudtxt2(id, 35, "Class", '255255255', 278, 421, 0) 	elseif PLAYERS[id].class == 3 then 		hudtxt2(id, 34, "Mage", '255255000', 378, 421, 2) 		hudtxt2(id, 35, "Class", '255255255', 278, 421, 0) 	end end
What I do to update the players hud constantly is by using the ms100 hook...
1
2
3
4
5
6
7
2
3
4
5
6
7
addhook("ms100","ms100") function ms100() 	for _,id in ipairs(player(0,"tableliving")) do 		updateHUD(id) 		updateEXTRAS(id) 	end end
Also the player's class atk/def/spd will not add automatically, so you will need to add a couple of lines into the join hook located in the hooks.lua file...
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
Now to let the player choose his/her class you will need to add an npc in the map, to do so you need to go into the npcs.lua file and add this...
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
43
44
45
46
47
48
49
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
43
44
45
46
47
48
49
NPCs = { 	[1] = {"Robbie", pos={160, 144}, rot=180, 	trade={{2, 15}, {3, 15}}, 	greet="Need stuff, %s?", bye="Come again next time!", image="npc1"}, 	 	[2] = {"Norman", pos={320, 144}, rot=180, 	trade={{300, 100}, {301, 200}, {302, 150}, {303, 100}, {305, 500}, {304, 850}, {306, 900}}, 	greet="What do you need?", bye="See you again!", image="npc2"}, 	 	[3] = {"Federigo", pos={624, 208}, rot=270, image="npc3"}, 	 	[4] = {"Francesco",pos={400, 2800}, rot=270, image="npc3"}, 	 	[5] = {"Frodo", pos={2512, 144}, rot=180, trade={{400, 1500}, {401, 1500}, {402, 1500}, {403, 1500}, {-400, 500}, {-401, 500}, {-402, 500}, {-403, 500}}, 	greet="Hey! Get some horses, they're supposed to be $5000 each!", image="npc5"}, 	 	[6] = {"Heckie", pos={2608, 1760}, rot=0, trade={{200, 1000}, {201, 1000}, {207, 1000}, {208, 1000}, {203, 1000}, {210, 700}, {214, 700}, {218, 700}, {219, 700}}, 	greet="%s! Welcome!", bye="Aww, don't need more furniture?", image="npc6"}, 	 	[7] = {"Cosimo", pos={2640, 448}, rot=270, image="npc7"}, 	 	[8] = {"Martin", pos={2640, 672}, rot=270, 	trade={{-300, 40}, {-301, 80}, {-302, 60}, {-303, 40}, {-305, 200}, {-304, 350}, {-306, 400}}, greet="Selling stuff?", bye="Come to me when you find things to sell!", image="npc8"}, 	 	[9] = {"Enki", 		pos={2736, 1312}, 	rot=270, image="npc3"}, 	 	[10] = {"Vieno", 		pos={2832, 1840}, 	rot=180, image="npc4"}, 	 	[11] = {"Lucas", 		pos={3632, 2416}, 	rot=180, image="npc4"}, 	 	[12] = {"Finnbarr", 		pos={4192, 1648}, 	rot=0, image="npc3"}, 	 	[13] = {"Shun", 		pos={4128, 2176}, 	rot=180, image="npc2"}, 	 	[14] = {"Wibo", 		pos={3536, 1200}, 	rot=180, image="npc2"}, 	 	[15] = {"Eustachio", pos={4144, 1776}, rot=180, 	trade={{5, 10}}, 	greet="%s, any pizzas for you?", bye="Take a seat, if you want.", image="npc8"}, 	 	[16] = {"Demoncharm", pos={2400, 3984}, rot=180, 	trade={{100,100}, {101,100}, {103,100}, {104,100}, {106,100}, {102,30}, {105,100}, }, 	greet="Want some runes..?", bye="Farewell.", image="npc4"}, 	 	[17] = {"Barnsower", pos={3120, 976}, rot=180, 	trade={{100,100}, {101,100}, {103,100}, {104,100}, {106,100}, {102,30}, {105,100}, }, image="npc3"}, 	 	[19] = {"Class Choose", pos={(17*32+16), (17*32+16)}, rot=0, image="npc2"}, }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
NPCs[19].func = function(npc, id, words, state) 	if words == "hi" then 		NPCspeak(npc, "Hello, Would you like to chose a class?") 		PLAYERS[id].tmp.npcstate = {npc, 1} 	elseif contains(words, "bye") then 		NPCspeak(npc, "Goodbye!") 		PLAYERS[id].tmp.npcstate = nil 	elseif state == 1 then 		if contains(words, "yes") then 			menu(id,"Class,Fighter,Defender,Mage") 		elseif contains(words, "no") then 			NPCspeak(npc, "Okay! Come back when you want!") 		end 		PLAYERS[id].tmp.npcstate = nil 	end end
I have seen people say how do they check the players next exp needed till the next level. So below is the hudtext to show what the experience need for the player to level up.
Experience Needed
Just replace your updateEXTRAS with that.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function updateEXTRAS(id) 	hudtxt2(id, 18, PLAYERS[id].FISHLevel, '255255000', 250, 435, 2) 	hudtxt2(id, 19, "Fishing", '255255255', 150, 435, 0) 	hudtxt2(id, 28, ((PLAYERS[id].Level)^3 - 3 * (PLAYERS[id].Level)^2 + 8 * (PLAYERS[id].Level)), '255255000', 610, 407, 2) 	hudtxt2(id, 29, "Exp Needed", '255255255', 278, 379, 0) 	if PLAYERS[id].class == 0 then 		hudtxt2(id, 34, "Noobie", '255255000', 378, 421, 2) 		hudtxt2(id, 35, "Class", '255255255', 278, 421, 0) 	elseif PLAYERS[id].class == 1 then 		hudtxt2(id, 34, "Fighter", '255255000', 378, 421, 2) 		hudtxt2(id, 35, "Class", '255255255', 278, 421, 0) 	elseif PLAYERS[id].class == 2 then 		hudtxt2(id, 34, "Defender", '255255000', 378, 421, 2) 		hudtxt2(id, 35, "Class", '255255255', 278, 421, 0) 	elseif PLAYERS[id].class == 3 then 		hudtxt2(id, 34, "Mage", '255255000', 378, 421, 2) 		hudtxt2(id, 35, "Class", '255255255', 278, 421, 0) 	end end
Just replace your updateEXTRAS with that.
This is all I remember right now, if you would like to request something please do so hopefully this thread will not get closed, I'm just trying to help people because the dickheads in this community won't help anyone but themselves.
If there is something you don't understand please post below. Thank you for reading, if you actually did read it.
Also please do not post some bullshit on this thread, please keep it clean. If you have nothing nice to say, don't say it.
(Edit: If a mod closes this thread or deletes it please at least move this to the already created Tibia help thread.)
Other Links:
Certain Weapons for Classes
edited 1×, last 09.12.12 07:30:59 am