Forum

> > CS2D > Scripts > Spawn a picture on Wall III
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Spawn a picture on Wall III

15 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Spawn a picture on Wall III

Gaios
Reviewer Off Offline

Zitieren
Once a Wall III has been built, it transforms into a custom picture.
He,
How to create a script, when I building Wall III then spawn a picture on Wall III. And when I kill Wall III, a picture disappear.
picture = a picture of the wall
2× editiert, zuletzt 31.08.12 09:58:31

alt Re: Spawn a picture on Wall III

Happy eyes
User Off Offline

Zitieren
You need a table for images like {img,tilex,tiley}. Insert image there on (wall build) and cycle though whole table until found matching tilex and tiley and remove image then (on wall destoying)

alt Re: Spawn a picture on Wall III

Happy eyes
User Off Offline

Zitieren
user Alistaire hat geschrieben
There's no function to get the coordinates in an objectkill hook. It's impossible.


Stop being pessimist, it's just funny :DD
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
buildings = {}
imagepath= "gfx/food.bmp"

addhook('build','build')
function build(id,type,x,y,mode,objectid)
	if type == 5 then
		table.insert(buildings,{image(imagepath,x*32+16,y*32+16,3),objectid})
	end
end

addhook('objectkill','objectkill')
function objectkill(id,pl)
	for n,w in pairs (buildings) do
		if w[2]+1== id then
			freeimage(w[1])
			table.remove(buildings,n)
		end
	end
end

@user Gaios: Change imagepath to fit yours.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht