English Lua Scripts/Questions/Help

6,770 replies
Goto Page
To the start Previous 1 2 ... 201 202 203 ... 338 339 Next To the start
18.05.10 12:36:56 am
Up
gabpro
User
Offline Off
One little question...
How to know what the ID of the player with the hook "trigger"?


Quote:
trigger(trigger,source)                         on trigger (once per trigger)
-trigger: trigger name
-source: triggered by 0=map/1=script
>return:     0 - proceed normally
          1 - don't trigger
18.05.10 01:28:45 am
Up
Lee
Moderator
Offline Off
gabpro has written:
One little question...
How to know what the ID of the player with the hook "trigger"?


Trigger is a map event, therefore the id doesn't propagate (for example, a timer could also trigger an event). Use is a player event, use that instead.
18.05.10 02:34:14 am
Up
archmage
User
Offline Off
Intrusion has written:
Omg what worng with my script? help me i can't change it, i don't understand lua in full >.>

Your problem is that the value for Terrorist - TT is a Nil value. Nil simply means nothing, unexistant, or zero.
I am guessing you want TT as a string so here are two ways to fix this.

I. The Simplest way.
Code:
1
2
-- For strings you need to use one of these: ",',[[ ]]
Terrorist == "TT"


II. The other way.
Code:
1
2
TT = "<something>"
Terrorist == TT


Edit I looked over the rest of the code and for many more errors. Unfortunately I do not have the time to fix them.
edited 1×, last 18.05.10 02:47:31 am
We must secure the existence of our people and a future for white children. 14/88
18.05.10 05:34:35 am
Up
Flacko
User
Offline Off
DRoNe has written:
Code:
1
attempt to call a number value


pls one example for finding this error.

I won't give you an example, I'll give you 2
Code:
1
2
3
4
5("hello")
-------------
a = 3
a(4,"asd",{})
18.05.10 09:27:31 am
Up
DRoNe
User
Offline Off
Can you fix this code ?
Code:
1
2
3
4
5
6
7
8
9
10
11
12
number = 0

addhook("usebutton","bleble")
function bleble(id,x,y)
     if x == 37 and y == 17 or x == 44 and y == 17 or x == 37 and y == 21 or x == 44 and y == 21 then
          number = number + 1
     end
     if number == 4 then
          parse("trigger lol")
          number = 0
     end
end
IMG:http://img39.imageshack.us/img39/567/drnatimg.png
18.05.10 09:53:04 am
Up
Flacko
User
Offline Off
What could be wrong in that piece of code? Are you sure it's the source of your problem?
18.05.10 10:05:20 am
Up
DRoNe
User
Offline Off
lol yeah, you right
thanks
IMG:http://img39.imageshack.us/img39/567/drnatimg.png
18.05.10 10:22:14 am
Up
Flacko
User
Offline Off
Did you get to fix your error? What was it?
18.05.10 12:27:27 pm
Up
DRoNe
User
Offline Off
i just removed one wrong whole usebutton hook.

Code:
1
2
3
4
5
6
7
8
9
10
addhook("triggerentity","tsetpos")
function tsetpos(id,x,y,team)
     if x == 50 and y == 45 or x == 51 and y == 45 or x == 52 and y == 45 or x == 53 and y == 45 then
          if player(id,"team") == 1 then
               if player(id,"exists") then
                    parse ("setpos "..id.." 176 1424")
               end
          end
     end
end


in map i have trigger_move for Ct's only, i want when they move over him then terrorists will be ported to position(176x1424px)
IMG:http://img39.imageshack.us/img39/567/drnatimg.png
18.05.10 03:37:04 pm
Up
Sudden Death
User
Offline Off
Ohh I changed the lua until it became that, as entered into the CT is the game to crash xDD

edit: I think when I see "lua error attempt to compare number with nil" then I need make nil number ? ?
edit2: But nil = zero. I want to change the class for all TT
edited 1×, last 18.05.10 04:21:03 pm
Sniffin'Man "If it cannot be done with lua, it must be you mama, coz she's too fat"
18.05.10 04:34:47 pm
Up
KenVo
User
Offline Off
I downloaded script CS2DTibia - RPG in: http://www.unrealsoftware.de/forum_posts.php?post=176932&start=0 and don't know how to make the monster use teleport next to who it want to kill.

Example:

IMG:http://img140.imageshack.us/img140/9104/40011462.png


I have a script teleport for monster but for running not attacking people

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
{
          name = 'Abra', health = 100, image = 'gfx/weiwen/pokemon/63.png', scalex = 2, scaley = 2, 
          atk = 0.6, def = 1.0, spd = 5, atkspd = 10, x = 0, y = 0, ang = 0, imgang = 0, spawnchance = 20, runat = 100, spawn1 = {0, 0}, spawn2 = {150, 150}, 
          exp = 10, money = 100, loot = {{chance = 5000, id = 105}},
          spc = {2500, function(self) 
               radiusmsg("Abra 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")
               end
          end},
},


