Forum

> > CS2D > Scripts > Lua Roofs*
Forums overviewCS2D overview Scripts overviewLog in to reply

English Lua Roofs*

14 replies
To the start Previous 1 Next To the start

old Lua Roofs*

Bobakrome
User Off Offline

Quote
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...
edited 3×, last 13.02.12 02:11:31 pm

old Re: Lua Roofs*

AbAeterno
User Off Offline

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

EDIT:Unless you want that.

old Re: Lua Roofs*

Alistaire
User Off Offline

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

old Re: Lua Roofs*

EngiN33R
Moderator Off Offline

Quote
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

old Re: Lua Roofs*

Bobakrome
User Off Offline

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

old Re: Lua Roofs*

EngiN33R
Moderator Off Offline

Quote
user Bobakrome has written
If player is in zone x;y to x2;y2 then
1
2
trigger Roof1
trigger Roof1B

user EngiN33R has written
-I did that-

user Bobakrome has written
That is exactly that i dont wanna!


Please do, because your explanations make no sense.

old Re: Lua Roofs*

sCy
User Off Offline

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

old Re: Lua Roofs*

Yates
Reviewer Off Offline

Quote
user sCy has written
I think he wants roof what is invisible to ONLY the players in the area...

IMPOSSIBRU!!11!!1!1!!

old Re: Lua Roofs*

Apache uwu
User Off Offline

Quote
Yeah then you need to use lua.

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

old Re: Lua Roofs*

TimeQuesT
User Off Offline

Quote
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*
edited 1×, last 14.02.12 02:24:28 pm

old Re: Lua Roofs*

Apache uwu
User Off Offline

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

seems fine, not tested but the idea is there

old Re: Lua Roofs*

DannyDeth
User Off Offline

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