Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
Forums overviewCS2D overview Scripts overviewLog in to reply

English Lua Scripts/Questions/Help

6,770 replies
Page
To the start Previous 1 2201 202 203338 339 Next To the start

old Re: Lua Scripts/Questions/Help

gabpro
User Off Offline

Quote
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

old Re: Lua Scripts/Questions/Help

Lee
Moderator Off Offline

Quote
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.

old Re: Lua Scripts/Questions/Help

archmage
User Off Offline

Quote
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.
1
2
-- For strings you need to use one of these: ",',[[ ]]
Terrorist == "TT"

II. The other way.
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

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
DRoNe has written
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
1
2
3
4
5("hello")
-------------
a = 3
a(4,"asd",{})

old Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Quote
Can you fix this 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

old Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Quote
i just removed one wrong whole usebutton hook.

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)

old Re: Lua Scripts/Questions/Help

Sudden Death
User Off Offline

Quote
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

old Re: Lua Scripts/Questions/Help

KenVo
User Off Offline

Quote
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:https://img140.imageshack.us/img140/9104/40011462.png


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

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},
},

old Re: Lua Scripts/Questions/Help

SkullFace
User Off Offline

Quote
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

old Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Quote
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

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
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

old Re: Lua Scripts/Questions/Help

archmage
User Off Offline

Quote
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.

old Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Quote
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.

old Re: Lua Scripts/Questions/Help

KenVo
User Off Offline

Quote
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:https://img140.imageshack.us/img140/9104/40011462.png


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

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?

old Re: Lua Scripts/Questions/Help

Szkieletor
User Off Offline

Quote
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 2201 202 203338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview