Posted By: joh
climbing - 12/15/09 13:19
how am i going to run this one so i could try if it works?
function ladder_event()
{
if(you)
{
if(you == player)
{
my.enable_impact = off; //prevent the event to be triggered again and again during climbing
vec_set(my.skill21,player.x); //store the players position
vec_set(my.skill24,player.pan); //store its angles
while(1)
{
proc_late();
vec_set(player.x,my.skill21); //place it at the stored position to prevent the normal movement
// vec_set(player.pan,my.skill24); //enable this to disable the player from turning during climbing
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
action ladder()
{
my.enable_impact = on;
my.event = ladder_event;
my.polygon = on;
c_setminmax(me);
}
function ladder_event()
{
if(you)
{
if(you == player)
{
my.enable_impact = off; //prevent the event to be triggered again and again during climbing
vec_set(my.skill21,player.x); //store the players position
vec_set(my.skill24,player.pan); //store its angles
while(1)
{
proc_late();
vec_set(player.x,my.skill21); //place it at the stored position to prevent the normal movement
// vec_set(player.pan,my.skill24); //enable this to disable the player from turning during climbing
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
action ladder()
{
my.enable_impact = on;
my.event = ladder_event;
my.polygon = on;
c_setminmax(me);
}