Forum

> > CS2D > Scripts > What is wrong with this script?
Forums overviewCS2D overview Scripts overviewLog in to reply

English What is wrong with this script?

6 replies
To the start Previous 1 Next To the start

old What is wrong with this script?

Jaso
BANNED Off Offline

Quote
the script gives me this error:
LUA ERROR: sys/lua/nazi_zombies.lua:59: 'end' expected (to close 'if' at line 11) near

Here is the script:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
round = 1
npcs = 2

addhook("startround","round1")
function round1()
     msg("©255000000Round "..round)
     npcs=(round*3)-round
     local xr=math.random(0,map("xsize"))
     local yr=math.random(0,map("ysize"))
     for i=1,npcs do
          if (tile(xr,yr,"property")~=1 and tile(xr,yr,"property")~=1 and tile(xr,yr,"property")~=2 and tile(xr,yr,"property")~=3 and tile(xr,yr,"property")~=4 and tile(xr,yr,"property")~=50 and tile(xr,yr,"property")~=51 and tile(xr,yr,"property")~=52 and tile(xr,yr,"property")~=53) then
               parse("spawnnpc 1 "..xr.." "..yr.." 0")
          else
ound = 1
npcs = 2

addhook("startround","round1")
function round1()
     msg("©255000000Round "..round)
     npcs=(round*3)-round
     local xr=math.random(0,map("xsize"))
     local yr=math.random(0,map("ysize"))
     for i=1,npcs do
          if (tile(xr,yr,"property")~=1 and tile(xr,yr,"property")~=1 and tile(xr,yr,"property")~=2 and tile(xr,yr,"property")~=3 and tile(xr,yr,"property")~=4 and tile(xr,yr,"property")~=50 and tile(xr,yr,"property")~=51 and tile(xr,yr,"property")~=52 and tile(xr,yr,"property")~=53) then
               parse("spawnnpc 1 "..xr.." "..yr.." 0")
          else
               parse("spawnnpc 1 "..xr.." "..yr.." 0")
          end
     end
end

addhook("objectkill","npckill")
function npckill(obj,id)
     if (object(obj,"type")==30) then
          if (npcs>1) then
               npcs=npcs-1
          else
               npcs=0
               timer(30000,"parse","lua changeround()")
          end
     end
end

function changeround()
     round=round+1
     msg("©255000000Round "..round)
     npcs=(round*3)-round
     for n=1,npcs do
          local xr=1,map("xsize")
          local yr=1,map("ysize")
          if (tile(xr,yr,"property")~=1 and tile(xr,yr,"property")~=1 and tile(xr,yr,"property")~=2 and tile(xr,yr,"property")~=3 and tile(xr,yr,"property")~=4 and tile(xr,yr,"property")~=50 and tile(xr,yr,"property")~=51 and tile(xr,yr,"property")~=52 and tile(xr,yr,"property")~=53) then
               parse("spawnnpc 1 "..xr.." "..yr.." 0")
          else
               local xr=1,map("xsize")
               local yr=1,map("ysize")
               parse("spawnnpc 1 "..xr.." "..yr.." 0")
     end
end
end

So what is wrong with it?

old Re: What is wrong with this script?

DC
Admin Off Offline

Quote
it looks like it has not been copy&pasted correctly or whatever. it says "round" at the beginning but later you see "ound".

one or more ends are obviously missing after the "ound = 1" and "npcs = 2" lines.

old Re: What is wrong with this script?

TimeQuesT
User Off Offline

Quote
you forgott the "ends" in this function:
1
2
3
4
5
6
7
8
9
10
11
function round1()
msg("©255000000Round "..round)
npcs=(round*3)-round
local xr=math.random(0,map("xsize"))
local yr=math.random(0,map("ysize"))
for i=1,npcs do
if (tile(xr,yr,"property")~=1 and tile(xr,yr,"property")~=1 and tile(xr,yr,"property")~=2 and tile(xr,yr,"property")~=3 and tile(xr,yr,"property")~=4 and tile(xr,yr,"property")~=50 and tile(xr,yr,"property")~=51 and tile(xr,yr,"property")~=52 and tile(xr,yr,"property")~=53) then
parse("spawnnpc 1 "..xr.." "..yr.." 0")
else
ound = 1
npcs = 2

right:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
function round1()
msg("©255000000Round "..round)
npcs=(round*3)-round
local xr=math.random(0,map("xsize"))
local yr=math.random(0,map("ysize"))
for i=1,npcs do
if (tile(xr,yr,"property")~=1 and tile(xr,yr,"property")~=1 and tile(xr,yr,"property")~=2 and tile(xr,yr,"property")~=3 and tile(xr,yr,"property")~=4 and tile(xr,yr,"property")~=50 and tile(xr,yr,"property")~=51 and tile(xr,yr,"property")~=52 and tile(xr,yr,"property")~=53) then
parse("spawnnpc 1 "..xr.." "..yr.." 0")
else
ound = 1
npcs = 2
end
end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview