Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (Ayumi), 1,177 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Grabbing Edges -- Help Needed [Re: 3run] #332165
07/07/10 20:55
07/07/10 20:55
Joined: Jul 2010
Posts: 129
B
bk9iq Offline OP
Member
bk9iq  Offline OP
Member
B

Joined: Jul 2010
Posts: 129
Thanks I will be waiting laugh

Re: Grabbing Edges -- Help Needed [Re: bk9iq] #332183
07/07/10 21:37
07/07/10 21:37
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
I've translated the main parts, but I need to pull all this together, to make a playable demo wink This is first time when I handle such staff laugh So, any help will be grateful.
Code:
////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////

VECTOR ladder_x;
VECTOR player_diff;
VECTOR temp;

////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////

var movement_mode = 0;
var player_feet_height = 32; //the distance from the origin to the feet of the player 
var z_force = 0; 
var jump_z;

////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////

#define animdist skill20

////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////

function detect_edge()
{
	my.animdist = 0; 
	if (movement_mode == 0)
	{
		vec_set(temp,my.x); //scan in front of player to see if there is a climbable wall 
		temp.x += 30 * cos(my.pan); 
		temp.y += 30 * sin(my.pan); 
		temp.z = my.z; 
		result = c_trace(my.x,temp,IGNORE_ME|IGNORE_SPRITES|IGNORE_MODELS|SCAN_TEXTURE); 
		vec_set(temp,my.x); 
		temp.z -= 4000; // calculate a position 4000 quants below the player 
		// set a trace mode for using the player's hull, and detecting map entities and level surfaces only 
		result = c_trace(my.x,temp,IGNORE_ME|IGNORE_SPRITES|IGNORE_MODELS|USE_BOX);// subtract vertical distance to ground 
		if (result <= 3)
		{
			// in the air? 
			if ((result < 1.3) && (result > -1.3) && (result > 0.5) && (result < -0.5))
			{
				//change the value 1.5 to change how high steps he can climb, make it no higher than 3 
				my.skill13 = 0; 
			} 
			vec_set(temp,my.x); 
			temp.z -= 4000; // calculate a position 4000 quants below the player 
			result = c_trace(my.x,temp,IGNORE_ME|IGNORE_SPRITES|IGNORE_MODELS|USE_BOX);
			// subtract vertical distance to ground 
			z_force = -1 * result; 
		}
		else
		{
			if ((result <= 3) && (my.animdist > 20))
			{
				if ((result < 1.3) && (result > -1.3) && (result > 0.5) && (result < -0.5))
				{
					//change the value 1.5 to change how high steps he can climb, make it no higher than 3 
					my.skill13 = 0; 
				} 
				vec_set(temp,my.x); 
				temp.z -= 4000; // calculate a position 4000 quants below the player 
				result = c_trace(my.x,temp,IGNORE_ME|IGNORE_SPRITES|IGNORE_MODELS|USE_BOX);// subtract vertical distance to ground 
				z_force = -1 * result; 
			}
		} 
		if ((key_w == 1) || (key_s == 1) || (key_d == 1) || (key_a == 1))
		{
			if (key_shift == 0) 
			{
				ent_animate(my,"run",my.animdist,ANM_CYCLE); 
				my.animdist += 10 * time_step; 
			}
			else
			{
				ent_animate(my,"walk",my.animdist,ANM_CYCLE); 
				my.animdist += 9 * time_step; 
			} 
		} 
		else
		{
			ent_animate(my,"stand",my.animdist,ANM_CYCLE); 
			my.animdist += 3 * time_step; 
		} 
		my.skill13 = 0.5*z_force + maxv(1-0.5*0.7,0)*my.skill13; // calculate vertical speed, replace 0.3 with time to convert to the old equation 
		jump_z = time_step * my.skill13; // distance down 
		player_diff.z = jump_z; 
		c_move(my,player_diff, nullvector,IGNORE_PASSABLE|GLIDE); 
		//center_check(); 
		//update_views(); 
	} 
	if (movement_mode == 2) 
	{
		//pulling yourself up onto a ledge 
		my.z += 5 * time_step; 
		player_diff.x = 1; 
		player_diff.y = 0; 
		player_diff.z = 0; 
		c_move(my,player_diff.x,nullvector,IGNORE_PASSABLE|GLIDE); 
		vec_set(temp,my.x); //scan in front of player to see if there is a climbable wall 
		temp.x += 30 * cos(my.pan); 
		temp.y += 30 * sin(my.pan); 
		temp.z = my.z - player_feet_height; //set the value 32 to the distance to the models feet 
		if(c_trace(my.x,temp,IGNORE_ME|IGNORE_SPRITES|IGNORE_MODELS) == 0) 
		{
			movement_mode = 3; 
			vec_set(ladder_x.x,my.x); 
		} 
		ent_animate(my,"walk",my.animdist,ANM_CYCLE); // edge climb animation here 
		my.animdist += 9 * time_step; // 9 is climbing speed
		//center_check(); 
		//update_views(); 
	}
	if (movement_mode == 3) 
	{
		//moving a little bit forward so that player doesn't fall down 
		player_diff.x = 3 * time_step; 
		player_diff.y = 0; 
		vec_set(temp,my.x); 
		temp.z -= 4000; // calculate a position 4000 quants below the player 
		// set a trace mode for using the player's hull, and detecting map entities and level surfaces only 
		result = c_trace(my.x,temp,IGNORE_ME|IGNORE_SPRITES|IGNORE_MODELS|USE_BOX);// subtract vertical distance to ground 
		player_diff.z = 0; 
		if (result < 4) { player_diff.z = -0.2 * result; } 
		if(vec_dist(my.x,ladder_x.x) > 7) 
		{
			vec_set(temp,my.x); 
			temp.z -= 4000; // calculate a position 4000 quants below the player 
			// set a trace mode for using the player's hull, and detecting map entities and level surfaces only 
			result = c_trace(my.x,temp,IGNORE_ME|IGNORE_SPRITES|IGNORE_MODELS|USE_BOX);// subtract vertical distance to ground 
			if (result < 4) { player_diff.z = -1 * result; } 
		}
		else
		{
			player_diff.z = 0; 
		} 
		c_move(my,player_diff, nullvector, IGNORE_PASSABLE|GLIDE); 
		if(vec_dist(my.x,ladder_x.x) > 15) 
		{
			movement_mode = 0; 
			player_diff.z = 0; 
			//z_force = 0; 
			my.skill13 = 0; 
		} 
		ent_animate(my,"walk",my.animdist,ANM_CYCLE); 
		my.animdist += 9 * time_step; 
		//center_check(); 
		//update_views(); 
	}
}




Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Grabbing Edges -- Help Needed [Re: 3run] #332185
07/07/10 21:41
07/07/10 21:41
Joined: Jul 2010
Posts: 129
B
bk9iq Offline OP
Member
bk9iq  Offline OP
Member
B

