Forum

> > CS2D > Scripts > Spawn NPC for tile
Forums overviewCS2D overview Scripts overviewLog in to reply

English Spawn NPC for tile

5 replies
To the start Previous 1 Next To the start

old Spawn NPC for tile

TheVillager
User Off Offline

Quote
I want spawn zombie only if tile frame #1.
Please help

1
2
3
4
5
function second_hook()

parse("spawnnpc 1 "..math.random(zombix1,zombix2).." "..math.random(zombiy1,zombiy2).."")

end

old Re: Spawn NPC for tile

Cebra
User Off Offline

Quote
you can fetch the map size with the cs2d lua cmd map and the tile frame with cs2d lua cmd tile.

something like this:
1
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
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview