Author Topic: Probleme des ascenseurs  (Read 531 times)

imip

  • Bleusaille
  • Posts: 16
Probleme des ascenseurs
« on: May 18, 2008, 06:12:40 PM »
Salut a tous !

Jme remets au mapping, mais cete fois ci avec des choses plus evoluees (enfin, a mon echelle^^). Bon, donc, j'ai rajoute 2 ascenseurs, sur un forum anglais j'ai lu qu'il fallait un gsc pour chaque ascensuer donc au final 2...tout marche, mais le probleme c'est que je peux pas faire monter les 2 ascenseurs en meme temps, c'est a dire que s'il y en a un en haut, le 2eme ne montera pas, au contraire, il ira sous la map, donc ca fait un peu tache....bon, et une fois sous la map, impossible de refaire descendre le 1er, il montera donc...Bref, c'est un peu le bazard au bout de 10 min de jeu...

Ci-joint, mes 2 scripts :

Le 1er

Code: [Select]
main() {
level.elevatorDown = true; // elevator starts at bottom: true/false
level.elevatorMoving = false; // elevator is not currently moving
thread elevator_start();
}

elevator_start() {
elevator = getentarray ("elevatorswitch","targetname");
if ( isdefined(elevator) )
for (i = 0; i < elevator.size; i++)
elevator[i] thread elevator_think();
}

elevator_think() {
while (1) {
self waittill ("trigger");
if (!level.elevatorMoving)
thread elevator_move();
}
}

elevator_move() {
elevatormodel = getent ("elevatormodel", "targetname");
level.elevatorMoving = true;
speed = 2;
height = 870;
wait (1);
if (level.elevatorDown) { // moves to top
elevatormodel playsound ("elevator1"); // sound definition for soundaliases.csv
wait (1); // wait a second to hear the motor start and then start the movement of the lift - feels more realistic
elevatormodel moveZ (height, speed);
elevatormodel waittill ("movedone");
level.elevatorDown = false;
}
else { // moves to bottom
elevatormodel playsound ("elevator1"); // sound definition for soundaliases.csv
wait (1); // wait a second to hear the motor start and then start the movement of the lift - feels more realistic
elevatormodel moveZ (-870,5,2,2);
elevatormodel waittill ("movedone");
level.elevatorDown = true;
}
level.elevatorMoving = false;
}

puis le 2nd :

Code: [Select]
main() {
level.elevatorDown = true; // elevator starts at bottom: true/false
level.elevatorMoving = false; // elevator is not currently moving
thread elevator_start();
}

elevator_start() {
elevator = getentarray ("elevatorswitch2","targetname");
if ( isdefined(elevator) )
for (i = 0; i < elevator.size; i++)
elevator[i] thread elevator_think();
}

elevator_think() {
while (1) {
self waittill ("trigger");
if (!level.elevatorMoving)
thread elevator_move();
}
}

elevator_move() {
elevatormodel = getent ("elevatormodel2", "targetname");
level.elevatorMoving = true;
speed = 2;
height = 735;
wait (1);
if (level.elevatorDown) { // moves to top
elevatormodel playsound ("elevator1"); // sound definition for soundaliases.csv
wait (1); // wait a second to hear the motor start and then start the movement of the lift - feels more realistic
elevatormodel moveZ (height, speed);
elevatormodel waittill ("movedone");
level.elevatorDown = false;
}
else { // moves to bottom
elevatormodel playsound ("elevator1"); // sound definition for soundaliases.csv
wait (1); // wait a second to hear the motor start and then start the movement of the lift - feels more realistic
elevatormodel moveZ (-735,5,2,2);
elevatormodel waittill ("movedone");
level.elevatorDown = true;
}
level.elevatorMoving = false;
}

Vous l'aurez compris, je pense qu'il faut fusionner les 2 scripts, mais aucune idee de comment faire pour que chacun aille a une altitude differente....

Voila, merci

A+
Im!P
« Last Edit: May 21, 2008, 08:41:51 PM by raf »