0 registered members (),
1,280
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
elevator probelm
#410093
10/27/12 21:45
10/27/12 21:45
|
Joined: Apr 2012
Posts: 106
GaniX
OP
Member
|
OP
Member
Joined: Apr 2012
Posts: 106
|
hello, me again jaja , I have the next problem: I have one elevator on the level, the elevator moves well. however when the player character is in the elevator, and Elvador starts to go up, an unwanted effect of camera is produced http://www.mediafire.com/?h50f2e3ps318ec8 link for download the program the trace mode of the players ies: IGNORE_ME + IGNORE_SPRITES + IGNORE_MODELS + USE_BOX the move of the player is:GLIDE | IGNORE_PASSABLE | IGNORE_PUSH | ACTIVATE_TRIGGER the move of elevator is:my.z=my.z+1 *time_step;alt=alt+1 . what can i do to solution this problem? thanks
|
|
|
Re: elevator probelm
[Re: GaniX]
#410796
11/08/12 22:49
11/08/12 22:49
|
Joined: Apr 2012
Posts: 106
GaniX
OP
Member
|
OP
Member
Joined: Apr 2012
Posts: 106
|
ok thats is what i did: acction elevator
action ascensor()
{
my.emask =ENABLE_IMPACT;
proc_mode=PROC_EARLY;
var senal=0;
var senal_l=1;
//if(event_type == EVENT_IMPACT)if i use this way, the elevstor is not move
//if(you==player)
senal=1;
var alt=0;
while(1){
if (senal==1){
if (senal_l==1){ move_vec[2] += alt; my.z=alt *time_step;alt=alt+1;}
if (alt>=10)
senal_l=0;
if (senal_l==0){move_vec[2] += alt;my.z=alt *time_step;alt=alt-1;}
if(alt<=-100)
senal_l=1;
}
wait(1);
move_vec2 is the player.z and the problem is continue thanks
Last edited by GaniX; 11/08/12 23:50.
|
|
|
Re: elevator probelm
[Re: GaniX]
#410924
11/10/12 20:41
11/10/12 20:41
|
Joined: Sep 2003
Posts: 6,861 Kiel (Germany)
Superku
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
|
check when the player is on the elevator (that means inside the elevator's bounding box, above it and vertically close to it) You should/ could use the quoted approach to check when the player has to be moved. Your code is a little confusing to me to be honest, so I wrote you a basic example for an elevator that starts at the bottom and moves to a higher level when the player stands on it. It is untested but it should give you an idea of what I was talking about:
//skill1: target_z 0
action elevator()
{
c_setminmax(my);
set(my,POLYGON);
if(!my.skill1) error("Elevator: Enter a target height in WED!");
my.skill2 = my.z;
my.skill3 = 1;
while(!player) wait(1);
while(1)
{
if(player.x > my.x+my.min_x && player.x < my.x+my.max_x
&& player.y > my.y+my.min_y && player.y < my.y+my.max_y
&& player.z+player.min_z > my.z+my.max_z && player.z+player.min_z < my.z+my.max_z+32) //you may have to adapt the 32 quants here
{
my.skill4 = maxv(my.skill4-time_step,0);
if(!my.skill4) my.skill5 = 1; //activate elevator
}
else my.skill4 = 16; // one second delay
if(my.skill5)
{
if(my.skill3 == 1)
{
my.skill6 = minv(my.skill1,my.z+10*time_step);
c_move(me,nullvector,vector(0,0,my.skill6-my.z),IGNORE_MODELS | IGNORE_SPRITES | IGNORE_WORLD);
if(my.skill6 >= my.skill1)
{
my.skill3 = -1;
my.skill5 = 0;
my.skill4 = 16;
}
}
else
{
my.skill6 = maxv(my.skill2,my.z-10*time_step);
c_move(me,nullvector,vector(0,0,my.skill6-my.z),IGNORE_MODELS | IGNORE_SPRITES | IGNORE_WORLD);
if(my.skill6 <= my.skill2)
{
my.skill3 = 1;
my.skill5 = 0;
my.skill4 = 16;
}
}
}
wait(1);
}
}
Be aware that I don't manipulate my.z directly but use c_move because c_move updates the collision hull of the platform automatically (whereas without this instruction the hull could be updated after the player code). Btw. try to use proc_mode = PROC_EARLY; here, too.
Last edited by Superku; 11/10/12 20:42.
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual Check out my new game: Pogostuck: Rage With Your Friends
|
|
|
Re: elevator probelm
[Re: Superku]
#411367
11/15/12 21:38
11/15/12 21:38
|
Joined: Apr 2012
Posts: 106
GaniX
OP
Member
|
OP
Member
Joined: Apr 2012
Posts: 106
|
Hello, I read your code, I'll put it into practice. I also do another code using c_scan:
player_move action () ....
if (mod == 1) move_vec [2] = (-c_trace (my.x vector (temp.x, temp.y, temp.z-1000), IGNORE_ME IGNORE_SPRITES + + + USE_BOX IGNORE_MODELS)) * 5 * time_step ;
move_vec is the z player
i use mod ==1 because when the player is on the elevator i dont use the c trace to process the z player , i change the z player directly
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / /
elevator action ()
{
var signal;
var senal_l = 1;
var alt = 0;
while (1) {
if (vec_dist (player.x, my.x) <= 2000) {
c_scan (my.x, my.pan vector (360,0,54), IGNORE_ME);
if (you == player)
sign = 1;}
if (sign == 1) {
mod = 2;
if (senal_l == 1) {my.z ​​= my.z ​​+1 * time_step; alt = alt +1; move_vec [2] = alt;}
if (alt> = 10)
senal_l = 0;
if (senal_l == 0) {my.z ​​= my.z​​-1 * time_step; alt = alt-1; move_vec [2] = alt;}
if (alt <= -10)
senal_l = 1;
}
wait (1);
}
}
this is only a test code if you can help me to make an elevator but dont use skills i really thank you ,because is this what i want
Last edited by GaniX; 11/15/12 21:41.
|
|
|
Re: elevator probelm
[Re: Superku]
#411583
11/17/12 19:35
11/17/12 19:35
|
Joined: Apr 2012
Posts: 106
GaniX
OP
Member
|
OP
Member
Joined: Apr 2012
Posts: 106
|
because for my , for a moment is too confuse use skills, but I have to get used to using them. by the way the problem of the camera and the elevator is in the code of the player as I can see ( i think is in the mode of c trace), i will studie dowload codes of players code thanks
|
|
|
|