Forum

> > CS2D > Scripts > Lua Roofs*
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Lua Roofs*

14 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Lua Roofs*

Bobakrome
User Off Offline

Zitieren
Spoiler >


Don`t read this...
Go down..
-------------------------------------

If player is in zone x;y to x2;y2 then

1
2
trigger Roof1
trigger Roof1B

then if leaves... the same...
3× editiert, zuletzt 13.02.12 14:11:31

alt Re: Lua Roofs*

AbAeterno
User Off Offline

Zitieren
That way every player will see the roof transparency when someone walks over a tile

EDIT:Unless you want that.

alt Re: Lua Roofs*

Alistaire
User Off Offline

Zitieren
Can't be done with env_sprite in the editor. Only possible with Lua but would take a lot of other ways to walk than you normally would.

alt Re: Lua Roofs*

EngiN33R
Moderator Off Offline

Zitieren
Well, as @user AbAeterno said, that way, everyone will see the transparency of the roof. But, if you insist,

1
2
3
4
5
6
7
8
9
10
11
zones = {{1,1,2,2}} -- {x start, y start, x end, y end}

addhook("movetile","triggerroof")
function triggerroof(id,x,y)
	for i=1,#zones do
		if (x>=zones[i][1] and x<=zones[i][3] and y>=zones[i][2] and y<=zones[i][4]) then
			parse("trigger Roof1")
			parse("trigger Roof1B")
		end
	end
end

alt Re: Lua Roofs*

Bobakrome
User Off Offline

Zitieren
And if i want to add more? I want add houses and look realistic...

--NP, leave it off
--Don`t close this. I just test that now -.-

Nop that is not what i want u did the same thing like in map editor.

That is exactly that i dont wanna!

If player is in ZONE 1,1 - 4,4 THEN...

Triggers in map:

Roof1
Roof1B
"ENV_START" With trigger "Roof1B"

...
I will make a vid to see..

alt Re: Lua Roofs*

EngiN33R
Moderator Off Offline

Zitieren
user Bobakrome hat geschrieben
If player is in zone x;y to x2;y2 then
1
2
trigger Roof1
trigger Roof1B

user EngiN33R hat geschrieben
-I did that-

user Bobakrome hat geschrieben
That is exactly that i dont wanna!


Please do, because your explanations make no sense.

alt Re: Lua Roofs*

sCy
User Off Offline

Zitieren
I think he wants roof what is invisible to ONLY the players in the area...

alt Re: Lua Roofs*

Yates
Reviewer Off Offline

Zitieren
user sCy hat geschrieben
I think he wants roof what is invisible to ONLY the players in the area...

IMPOSSIBRU!!11!!1!1!!

alt Re: Lua Roofs*

Apache uwu
User Off Offline

Zitieren
Yeah then you need to use lua.

cs2d lua cmd image does have an optional parameter (pl) that controls who can see the image.

alt Re: Lua Roofs*

TimeQuesT
User Off Offline

Zitieren
Not Tested and hardcoded.
Justchange some variables from the start of the code.

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
26
27
28
29
iImgHandle = {};
iXZone = 10; --posx here![start]
iYZone = 10; --posy here![start]
iXZoneRange = 5; --width
iYZoneRange = 3; --height


cPath = "Put your image path in here!";


addhook ("startround","vSetUpImages");
addhook ("movetile","vCheck");

function vSetUpImages()
for i=1,32 do
iImgHandle = image(path,iXZone*32,iYZone*32,1,i);
end
end

function vCheck(id,x,y)

if ((x>=iXZone) and (x<=(iXZone+iXZoneRange)) and (y>=iYZone) and (y<=(iYZone+iYZoneRange)))
imagealpha(iImgHandle[id],0.6);
else
imagealpha(iImgHandle[id],1.0);
end
end
--inital call vSetUpImages (Deathmatch)
vSetUpImages();

This code allows you to place ONE image which will get transparent if a player enters a specific area. (transparents is only for the entering player).

edit:
Oha. I forgott to add an "end".
*fixed*
1× editiert, zuletzt 14.02.12 14:24:28

alt Re: Lua Roofs*

Apache uwu
User Off Offline

Zitieren
You don't need semicolons (or brackets either)

seems fine, not tested but the idea is there

alt Re: Lua Roofs*

DannyDeth
User Off Offline

Zitieren
user Apache uwu hat geschrieben
You don't need semicolons (or brackets either

That's just his coding style. In fact, i for one love brackets and semi-colons. They make things easier to read.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht