2 registered members (AndrewAMD, alibaba),
1,184
guests, and 3
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
ladder script
#264645
05/07/09 12:16
05/07/09 12:16
|
Joined: Jul 2003
Posts: 893 Melbourne, Australia
Matt_Coles
OP
User
|
OP
User
Joined: Jul 2003
Posts: 893
Melbourne, Australia
|
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 Code: #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
|
|
|
Re: ladder script
[Re: Matt_Coles]
#264655
05/07/09 12:42
05/07/09 12:42
|
Joined: Aug 2008
Posts: 2,838 take me down to the paradise c...
Cowabanga
Expert
|
Expert
Joined: Aug 2008
Posts: 2,838
take me down to the paradise c...
|
Untested: #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);
}
|
|
|
Re: ladder script
[Re: Matt_Coles]
#264702
05/07/09 15:50
05/07/09 15:50
|
Joined: Oct 2007
Posts: 5,210 İstanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
|
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
action ladder()
{
my.emask = ENABLE_IMPACT;
my.event = ladder_event;
set(my,POLYGON);
c_setminmax(me);
}
3333333333
|
|
|
Re: ladder script
[Re: Quad]
#264738
05/07/09 20:48
05/07/09 20:48
|
Joined: May 2008
Posts: 331 Lithuania, Vilnius
Jaxas
Senior Member
|
Senior Member
Joined: May 2008
Posts: 331
Lithuania, Vilnius
|
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..
The smaller the bug, the harder it is to kill. _________________________________________ Forklift DEMO (3dgs)
|
|
|
|