Forum

> > CS2D > Scripts > Spawn a picture on Wall III
Forums overviewCS2D overview Scripts overviewLog in to reply

English Spawn a picture on Wall III

15 replies
To the start Previous 1 Next To the start

old Spawn a picture on Wall III

Gaios
Reviewer Off Offline

Quote
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
edited 2×, last 31.08.12 09:58:31 am

old Re: Spawn a picture on Wall III

Happy eyes
User Off Offline

Quote
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)

old Re: Spawn a picture on Wall III

Happy eyes
User Off Offline

Quote
user Alistaire has written
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.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview