Forum

> > CS2D > Scripts > Hats from Tiles?
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Hats from Tiles?

7 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Hats from Tiles?

Rygna
User Off Offline

Zitieren
Hi!,

Can you help me?, Make Tiles for Your Hats?
i mean, Your Cursor placed on some tiles, then you press cs2d lua hook serveraction, and you get Hats from that Tiles.

Thanks!.
Sorry for my English.

alt Re: Hats from Tiles?

Rainoth
Moderator Off Offline

Zitieren
I do recall making that in file cs2d FunField 2D as a means of hiding but it can't hide you completely because for one you have to make the tile bigger to cover you completely (cuz weapons and knife aren't covered by standard tile size) and then you'd probably want to get stealth suit to further hide you, not to mention that it's visible that a spot on a tile is different. With enough practice it works though.

What you want is to use cs2d lua cmd image and
IMG:https://sc-cdn.scaleengine.net/i/c0f80be2e21c74fdfc152898a5cf8a213.png

alt Re: Hats from Tiles?

Rygna
User Off Offline

Zitieren
Nope, i mean, Hide & Seek and not with Sprites. but use Tiles for Prop. just like Sprites Replacements?

alt Re: Hats from Tiles?

Rainoth
Moderator Off Offline

Zitieren
oh well then
you do sth like
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
hats = {
{x = 35,y = 88,path = "image path"},
{x = 35,y = 89,path = "image path"},
{x = 35,y = 90,path = "image path"}
}

addhook("serveraction","_sa")
function _sa(id,b)
	if b == 1 then
		reqcld(id,2)
	end
end

addhook("clientdata","_cd")
function _cd(id,mode,x,y)
	if mode == 2 then
		local tx = math.floor(x/32)
		local ty = math.floor(x/32)
		for _,v in pairs (hats) do
			if v.x == tx and v.y = ty then
				image(v.path,mode etc. fill this part in)
			end
		end
	end
end

Doesn't handle freeing images when u want to change hats tho. Work it our urself.

alt Re: Hats from Tiles?

GeoB99
Moderator Off Offline

Zitieren
@user Rainoth: Your script will bug on 18 and 20 line. The local variable ty should have Y position axis as its variable and not X...
1
local ty = math.floor(y/32)
This is how it should be. And in 20 line, you assigned v.y to ty instead of equal comparison. Anyways, I'm fairly sure the author knows how to fix that himself.

alt Re: Hats from Tiles?

Rainoth
Moderator Off Offline

Zitieren
Ye I'm a tad confused with all that I have to do in uni right now...

@user Rygna: The image moves if you assign the positions in your 'image' call or if you call 'imagepos' function. Otherwise it won't move.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht