English Tibia script thread (Post tibia requests here)

347 replies
Goto Page
To the start Previous 1 2 3 4 ... 17 18 Next To the start
26.01.12 03:53:25 pm
Up
Glix
User
Offline Off
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


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


Code:
1
Also added to player init Mana = "100"


Per try
Code:
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?
Create free website for your clan! Create server control panel webE --->http://www.000webhost.com/581961.html
26.01.12 03:55:05 pm
Up
Bobakrome
User
Offline Off
IDK What's not good, I'm not a master in scripting also open ur server :D,
Code:
1
Now![spoiler]xD[/spoiler]
“Be the change that you wish to see in the world.”
26.01.12 03:59:20 pm
Up
Alistaire
User
Offline Off
user Glix has written:
But it's still don't work. ? its buggy. You got -50 per try, but you see it only after killing monster. Wtf?


Update hudtext before last 2 ends.

     ~Yates
IMG:http://i.imgur.com/5zhwOTP.png
26.01.12 04:06:42 pm
Up
Glix
User
Offline Off
user Alistaire has written:
user Glix has written:
But it's still don't work. ? its buggy. You got -50 per try, but you see it only after killing monster. Wtf?


Update hudtext before last 2 ends.

     ~Yates

?-?-?-?
Create free website for your clan! Create server control panel webE --->http://www.000webhost.com/581961.html
27.01.12 01:34:29 am
Up
KenVo
User
Offline Off
He meant that you have to put updateHUD(id) after.
27.01.12 12:16:37 pm
Up
Glix
User
Offline Off
Ok thx it worked, but i how i can make that when you 0 mana you can't use runes anymore.
Create free website for your clan! Create server control panel webE --->http://www.000webhost.com/581961.html
27.01.12 04:30:53 pm
Up
KenVo
User
Offline Off
Omg. Think before you ask questions. You can use
Code:
1
2
3
4
5
if PLAYERS[id].Mana >= (MANA COST OF YOUR RUNE HERE)
     --rune function
else
     message(id, "You don't have enough mana")
end
27.01.12 10:24:33 pm
Up
Glix
User
Offline Off
Okkey thx guys, but its possible that evry sec you gain 1 mana.
Create free website for your clan! Create server control panel webE --->http://www.000webhost.com/581961.html
28.01.12 12:55:49 am
Up
KenVo
User
Offline Off
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:
Code:
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
28.01.12 09:41:47 am
Up
Glix
User
Offline Off
Im startin learn lua. Can you explain?

You mean this?
Code:
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
Create free website for your clan! Create server control panel webE --->http://www.000webhost.com/581961.html
28.01.12 06:33:00 pm
Up
KenVo
User
Offline Off
Fix player(id, "mana") to "health"

Nvm, let me just write the whole shit out for you with explainations.
Code:
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
29.01.12 06:54:11 am
Up
Fossil
User
Offline Off
How do I make an accessory item when equipped gives u more hp? It increases ur max hp..
IMG:http://i42.tinypic.com/14t8pvm.png
29.01.12 12:07:10 pm
Up
kalis
User
Offline Off
any one can make :
     + menu trade (item)
in tibia RPG ?
29.01.12 04:26:53 pm
Up
Glix
User
Offline Off
Code:
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.
Create free website for your clan! Create server control panel webE --->http://www.000webhost.com/581961.html
30.01.12 11:50:48 pm
Up
KenVo
User
Offline Off
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
31.01.12 02:35:05 pm
Up
Glix
User
Offline Off
Here is my item:
Code:
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):
Code:
1
[15:31:21] LUA ERROR: sys/lua/cs2dtibia/items.lua:1907: unexpected symbol near 'if'


Can somebody help me?
Create free website for your clan! Create server control panel webE --->http://www.000webhost.com/581961.html
31.01.12 02:45:17 pm
Up
Blpzz9
User
Offline Off
Well Maybe The Script Or Item Code That Used Had Some Error?? Have U Taugt of that?
IMG:http://img337.imageshack.us/img337/3862/48541.png
31.01.12 02:58:52 pm
Up
Glix
User
Offline Off
I know that, but i don't know how to fix it... Thats why i asking for help!
Create free website for your clan! Create server control panel webE --->http://www.000webhost.com/581961.html
31.01.12 03:03:12 pm
Up
Apache uwu
User
Offline Off
Don't think you can put lexical conventions in tables, unless they are wrapped around a function.
     Put the if statement inside the function and see what happens.
31.01.12 04:36:24 pm
Up
KenVo
User
Offline Off
user Glix has written:
Here is my item:
Code:
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):
Code:
1
[15:31:21] LUA ERROR: sys/lua/cs2dtibia/items.lua:1907: unexpected symbol near 'if'


Can somebody help me?


Code:
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 4 ... 17 18 Next To the start