Forum

> > CS2D > Scripts > [Tibia]Monster error
Forums overviewCS2D overview Scripts overviewLog in to reply

English [Tibia]Monster error

2 replies
To the start Previous 1 Next To the start

old [Tibia]Monster error

NeverLast
User Off Offline

Quote
What is wrong?
The fail monster:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{
		name = 'Eurex', health = 1000, image = 'gfx/weiwen/pokemon/144.png', scalex = 2, scaley = 2, 
		atk = 64.0, def = 32.0, spd = 7.5, atkspd = 10, x = 0, y = 0, ang = 0, imgang = 0, spawnchance = 12.5, runat = 0, spawn1 = {209, 122}, spawn2 = {200, 135}, 
		exp = 3200, money = 8000, loot = {{chance=500,id=360},{chance=500,id=361},{chance=500,id=362},{chance=500,id=363},{chance=500,id=364}}, 
			spc = {1000, function(self) 
			if not self.harden then
				radiusmsg("©255000000Eurex uses harden!", self.x, self.y)
				parse("effect \"colorsmoke\" " .. self.x .. " " .. self.y .. " 5 5 192 192 192")
				radiussound("weapons/g_flash.wav", self.x, self.y)
				self.def = 40.0
				self.harden = true
				imagecolor(self.image, 155, 155, 255)
				addtimer(5000, function(self)
					self.def = 32.0
					imagecolor(self.image, 255, 255, 255)
					self.harden = nil
				end, self)
			end
		end},
	},
The error:
1
LUA ERROR: sys/lua/cs2dtibia/monsters.lua:169: bad argument #2 to 'random' (interval is empty)
The line:
1
tilex, tiley = math.random(m.spawn1[1], m.spawn2[1]), math.random(m.spawn1[2], m.spawn2[2])

old Re: [Tibia]Monster error

MikuAuahDark
User Off Offline

Quote
Interval is empty > first parameter is bigger than second parameter.

1
2
3
4
5
math.random(from,to)

if from>to then
-- error, interval is empty
end

Please check and debug the values
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview