Forum

> > CS2D > General > Jumping Idea
ForenübersichtCS2D-ÜbersichtGeneral-ÜbersichtEinloggen, um zu antworten

Englisch Jumping Idea

30 Antworten
Seite
Zum Anfang Vorherige 1 2 Nächste Zum Anfang

alt Re: Jumping Idea

archmage
User Off Offline

Zitieren
This is simple. It will not detect walls or obstacles.

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
addhook("serveraction", "action");

parse("bind \"space\" \"serveraction1\"");


player_move = function (id, mx, my)
if ( not (type(id) == 'number' and type(mx) == 'number' and type(my) == 'number') ) then
	error("in call to player_move(number, number, number) received player_move("..type(id)..", "..type(mx)..", "..type(my)..")");
end

parse("setpos "..id.." "..player(id,"x")+mx.." "..player(id,"y")+my);
end

Jump = function(id, modifier)
if ( not (type(id) == 'number' and type(modifier) == 'number')) then
	error("in call to Jump(number, number) received Jump("..type(id)..", "..type(modifier)..")");
end

player_move(id, math.sin(math.rad(player(id, "rot")))*modifier, -math.cos(math.rad(player(id,"rot")))*modifier);

end

function action(id, a)
	if ( a == 1 ) then
		Jump(id, 65);
	end
end

alt Re: Jumping Idea

Jaso
BANNED Off Offline

Zitieren
@Dark Byte
Thanks i will try. But you cant make that it detect walls?

alt Re: Jumping Idea

archmage
User Off Offline

Zitieren
Yes of course I could. I just did not want to lol. I will sometime. Atm I am doing something.

alt Re: Jumping Idea

Phenixtri
User Off Offline

Zitieren
I was thinking of making such a script for NTDs HL2D that would let you jump onto obstacle map entities & over any tiles excluding walls.

The player would be able to jump 1 tile in any direction unless jumping forward (direction player is facing) in which the distance the player jumps is determined by how fast that player is moving.

This was to work in conjunction with a sprint lua that lets you run faster for a shot amount of time kinda like in HL2.

Max forward jump range would be about 3-5 tiles depending on the players speed.

My main issue was that the lua used server command keys like DC said

I don t know how I would make a auto load program that would bind the keys to space bar for jump & shift Key for sprint. Ill figure it out eventually >>

alt Re: Jumping Idea

Surplus
User Off Offline

Zitieren
bind space "say !jump"

No serveraction requried
But you must edit the script to jump on "!jump"

alt Re: Jumping Idea

TDShuft
User Off Offline

Zitieren
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
function anglerad(angle)
	if (angle<=90) then
			angle = (angle + 360)
		end
	return math.rad(math.abs( angle + 90 ))-math.pi
end
addhook("say","jumping")
function jumping(id,text)
rot = player(id,"rot")
local angle = anglerad(rot)
local newx = player(id,"x") + math.cos(angle)* 64
local newy = player(id,"y") + math.sin(angle)* 64
local olgx = player(id,"x") + math.cos(angle)* 32
local olgy = player(id,"y") + math.sin(angle)* 32
local tx = math.floor(olgx/32)
local ty = math.floor(olgy/32)
local gx = math.floor(newx/32)
local gy = math.floor(newy/32)
if text=="!jump" then
	if tile(tx,ty,"obstacle") then
		if tile(gx,gy,"walkable") then
			parse("setpos "..id.." "..newx.." "..newy)
		end
	end
end
end
Maybe this will help .. i think ..

alt Re: Jumping Idea

archmage
User Off Offline

Zitieren
I think you should add the variables AFTER
1
if (txt == "jump" ) then
so they are not created every time someone sends a message.

alt Re: Jumping Idea

TDShuft
User Off Offline

Zitieren
Dark Byte hat geschrieben
I think you should add the variables AFTER
1
if (txt == "jump" ) then
so they are not created every time someone sends a message.

ok, Script Correction !
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
function anglerad(angle)
     if (angle<=90) then
               angle = (angle + 360)
          end
     return math.rad(math.abs( angle + 90 ))-math.pi
end
addhook("say","jumping")
function jumping(id,text)
if ( text=="!jump" ) then
rot = player(id,"rot")
local angle = anglerad(rot)
local newx = player(id,"x") + math.cos(angle)* 64
local newy = player(id,"y") + math.sin(angle)* 64
local olgx = player(id,"x") + math.cos(angle)* 32
local olgy = player(id,"y") + math.sin(angle)* 32
local tx = math.floor(olgx/32)
local ty = math.floor(olgy/32)
local gx = math.floor(newx/32)
local gy = math.floor(newy/32)
     if tile(tx,ty,"obstacle") then
          if tile(gx,gy,"walkable") then
               parse("setpos "..id.." "..newx.." "..newy)
          end
     end
end
end

alt Re: Jumping Idea

TimeQuesT
User Off Offline

Zitieren
why you changed to "!jump" instead of "jump" ? "jump" is correct and you don't need to have a "!" in front of it
bäähh

alt Re: Jumping Idea

Jaso
BANNED Off Offline

Zitieren
I tried the script so i said jump but nofing happend so how do you jump?
Zum Anfang Vorherige 1 2 Nächste Zum Anfang
Einloggen, um zu antwortenGeneral-ÜbersichtCS2D-ÜbersichtForenübersicht