Spawn NPC for tile
5 replies



11.06.19 12:09:40 am
I want spawn zombie only if tile frame #1.
Please help
Please help

Code:
1
2
3
4
5
2
3
4
5
function second_hook()
parse("spawnnpc 1 "..math.random(zombix1,zombix2).." "..math.random(zombiy1,zombiy2).."")
end
parse("spawnnpc 1 "..math.random(zombix1,zombix2).." "..math.random(zombiy1,zombiy2).."")
end
Loop through every tile on the map and check if it's frame is #1.
It's hard being the best girl in the whole entire world
you can fetch the map size with the
map and the tile frame with
tile.
something like this:


something like this:
Code:
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
function second_hook()
for x=0, map("xsize") do
for y=0, map("ysize") do
if tile(x,y,"frame")==1 then
parse("spawnnpc 1 "..math.random(zombix1,zombix2).." "..math.random(zombiy1,zombiy2).."")
end
end
end
end
for x=0, map("xsize") do
for y=0, map("ysize") do
if tile(x,y,"frame")==1 then
parse("spawnnpc 1 "..math.random(zombix1,zombix2).." "..math.random(zombiy1,zombiy2).."")
end
end
end
end
loading...
@
Cebra: Thank you bro!





