ladder script

Posted By: Matt_Coles

ladder script - 05/07/09 12:16

trying to convert a ladder for lite c. I know it's in c script, not much of a programmer but I'm trying to convert slinn's one from aum. could someo programming genius help? I can't work out why the engine errors when event_impact is called frown

Code:
Quote:

#include <acknex.h> // include for Pure Mode
#include <default.c> // default key functions

function ladder_event()
{
if(you)
{
if(you == player)
{
my.ENABLE_IMPACT = off;
vec_set(my.skill21,player.x);
vec_set(my.skill24,player.pan);

while(1)
{
proc_late();
vec_set(player.x,my.skill21);
vec_set(player.pan,my.skill24);
my.skill30 = c_move(player,nullvector,vector(0,0,(key_w-key_s)*my.skill1*time_step),ignore_passable|ignore_passents|glide); //move the player up or down
if((key_s && my.skill30 < 0.1) || (key_w && (player.z+player.min_z) > (my.z+my.max_z+player.max_z))) //if the ground or the end of the ladder is reached,
{
break; //stop the loop
}

vec_set(my.skill21,player.x); //stores the new position

wait(1);
}

wait(-0.1); //prevent the player from triggering the event again and again when leaving the ladder
my.enable_impact = on; //make the ladder again sensible for the player
}
}
}

//skill1: ClimpSpeed 10
ENTITY* ladder =
{
my.enable_impact = on;
my.event = ladder_event;

my.polygon = on;

c_setminmax(me);
}

void main()
{
video_mode = 9;
video_depth = 32;
video_screen = 1;
//d3d_antialias = 4;
//d3d_automaterial = 2;
fps_max = 35;
wait(1);
}



thanks in advance - mattcoles
Posted By: Cowabanga

Re: ladder script - 05/07/09 12:42

Untested:

Click to reveal.. (The Code)
Code:
#include <acknex.h> // include for Pure Mode
#include <default.c> // default key functions

function ladder_event()
{
	if(you)
	{
		if(you == player)
		{
			my.emask = NULL;
			vec_set(my.skill21,player.x); 
			vec_set(my.skill24,player.pan); 
		}
		while(1)
		{
			proc_mode = PROC_LATE;
			vec_set(player.x,my.skill21);
			vec_set(player.pan,my.skill24); 
			my.skill30 = c_move(player,nullvector,vector(0,0,(key_w-key_s)*my.skill1*time_step),IGNORE_PASSABLE|IGNORE_PASSENTS|GLIDE); //move the player up or down
			if((key_s && my.skill30 < 0.1) || (key_w && (player.z+player.min_z) > (my.z+my.max_z+player.max_z))) //if the ground or the end of the ladder is reached,
			{
				break; //stop the loop
			}
			vec_set(my.skill21,player.x); //stores the new position
			wait(1);

			wait(-0.1); //prevent the player from triggering the event again and again when leaving the ladder
			my.emask = ENABLE_IMPACT; //make the ladder again sensible for the player
		}
	}
}

//skill1: ClimpSpeed 10
ENTITY* ladder = 
{
	my.emask = ENABLE_IMPACT;
	my.event = ladder_event;
	set(my,POLYGON);
	c_setminmax(me);
}

void main()
{
	video_mode = 9;
	video_depth = 32;
	video_screen = 1;
	//d3d_antialias = 4;
	//d3d_automaterial = 2;
	fps_max = 35;
	wait(1);
}

Posted By: Matt_Coles

Re: ladder script - 05/07/09 14:28

Thanks for the try, still errors on my.emask = enable_impact frown
Posted By: Quad

Re: ladder script - 05/07/09 15:09

ENABLE_IMPACT has to be uppercase.
Posted By: Matt_Coles

Re: ladder script - 05/07/09 15:21

it is in uppercase in the code. On my iPhone responding as I don't have net at the moment where I am with the laptop hence why I didn't captialize, pain to type on lol.
Anyone got any ideas on how to get this working? It'd be greatly appreciated
Posted By: Quad

Re: ladder script - 05/07/09 15:50

Code:
ENTITY* ladder = 
{
	my.emask = ENABLE_IMPACT;
	my.event = ladder_event;
	set(my,POLYGON);
	c_setminmax(me);
}


what do you exactly want to at this part, i guess what you mean was

Code:
action ladder()
{
	my.emask = ENABLE_IMPACT;
	my.event = ladder_event;
	set(my,POLYGON);
	c_setminmax(me);
}

Posted By: Jaxas

Re: ladder script - 05/07/09 20:48

that code looks to difficult, and useless..there's way to write a shorter, simpler code for that..(my opinion). I know, Matt_Coles ask to translate it to Lite-C, but does that really need for us? sorry if off topic..
Posted By: Matt_Coles

Re: ladder script - 05/07/09 22:59

thanks soo much for the help cowabanga and quadraxas. I will credit you in my small projects ladder code and if you need any help with any small bit of art don't hesitate to yell out and i'll give a hand

@Jaxas - i know a little c script but cause I'm no programmer I have not delved into lite-c yet at all so i greatly appreciate people with coding abilities and i do lend my artistic hand to them sometimes. That's why i need help with this sort of code

thanks again

mattcoles
Posted By: Cowabanga

Re: ladder script - 05/08/09 08:17

Anytime smile
© 2024 lite-C Forums