18.05.10 06:33:39 pm
Up
SkullFace
User
Offline Off
Can somebody help me make when somebody builds barricade or wall,wall2,wall3 and then goes over it some sprite? pls reply on this post
IMG:https://i.imgur.com/kZBVkjM.gif
P.S. - I've been extracting recently enviromental sound files from other games, if anyone is interested in them for adding them to their maps, scripts, PM me
18.05.10 08:46:41 pm
Up
DRoNe
User
Offline Off
Code:
1
2
3
4
5
6
7
8
9
10
addhook("triggerentity","tsetpos")
function tsetpos(id,x,y)
     if x == 50 and y == 45 or x == 51 and y == 45 or x == 52 and y == 45 or x == 53 and y == 45 then -- trigger_move positions
          for id = 1, game("sv_maxplayers") do
               if player(id,"team") == 1 then -- for all terrorists
                    parse ("setpos "..id.." 176 1424") - set them to certain position
               end
          end
     end
end


trigger_move can be trigger by ct's only.I want if they walk over trigger_move, terrorists will be teleported to certain position.Help me fix this code.plz
IMG:http://img39.imageshack.us/img39/567/drnatimg.png
18.05.10 08:56:33 pm
Up
Flacko
User
Offline Off
Intrusion has written:
Ohh I changed the lua until it became that, as entered into the CT is the game to crash xDD

edit: I think when I see "lua error attempt to compare number with nil" then I need make nil number ? ?
edit2: But nil = zero. I want to change the class for all TT

No, nil is not a number, therefore it's not zero, neither it's false or any other value, it's just nil.
You will have to figure out which is your nil value that you're trying to compare so you can debug your script
19.05.10 04:32:22 am
Up
archmage
User
Offline Off
Intrusion has written:
Ohh I changed the lua until it became that, as entered into the CT is the game to crash xDD

edit: I think when I see "lua error attempt to compare number with nil" then I need make nil number ? ?
edit2: But nil = zero. I want to change the class for all TT

When I said zero I actually meant nothing at all. I guess I confused you, sorry. Nil is nothing; you can use it to "delete" variables and other things.
We must secure the existence of our people and a future for white children. 14/88
19.05.10 11:34:28 am
Up
Sudden Death
User
Offline Off
I need the number that will identify all the TT, because this class is for all TT in the same time ; d
Sniffin'Man "If it cannot be done with lua, it must be you mama, coz she's too fat"
19.05.10 05:43:34 pm
Up
Flacko
User
Offline Off
Intrusion has written:
I need the number that will identify all the TT, because this class is for all TT in the same time ; d

You completely ignore what you're talking about, and I guess you didn't see my post:
http://www.unrealsoftware.de/forum_posts.php?post=120848&start=4020#post182066
Or maybe you just aren't planning reading tutorials... ever...
19.05.10 07:29:53 pm
Up
DRoNe
User
Offline Off
Code:
1
2
3
4
5
6
7
8
9
10
addhook("triggerentity","tsetpos")
function tsetpos(id,x,y)
     if x == 50 and y == 45 or x == 51 and y == 45 or x == 52 and y == 45 or x == 53 and y == 45 then
          for id = 1, game("sv_maxplayers") do
               if player(id,"team") == 1 then
                    parse ("setpos "..id.." 176 1424")
               end
          end
     end
end

Why it does not work ? I want set Terrorist to certain position, if cts walk over trigger_move.
IMG:http://img39.imageshack.us/img39/567/drnatimg.png
19.05.10 11:33:38 pm
Up
KenVo
User
Offline Off
I downloaded script CS2DTibia - RPG in: http://www.unrealsoftware.de/forum_posts.php?post=176932&start=0 and don't know how to make the monster use teleport next to who it want to kill.

Example:

IMG:http://img140.imageshack.us/img140/9104/40011462.png


I have a script teleport for monster but for running not attacking people

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
{
          name = 'Abra', health = 100, image = 'gfx/weiwen/pokemon/63.png', scalex = 2, scaley = 2, 
          atk = 0.6, def = 1.0, spd = 5, atkspd = 10, x = 0, y = 0, ang = 0, imgang = 0, spawnchance = 20, runat = 100, spawn1 = {0, 0}, spawn2 = {150, 150}, 
          exp = 10, money = 100, loot = {{chance = 5000, id = 105}},
          spc = {2500, function(self) 
               radiusmsg("Abra 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")
               end
          end},
},



Any body help me?
20.05.10 01:26:07 pm
Up
Szkieletor
User
Offline Off
I need a script that will place one of few random sprites in a place were player died. I need it for placing dead body sprites in place of someones death, best if sprite would be rotated to direction of person that died. And the sprite should disappear after one minute. Can someone help me?
To the start Previous 1 2 ... 201 202 203 ... 338 339 Next To the start