Forum

> > CS2D > Scripts > Spawn NPC for tile
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Spawn NPC for tile

5 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Spawn NPC for tile

TheVillager
User Off Offline

Zitieren
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

alt Re: Spawn NPC for tile

Cebra
User Off Offline

Zitieren
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
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht