Forum

> > CS2D > Scripts > How can I make a 5x5 area? (Finish)
Forums overviewCS2D overview Scripts overviewLog in to reply

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

5 replies
To the start Previous 1 Next To the start

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

Bowlinghead
User Off Offline

Quote
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:
More >



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
edited 1×, last 25.08.11 11:01:24 pm

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

Apache uwu
User Off Offline

Quote
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

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

Bowlinghead
User Off Offline

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

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

Here is my Script:
More >



-----

Can I use your solution? I think its better

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

Apache uwu
User Off Offline

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