Joined: Jul 2010
Posts: 129
I will try to help and do my best (( I am newbie frown )) ,,,, Forget about the animation for now... I will try to read the code that u posted...

Re: Grabbing Edges -- Help Needed [Re: bk9iq] #332186
07/07/10 21:43
07/07/10 21:43
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
We are making a good job together bro wink Try to learn as much from it, as you can. There are a lot of things for me to learn too wink


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Grabbing Edges -- Help Needed [Re: 3run] #332187
07/07/10 21:47
07/07/10 21:47
Joined: Jul 2010
Posts: 129
B
bk9iq Offline OP
Member
bk9iq  Offline OP
Member
B

Joined: Jul 2010
Posts: 129
Thanks bro... yeah I am trying to figure out as many things as I can from this (impossible) puzzle laugh

Re: Grabbing Edges -- Help Needed [Re: bk9iq] #332190
07/07/10 22:43
07/07/10 22:43
Joined: Jul 2010
Posts: 129
B
bk9iq Offline OP
Member
bk9iq  Offline OP
Member
B

Joined: Jul 2010
Posts: 129
I don't get it at all ... I think it is better to add something like a small bar model over the edge that we want our player to be able to grab and attach it to an action that is close to that you used in your stairs level for stairs .. Isn't that possible??


Last edited by bk9iq; 07/07/10 22:44.
Re: Grabbing Edges -- Help Needed [Re: bk9iq] #332191
07/07/10 23:03
07/07/10 23:03
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Never give up! wink Here is a simple 3rd person demo:

Download link
I'll add climbing to this wink Learn this script now, it's very easy wink PM me if any questions.
Keys:

WSAD - for movement;
Mouse - camera movement;
Mouse scroll - for zooming in and out;
SPACE - jump;


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Grabbing Edges -- Help Needed [Re: 3run] #332192
07/07/10 23:20
07/07/10 23:20
Joined: Jul 2010
Posts: 129
B
bk9iq Offline OP
Member
bk9iq  Offline OP
Member
B

Joined: Jul 2010
Posts: 129
Hehhehe Thanks ... I wrote a very simple 3rd person but it is definitely incomparable... I think urs is great coz I already read ur ladder code and it was almost 90% comprehensible for me laugh
Thanks again

BTW :: Change (var jump_time = 1;) at the beginning of the code to (var jump_time = 0;) so that the character does not jump when u start the level wink

Last edited by bk9iq; 07/07/10 23:26.
Page 2 of 2 1 2

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1