# Forum

CS2D Scripts Riot control script:request

# Riot control script:request

9 replies
Goto Page
1
10.06.12 05:11:54 pm
Avobolt
User
Offline
I've got a problem and I hope somebody has got idea how it should be.

If player1 tries to move on tile on which is player2 with Tactical shield, player1 won't move on this tile.

With this CT's would be able to make Tactical shields wall, that doesn't pass TT's.

Just like in cs 1.6.
Audiatur et altera pars
10.06.12 05:23:46 pm
EP
User
Offline
edited 1×, last 10.06.12 05:59:09 pm
10.06.12 05:34:07 pm
Alistaire
User
Offline
You could make it into a 'for' loop, skipping many unneeded copies of the same script.

Code:
1
2
3
4
5
6
7
for j = -1, 1 do
for k = -1, 1 do
if player(i, 'tilex') == x + j and player(i, 'tiley') == x + k and player(i, 'weapontype') == 41 then
walk = true
end
end
end
10.06.12 05:57:41 pm
EP
User
Offline
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
function math.pointfollow(x,y,rot,speed)
return x-math.sin(rot-3.14)*speed,y-math.cos(rot-3.14)*speed
end
function math.dist(x1,y1,x2,y2)
local xx = x2-x1
local yy = y2-y1
return math.sqrt(xx^2+yy^2)
end
function a(id,x,y)
local pls = player(0,"tableliving")
for _,i in ipairs(pls) do
if i ~= id then
if player(i,"exists") then
if math.dist(player(id,"x"),player(id,"y"),player(i,"x"),player(i,"y")) <= 32 then
if player(i,"weapontype") == 41 then
local rot = math.atan2(player(id,"x") - player(i,"x"),player(id,"y") - player(i,"y"))
parse("setpos "..id.." "..xx.." "..yy)
end
end
end
end
end
end
This one works, not perfectly but it works
10.06.12 06:04:03 pm
Avobolt
User
Offline
weeeeee, it works, you're genius

I just have got one question, but I don't want to create new thread; could somebody explain how math.sin and math.cos works and what can I do with it?
Audiatur et altera pars
10.06.12 06:05:53 pm
Alistaire
User
Offline
You know it's just Sinus and Cosinus. Learn it at school.
10.06.12 06:07:17 pm
Avobolt
User
Offline
I know what it's sinus and cosinus, but for what interesting can I use it?
Audiatur et altera pars
10.06.12 06:10:01 pm
Alistaire
User
Offline
For angles in triangles with a 90 degrees corner.
10.06.12 06:10:14 pm
EP
User
Offline
You can manipulate angles with them.
10.06.12 06:15:33 pm
Avobolt
User
Offline
Ok, I'll try it, thanks, guys
Audiatur et altera pars
1