Forum

> > CS2D > Scripts > Tibia script thread (Post tibia requests here)
Forums overviewCS2D overview Scripts overviewLog in to reply

English Tibia script thread (Post tibia requests here)

347 replies
Page
To the start Previous 1 2 3 417 18 Next To the start

old Re: Tibia script thread (Post tibia requests here)

Glix
User Off Offline

Quote
user Bobakrome has written
Xiatr, more stats would be impossible to do without deleting all players, there are 4 stats: Exp, Level, Money, Mana. But you can add simple attributes


1
STATS = {'Experience', 'Level', 'Money', 'Mana'},

1
Also added to player init Mana = "100"

Per try
1
PLAYERS[id].Mana = PLAYERS[id].Mana - 50

But it's still don't work. ? its buggy. You got -50 per try, but you see it only after killing monster. Wtf?

old Re: Tibia script thread (Post tibia requests here)

KenVo
User Off Offline

Quote
Ok, I don't want to give you the whole code for mana regen because I want you to actually learn something, so this is how you write your own code:

0. Put 'MAXMANA = 100' in config.lua
1. Find 'second' hook in hooks.lua
2. Write your codes inside the ipair player table:
1
2
3
4
if --PLAYER HP IS HIGHER THAN 0-- and --PLAYER MANA LESS THAN MAXMANA IN CONFIG.LUA-- then
	--PLAYER MANA-- = --PLAYER MANA  PLUS 1--
	--UPDATE HUD OF PLAYER--
end

old Re: Tibia script thread (Post tibia requests here)

Glix
User Off Offline

Quote
Im startin learn lua. Can you explain?

You mean this?
1
2
3
4
if player(id, 'Mana') > 0 and MAXMANA = 100 then
			PLAYERS[id].Mana = PLAYERS[id].Mana - 1
			updateHUD(id)
		end
edited 1×, last 28.01.12 12:49:48 pm

old Re: Tibia script thread (Post tibia requests here)

KenVo
User Off Offline

Quote
Fix player(id, "mana") to "health"

Nvm, let me just write the whole shit out for you with explainations.
1
2
3
4
if player(id,"health") > 0 and PLAYERS[id].Mana < CONFIG.MAXMANA then --PLAYER HAS TO BE ALIVE AND MANA LOWER THAN 100
    PLAYERS[id].Mana = PLAYERS[id].Mana + 1--INCREASE 1 MANA
    updateHUD(id)--UPDATE HUD
end

old Re: Tibia script thread (Post tibia requests here)

Glix
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
[514] = {
		name = "dragon dagger[P]", 
		desc = "Less dammage, but more speed. Upgraded with power hit [P].",
		r = 180, g = 0, b = 0,  
		action = {"power hit [20]","equip"}, 
		slot = 3, 
		eimage = "gfx/weiwen/dagger.png", 
		fimage = "gfx/weiwen/dagger.png",  
		offsetx = 6,
		offsety = 17,
		atk = 1.4, 
		speed = -0.25, 
		level = 25, 
		func = equip,
		func = {if PLAYERS[id].Mana >= (MANA COST OF YOUR RUNE HERE)
			function(id, itemslot, itemid, equip)
			radiusmsg(player(id,"name") .. " used special attack.", player(id,"x"), player(id,"y"))
			explosion(player(id, "x"), player(id,"y"), 64, 20, id)
			local pos = player(id,"x") .. " " .. player(id,"y")
			parse("effect \"colorsmoke\" " .. pos .. " 100 96 128 128 0")
		else
    		 message(id, "You don't have enough mana")
		end,equip},

Still don't work! i don't know why.

old Re: Tibia script thread (Post tibia requests here)

KenVo
User Off Offline

Quote
This line:
if PLAYERS[id].Mana >= (MANA COST OF YOUR RUNE HERE)

?

Btw, when you get the scripts from me please try to understand it, or at least take a look at it --'
edited 1×, last 31.01.12 01:42:46 am

old Re: Tibia script thread (Post tibia requests here)

Glix
User Off Offline

Quote
Here is my item:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[514] = {
		name = "dragon dagger[P]", 
		desc = "Less dammage, but more speed. Upgraded with power hit [P].",
		r = 180, g = 0, b = 0,  
		action = {"power hit [20]","equip"}, 
		slot = 3, 
		eimage = "gfx/weiwen/dagger.png", 
		fimage = "gfx/weiwen/dagger.png",  
		offsetx = 6,
		offsety = 17,
		atk = 1.4, 
		speed = -0.25, 
		level = 25, 
		func = equip,
		func = {if PLAYERS[id].Mana >= (50)
			function(id, itemslot, itemid, equip)
			radiusmsg(player(id,"name") .. " used special attack.", player(id,"x"), player(id,"y"))
			explosion(player(id, "x"), player(id,"y"), 64, 20, id)
			local pos = player(id,"x") .. " " .. player(id,"y")
			parse("effect \"colorsmoke\" " .. pos .. " 100 96 128 128 0")
		else
    		 message(id, "You don't have enough mana")
		end,equip},
	},

Error code(From console):
1
[15:31:21] LUA ERROR: sys/lua/cs2dtibia/items.lua:1907: unexpected symbol near 'if'

Can somebody help me?

old Re: Tibia script thread (Post tibia requests here)

KenVo
User Off Offline

Quote
user Glix has written
Here is my item:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[514] = {
		name = "dragon dagger[P]", 
		desc = "Less dammage, but more speed. Upgraded with power hit [P].",
		r = 180, g = 0, b = 0,  
		action = {"power hit [20]","equip"}, 
		slot = 3, 
		eimage = "gfx/weiwen/dagger.png", 
		fimage = "gfx/weiwen/dagger.png",  
		offsetx = 6,
		offsety = 17,
		atk = 1.4, 
		speed = -0.25, 
		level = 25, 
		func = equip,
		func = {if PLAYERS[id].Mana >= (50)
			function(id, itemslot, itemid, equip)
			radiusmsg(player(id,"name") .. " used special attack.", player(id,"x"), player(id,"y"))
			explosion(player(id, "x"), player(id,"y"), 64, 20, id)
			local pos = player(id,"x") .. " " .. player(id,"y")
			parse("effect \"colorsmoke\" " .. pos .. " 100 96 128 128 0")
		else
    		 message(id, "You don't have enough mana")
		end,equip},
	},

Error code(From console):
1
[15:31:21] LUA ERROR: sys/lua/cs2dtibia/items.lua:1907: unexpected symbol near 'if'

Can somebody help me?


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[514] = {
		name = "dragon dagger[P]", 
		desc = "Less dammage, but more speed. Upgraded with power hit [P].",
		r = 180, g = 0, b = 0,  
		action = {"power hit [20]","equip"}, 
		slot = 3, 
		eimage = "gfx/weiwen/dagger.png", 
		fimage = "gfx/weiwen/dagger.png",  
		offsetx = 6,
		offsety = 17,
		atk = 1.4, 
		speed = -0.25, 
		level = 25,
		func = {
			function(id, itemslot, itemid, equip)
			if PLAYERS[id].Mana >= 50
			radiusmsg(player(id,"name") .. " used special attack.", player(id,"x"), player(id,"y"))
			explosion(player(id, "x"), player(id,"y"), 64, 20, id)
			local pos = player(id,"x") .. " " .. player(id,"y")
			parse("effect \"colorsmoke\" " .. pos .. " 100 96 128 128 0")
		else
    		 message(id, "You don't have enough mana")
		end,equip},
	},

try that.
To the start Previous 1 2 3 417 18 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview