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 24 5 617 18 Next To the start

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

Glix
User Off Offline

Quote
The 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 = {
               function(id, itemslot, itemid, equip)
               if PLAYERS[id].Mana >= 34 then
               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},
     },

console>>>
1
[14:47:07] LUA ERROR: sys/lua/cs2dtibia/items.lua:1915: unexpected symbol near ','

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

KenVo
User Off Offline

Quote
@ Xiatr >


@PunishedNoob >
edited 2×, last 04.02.12 08:09:14 pm

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

kalis
User Off Offline

Quote
hey
i got bug from tibia
can you help me ?

i'm in house (but not safe zone)
the question :
     why i can hit the monster
     monster is outside house
     
     my gun can throught wall ?

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

Yates
Reviewer Off Offline

Quote
Yes, on Tibia Weiwen made an extra range function. You determine the range of the gun. If a monster is behind a wall and the range of your gun says that it can go further than that it will hit the monster.

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

Glix
User Off Offline

Quote
hooks.lua -- Error line
1
2
3
4
5
6
7
8
9
for _, id in ipairs(player(0, 'table')) do
		if player(id, 'health') > 0 and PLAYERS[id] and PLAYERS[id].Mana > (CONFIG.MAXMP - 5) and PLAYERS[id].Mana < (CONFIG.MAXMP) then -- line 219
               PLAYERS[id].tmp.tmana = (CONFIG.MAXMP) - PLAYERS[id].Mana
               PLAYERS[id].Mana = PLAYERS[id].Mana + PLAYERS[id].tmp.tmana
               updateHUD(id)
          elseif player(id, 'health') > 0 and PLAYERS[id] and PLAYERS[id].Mana < (CONFIG.MAXMP) then
               PLAYERS[id].Mana = PLAYERS[id].Mana + 5
               updateHUD(id)
          end

config.lua -- stats
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
STATS = {'Experience', 'Level', 'Money', 'Energy', 'Mana'}, --ignore

	STATSMENU = {"hp", "atk", "def", "spd"}, --ignore
	
	-- initial player table. info is a table consisting of strings to inform the player when (s)he logs in. the table is cleared after logging in.
	-- if you would like to set initial level, money, equip etc this should be where you do it.
	PLAYERINIT = {
		Experience = 0,
		Level = 1,
		Money = 546,
		Mana = 100,
		Energy = 100,
		HP = 100,
		MP = 100,
		Inventory = {}, 
		Equipment = {}, 
		Spawn = {784, 240}, 
		Tutorial = {},
		Info = {},
	},

function.lua -- Updatehud...
1
2
3
4
function updateMP(id)
     hudtxt2(id,21, PLAYERS[id].Mana, '255255000', 610,452,1)
     hudtxt2(id,22, "Mana", '255255255', 528,452,1)
end


> > CONSOLE >>>
1
[13:12:30] LUA ERROR: sys/lua/cs2dtibia/hooks.lua:219: attempt to perform arithmetic on field 'MAXMP' (a nil value)

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

Yates
Reviewer Off Offline

Quote
user kalis has written
And i try to fix but cant
@yates
any ideas ?

You can't. You need the range function so that you can attack monsters with guns. It's not such a big problem that they can shoot through walls, just make the gun lvl higher so they don't get it that easily.

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

Glix
User Off Offline

Quote
CONSLOE >>>
1
2
[14:28:44] LOAD MAP: 'maps/ysize.map' does not exist
[14:28:44] LUA ERROR: sys/lua/server.lua:21: 'for' limit must be a number

The script _tibia server.lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
GROUNDITEMS = {}
TILEZONE = {}
for y = 0, map'ysize' do
	GROUNDITEMS[y], TILEZONE[y] = {}, {}
	for x = 0, map'xsize' do
		GROUNDITEMS[y][x], TILEZONE[y][x] = {}, {}
		for i, v in ipairs(SAFEZONE) do
			TILEZONE[y][x].SAFE = (x >= v[1][1] and x <= v[2][1] and y >= v[1][2] and y <= v[2][2])
			if TILEZONE[y][x].SAFE then break end
		end
		for i, v in ipairs(PVPZONE) do
			TILEZONE[y][x].PVP = (x >= v[1][1] and x <= v[2][1] and y >= v[1][2] and y <= v[2][2]) and i or nil
			if TILEZONE[y][x].PVP then
				TILEZONE[y][x].SAFE = false
				break
			end
		end

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

KenVo
User Off Offline

Quote
@user Glix: You forgot to add MAXMP = 100, to your configs.lua, try harder.

@user Kantos: Don't tell someone to do something if you have no idea how to do it.

@user Fossil: @user Yates: @user kalis: There is actually a way to fix the 'shoot though walls' glitch. Just make a function that measure the distance between the player and the monster. Then if there is a wall between that distance then no damage will be dealt.

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

KenVo
User Off Offline

Quote
Btw, I made a little mistake in mana function. PLAYERS[id].Mana supposed to be PLAYERS[id].MP.
Change it:

==Fix mana function== >
edited 1×, last 05.02.12 02:19:21 am
To the start Previous 1 24 5 617 18 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview