Forum

> > CS2D > Scripts > How can I make a 5x5 area? (Finish)
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch How can I make a 5x5 area? (Finish)

5 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt How can I make a 5x5 area? (Finish)

Bowlinghead
User Off Offline

Zitieren
Hello,
Here is my Question:
Im making a Script but I need help.
I want if I am IN a 5x5 area then I get health.
I know, its going with the map editor. But I need it to make it with lua.
I am failing on that so I need help.
Its working, but only in this area:
Mehr >



Here is my 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
30
31
addhook("move","move")
function move(id,x,y)
	local x=10
	local y=16
	if player(id,"tilex")+0==x and player(id,"tiley")+0==y
	or player(id,"tilex")+1==x and player(id,"tiley")+1==y
	or player(id,"tilex")+2==x and player(id,"tiley")+1==y
	or player(id,"tilex")+3==x and player(id,"tiley")+1==y
	
	or player(id,"tilex")+1==x and player(id,"tiley")+1==y
	or player(id,"tilex")+1==x and player(id,"tiley")+2==y
	or player(id,"tilex")+1==x and player(id,"tiley")+3==y
	or player(id,"tilex")+1==x and player(id,"tiley")+0==y
	
	or player(id,"tilex")+2==x and player(id,"tiley")+2==y
	or player(id,"tilex")+2==x and player(id,"tiley")+3==y
	or player(id,"tilex")+2==x and player(id,"tiley")+0==y
	
	or player(id,"tilex")+3==x and player(id,"tiley")+0==y
	or player(id,"tilex")+3==x and player(id,"tiley")+2==y
	or player(id,"tilex")+3==x and player(id,"tiley")+3==y
	
	or player(id,"tilex")+3==x and player(id,"tiley")+0==y
	or player(id,"tilex")+2==x and player(id,"tiley")+2==y
	or player(id,"tilex")+3==x and player(id,"tiley")+2==y
	
	or player(id,"tilex")+2==x and player(id,"tiley")+3==y
	or player(id,"tilex")+3==x and player(id,"tiley")+3==y then
		parse("sethealth "..id.." "..player(id,"health")+1)
	end
end


I know it now! Thanks for reading! I have to put "-1" and so on too! I noob
1× editiert, zuletzt 25.08.11 23:01:24

alt Re: How can I make a 5x5 area? (Finish)

Apache uwu
User Off Offline

Zitieren
Ah okay here.

box_heal={starting X,starting Y,how big is the box}


1
2
3
4
5
6
7
8
9
10
addhook("movetile","_movetile")

box_heal={10,16,5} --{x,y,size}


function _movetile(id,x,y)
	if x>=box_heal[1] and x<=box_heal[1]+box_heal[3] and y>=box_heal[2] and y<=box_heal[2]+box_heal[3] then
		parse("sethealth "..id.." "..player(id,"health")+1)
	end
end

alt Re: How can I make a 5x5 area? (Finish)

Bowlinghead
User Off Offline

Zitieren
>.< Do you wanna make me like that: ??

You need 7 lines of code, and I need ~100 >.<

Here is my Script:
Mehr >



-----

Can I use your solution? I think its better

alt Re: How can I make a 5x5 area? (Finish)

Apache uwu
User Off Offline

Zitieren
Well you said you want a specific spot on the map to automatically heal players when they move over it.

So you just need to specify the location of the starting tilex,tiley and how big the locations are.

gl with the script--efficiency>function
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht