Erweitertes Aufzug Script (Problem)

DjTranceFire
Hey Leute..
Hatte ja in einem anderem Thread schonmal nach Hilfe für ein paar Scripts gefragt, leider kam dabei bisher wenig rum, weshalb ich selber ein wenig rumgespielt habe.
Komplett Planlos wie ich bin, kam dabei nur die Hälfte rum, trotzdem bin ich stolz! grosses Grinsen

Code einblendenCode angehängt. Klicke hier zum Ein-/Ausblenden

code:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
363:
364:
365:
366:
367:
368:
369:
370:
371:
372:
373:
374:
375:
376:
377:
378:
379:
380:
381:
382:
383:
384:
385:
386:
387:
388:
389:
390:
391:
392:
393:
394:
395:
396:
397:
398:
399:
400:
401:
402:
403:
404:
405:
406:
407:
408:
409:
410:
411:
412:
413:
414:
415:
416:
417:
418:
419:
420:
421:
422:
423:
424:
425:
426:
427:
428:
429:
430:
431:
432:
433:
434:
435:
436:
437:
438:
439:
440:
441:
442:
443:
444:
445:
446:
447:
448:
449:
450:
451:
452:
453:
454:
455:
456:
457:
458:
459:
460:
461:
462:
463:
464:
465:
466:
467:
468:
469:
470:
471:
472:
473:
474:
475:
476:
477:
478:
479:
480:
481:
482:
483:
484:
485:
486:
487:
488:
489:
490:
491:
492:
493:
494:
495:
496:
497:
498:
499:
500:
501:
502:
503:
504:
505:
506:
507:
508:
509:
510:
511:
512:
513:
514:
515:
516:
517:
518:
519:
520:
521:
522:
523:
524:
525:
526:
527:
528:
529:
530:
531:
532:
533:
534:
535:
536:
537:
538:
539:
540:
541:
542:
543:
544:
545:
546:
547:
548:
549:
550:
551:
552:
553:
554:
555:
556:
557:
558:
559:
560:
561:
562:
563:
564:
565:
566:
567:
568:
569:
570:
571:
572:
573:
574:
575:
576:
577:
main()
{
level.eledoorDown1 = true;
level.eledoorMoving1 = false;

level.eledoorDown2 = true;
level.eledoorMoving2 = false;

level.eledoorDown3 = true;
level.eledoorMoving3 = false;

level.eledoorDown4 = true;
level.eledoorMoving4 = false;

level.eledoorDown5 = true;
level.eledoorMoving5 = false;

level.eledoorDown6 = true;
level.eledoorMoving6 = false;

level.eledoorDown7 = true;
level.eledoorMoving7 = false;

level.eledoorDown8 = true;
level.eledoorMoving8 = false;

level.eleDown1 = true;
level.eleMoving1 = false;

thread eledoor_start1();
thread eledoor_start2();
thread eledoor_start3();
thread eledoor_start4();
thread eledoor_start5();
thread eledoor_start6();
thread eledoor_start7();
thread eledoor_start8();
thread ele_start1();
}

///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
eledoor_start1()
{
eledoor1 = getentarray ("eledoortrigger1","targetname");
if ( isdefined(eledoor1) )
for (i = 0; i < eledoor1.size; i++)
eledoor1[i] thread eledoor_think1();
}

eledoor_think1()
{
while (1)
{
self waittill ("trigger");
if (!level.eledoorMoving1)
thread eledoor_move1();
}
}

eledoor_move1()
{
eledoormodel1 = getent ("eledoor1", "targetname");
level.eledoorMoving1 = true;
speed = 0.8;
height =-45;
if (level.eledoorDown1)
{
self.origin += (0,0,-10000);
eledoormodel1 playsound ("door");
eledoormodel1 movex (height, speed);
eledoormodel1 waittill ("movedone");
level.eledoorDown1 = false;
wait 3;
eledoormodel1 playsound ("door");
eledoormodel1 movex (height - (height * 2), speed);
eledoormodel1 waittill ("movedone");
wait 21.6;
eledoormodel1 playsound ("door");
eledoormodel1 movex (height, speed);
eledoormodel1 waittill ("movedone");
wait 3;
eledoormodel1 playsound ("door");
eledoormodel1 movex (height - (height * 2), speed);
eledoormodel1 waittill ("movedone");
level.eledoorDown1 = true;
self.origin += (0,0,10000);
}
else
{
eledoormodel1 playsound ("door");
eledoormodel1 movex (height - (height * 2), speed);
eledoormodel1 waittill ("movedone");
level.eledoorDown1 = true;
}
level.eledoorMoving1 = false;
}
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
eledoor_start2()
{
eledoor2 = getentarray ("eledoortrigger1","targetname");
if ( isdefined(eledoor2) )
for (i = 0; i < eledoor2.size; i++)
eledoor2[i] thread eledoor_think2();
}

eledoor_think2()
{
while (1)
{
self waittill ("trigger");
if (!level.eledoorMoving2)
thread eledoor_move2();
}
}

eledoor_move2()
{
eledoormodel2 = getent ("eledoor2", "targetname");
level.eledoorMoving2 = true;
speed = 0.8;
height =45;
if (level.eledoorDown2)
{
eledoormodel2 playsound ("door");
eledoormodel2 movex (height, speed);
eledoormodel2 waittill ("movedone");
level.eledoorDown2 = false;
wait 3;
eledoormodel2 playsound ("door");
eledoormodel2 movex (height - (height * 2), speed);
eledoormodel2 waittill ("movedone");
wait 21.6;
eledoormodel2 playsound ("door");
eledoormodel2 movex (height, speed);
eledoormodel2 waittill ("movedone");
wait 3;
eledoormodel2 playsound ("door");
eledoormodel2 movex (height - (height * 2), speed);
eledoormodel2 waittill ("movedone");
level.eledoorDown2 = true;
}
else
{
eledoormodel2 playsound ("door");
eledoormodel2 movex (height - (height * 2), speed);
eledoormodel2 waittill ("movedone");
level.eledoorDown2 = true;
}
level.eledoorMoving2 = false;
}
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
eledoor_start3()
{
eledoor3 = getentarray ("eledoortrigger1","targetname");
if ( isdefined(eledoor3) )
for (i = 0; i < eledoor3.size; i++)
eledoor3[i] thread eledoor_think3();
}

eledoor_think3()
{
while (1)
{
self waittill ("trigger");
if (!level.eledoorMoving3)
thread eledoor_move3();
}
}

eledoor_move3()
{
eledoormodel3 = getent ("eledoor3", "targetname");
level.eledoorMoving3 = true;
speed = 0.8;
height =-45;
if (level.eledoorDown3)
{
wait 12.7;
eledoormodel3 playsound ("door");
eledoormodel3 movex (height, speed);
eledoormodel3 waittill ("movedone");
level.eledoorDown3 = false;
wait 3;
eledoormodel3 playsound ("door");
eledoormodel3 movex (height - (height * 2), speed);
eledoormodel3 waittill ("movedone");
level.eledoorDown3 = true;
}
else
{
eledoormodel3 playsound ("door");
eledoormodel3 movex (height - (height * 2), speed);
eledoormodel3 waittill ("movedone");
level.eledoorDown3 = true;
}
level.eledoorMoving3 = false;
}
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
eledoor_start4()
{
eledoor4 = getentarray ("eledoortrigger1","targetname");
if ( isdefined(eledoor4) )
for (i = 0; i < eledoor4.size; i++)
eledoor4[i] thread eledoor_think4();
}

eledoor_think4()
{
while (1)
{
self waittill ("trigger");
if (!level.eledoorMoving4)
thread eledoor_move4();
}
}

eledoor_move4()
{
eledoormodel4 = getent ("eledoor4", "targetname");
level.eledoorMoving4 = true;
speed = 0.8;
height =45;
if (level.eledoorDown4)
{
wait 12.7;
eledoormodel4 playsound ("door");
eledoormodel4 movex (height, speed);
eledoormodel4 waittill ("movedone");
level.eledoorDown4 = false;
wait 3;
eledoormodel4 playsound ("door");
eledoormodel4 movex (height - (height * 2), speed);
eledoormodel4 waittill ("movedone");
level.eledoorDown4 = true;
}
else
{
eledoormodel4 playsound ("door");
eledoormodel4 movex (height - (height * 2), speed);
eledoormodel4 waittill ("movedone");
level.eledoorDown4 = true;
}
level.eledoorMoving4 = false;
}
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
eledoor_start5()
{
eledoor5 = getentarray ("eledoortrigger1","targetname");
if ( isdefined(eledoor5) )
for (i = 0; i < eledoor5.size; i++)
eledoor5[i] thread eledoor_think5();
}

eledoor_think5()
{
while (1)
{
self waittill ("trigger");
if (!level.eledoorMoving5)
thread eledoor_move5();
}
}

eledoor_move5()
{
eledoormodel5 = getent ("eledoor5", "targetname");
level.eledoorMoving5 = true;
speed = 0.8;
height =-23;
if (level.eledoorDown5)
{
eledoormodel5 playsound ("door");
eledoormodel5 movex (height, speed);
eledoormodel5 waittill ("movedone");
level.eledoorDown5 = false;
wait 3;
eledoormodel5 playsound ("door");
eledoormodel5 movex (height - (height * 2), speed);
eledoormodel5 waittill ("movedone");
eledoormodel5 movez (436,8);
eledoormodel5 waittill ("movedone");
eledoormodel5 playsound ("door");
eledoormodel5 movex (height, speed);
eledoormodel5 waittill ("movedone");
wait 3;
eledoormodel5 playsound ("door");
eledoormodel5 movex (height - (height * 2), speed);
eledoormodel5 waittill ("movedone");
wait 0.8;
eledoormodel5 movez (-436,8);
eledoormodel5 waittill ("movedone");
eledoormodel5 playsound ("door");
eledoormodel5 movex (height, speed);
eledoormodel5 waittill ("movedone");
wait 3;
eledoormodel5 playsound ("door");
eledoormodel5 movex (height - (height * 2), speed);
eledoormodel5 waittill ("movedone");
level.eledoorDown5 = true;
}
else
{
eledoormodel5 playsound ("door");
eledoormodel5 movex (height - (height * 2), speed);
eledoormodel5 waittill ("movedone");
level.eledoorDown5 = true;
}
level.eledoorMoving5 = false;
}
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
eledoor_start6()
{
eledoor6 = getentarray ("eledoortrigger1","targetname");
if ( isdefined(eledoor6) )
for (i = 0; i < eledoor6.size; i++)
eledoor6[i] thread eledoor_think6();
}

eledoor_think6()
{
while (1)
{
self waittill ("trigger");
if (!level.eledoorMoving6)
thread eledoor_move6();
}
}

eledoor_move6()
{
eledoormodel6 = getent ("eledoor6", "targetname");
level.eledoorMoving6 = true;
speed = 0.8;
height =-46;
if (level.eledoorDown6)
{
eledoormodel6 playsound ("door");
eledoormodel6 movex (height, speed);
eledoormodel6 waittill ("movedone");
level.eledoorDown6 = false;
wait 3;
eledoormodel6 playsound ("door");
eledoormodel6 movex (height - (height * 2), speed);
eledoormodel6 waittill ("movedone");
eledoormodel6 movez (436,8);
eledoormodel6 waittill ("movedone");
eledoormodel6 playsound ("door");
eledoormodel6 movex (height, speed);
eledoormodel6 waittill ("movedone");
wait 3;
eledoormodel6 playsound ("door");
eledoormodel6 movex (height - (height * 2), speed);
eledoormodel6 waittill ("movedone");
wait 0.8;
eledoormodel6 movez (-436,8);
eledoormodel6 waittill ("movedone");
eledoormodel6 playsound ("door");
eledoormodel6 movex (height, speed);
eledoormodel6 waittill ("movedone");
wait 3;
eledoormodel6 playsound ("door");
eledoormodel6 movex (height - (height * 2), speed);
eledoormodel6 waittill ("movedone");
level.eledoorDown6 = true;
}
else
{
eledoormodel6 playsound ("door");
eledoormodel6 movex (height - (height * 2), speed);
eledoormodel6 waittill ("movedone");
level.eledoorDown6 = true;
}
level.eledoorMoving6 = false;
}
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
eledoor_start7()
{
eledoor7 = getentarray ("eledoortrigger1","targetname");
if ( isdefined(eledoor7) )
for (i = 0; i < eledoor7.size; i++)
eledoor7[i] thread eledoor_think7();
}

eledoor_think7()
{
while (1)
{
self waittill ("trigger");
if (!level.eledoorMoving7)
thread eledoor_move7();
}
}

eledoor_move7()
{
eledoormodel7 = getent ("eledoor7", "targetname");
level.eledoorMoving7 = true;
speed = 0.8;
height =46;
if (level.eledoorDown7)
{
eledoormodel7 playsound ("door");
eledoormodel7 movex (height, speed);
eledoormodel7 waittill ("movedone");
level.eledoorDown7 = false;
wait 3;
eledoormodel7 playsound ("door");
eledoormodel7 movex (height - (height * 2), speed);
eledoormodel7 waittill ("movedone");
eledoormodel7 movez (436,8);
eledoormodel7 waittill ("movedone");
eledoormodel7 playsound ("door");
eledoormodel7 movex (height, speed);
eledoormodel7 waittill ("movedone");
wait 3;
eledoormodel7 playsound ("door");
eledoormodel7 movex (height - (height * 2), speed);
eledoormodel7 waittill ("movedone");
wait 0.8;
eledoormodel7 movez (-436,8);
eledoormodel7 waittill ("movedone");
eledoormodel7 playsound ("door");
eledoormodel7 movex (height, speed);
eledoormodel7 waittill ("movedone");
wait 3;
eledoormodel7 playsound ("door");
eledoormodel7 movex (height - (height * 2), speed);
eledoormodel7 waittill ("movedone");
level.eledoorDown7 = true;
}
else
{
eledoormodel7 playsound ("door");
eledoormodel7 movex (height - (height * 2), speed);
eledoormodel7 waittill ("movedone");
level.eledoorDown7 = true;
}
level.eledoorMoving7 = false;
}
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
eledoor_start8()
{
eledoor8 = getentarray ("eledoortrigger1","targetname");
if ( isdefined(eledoor8) )
for (i = 0; i < eledoor8.size; i++)
eledoor8[i] thread eledoor_think8();
}

eledoor_think8()
{
while (1)
{
self waittill ("trigger");
if (!level.eledoorMoving8)
thread eledoor_move8();
}
}

eledoor_move8()
{
eledoormodel8 = getent ("eledoor8", "targetname");
level.eledoorMoving8 = true;
speed = 0.8;
height =23;
if (level.eledoorDown8)
{
eledoormodel8 playsound ("door");
eledoormodel8 movex (height, speed);
eledoormodel8 waittill ("movedone");
level.eledoorDown8 = false;
wait 3;
eledoormodel8 playsound ("door");
eledoormodel8 movex (height - (height * 2), speed);
eledoormodel8 waittill ("movedone");
eledoormodel8 movez (436,8);
eledoormodel8 waittill ("movedone");
eledoormodel8 playsound ("door");
eledoormodel8 movex (height, speed);
eledoormodel8 waittill ("movedone");
wait 3;
eledoormodel8 playsound ("door");
eledoormodel8 movex (height - (height * 2), speed);
eledoormodel8 waittill ("movedone");
wait 0.8;
eledoormodel8 movez (-436,8);
eledoormodel8 waittill ("movedone");
eledoormodel8 playsound ("door");
eledoormodel8 movex (height, speed);
eledoormodel8 waittill ("movedone");
wait 3;
eledoormodel8 playsound ("door");
eledoormodel8 movex (height - (height * 2), speed);
eledoormodel8 waittill ("movedone");
level.eledoorDown8 = true;
}
else
{
eledoormodel8 playsound ("door");
eledoormodel8 movex (height - (height * 2), speed);
eledoormodel8 waittill ("movedone");
level.eledoorDown8 = true;
}
level.eledoorMoving8 = false;
}
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
ele_start1()
{
ele1 = getentarray ("eledoortrigger1","targetname");
if ( isdefined(ele1) )
for (i = 0; i < ele1.size; i++)
ele1[i] thread ele_think1();
}

ele_think1()
{
while (1)
{
self waittill ("trigger");
if (!level.eleMoving1)
thread ele_move1();
}
}

ele_move1()
{
elemodel1 = getent ("ele1", "targetname");
level.eleMoving1 = true;
speed = 8;
height =436;
if (level.eleDown1)
{
wait 4.7;
elemodel1 playloopsound ("elevator");
elemodel1 movez (height, speed);
elemodel1 waittill ("movedone");
level.eleDown1 = false;
elemodel1 stoploopsound();
wait 5.5;
elemodel1 playloopsound ("elevator");
elemodel1 movez (height - (height * 2), speed);
elemodel1 waittill ("movedone");
level.eleDown1 = true;
elemodel1 stoploopsound();
}
else
{
elemodel1 playloopsound ("elevator");
elemodel1 movez (height - (height * 2), speed);
elemodel1 waittill ("movedone");
level.eleDown1 = true;
elemodel1 stoploopsound();
}
level.eleMoving1 = false;
}
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////




Das Script selbst mag für alle die sich mit GSC auskennen warscheinlich kompletter Müll sein, für mich ist es aber eine menge Arbeite gewesen bis es endlich alles funktionierte! Zunge raus
Alles funktioniert soweit, leider gibt es ein paar Probleme an der ganzen Sache die mich stören. Der Aufzug hat insgesamt 8 Türen. 2 sind oben draußen, 2 sind unten draußen und 4stk. sind im Aufzug. Die Türen im Aufzug, sollen natürlich mit hoch fahren und genau da ist das Problem.
Da alles mit "wait" usw. abläuft, kommt es zu Problemen wenn man eine der Türen blockt.
Der Aufzug fährt dann los weil er seine Zeit gewartet hat, die Tür welche man geblockt hat, bleibt aber wo sie ist bis sie zugeht. Leider habe ich hier absolut keine Ahnung wie ich das Problem in den Griff bekomme. Hat hier vllt jemand eine Idee zur Lösung des Problems?

//edit:
Ich sollte vielleicht noch dazu sagen das die Türen welche mitfahren door 5-8 sind.

//edit:
Hier nochmal ein Video um genau zu zeigen wo das Problem ist.
Der erste Durchlauf läuft so wie er soll, im zweiten verursache ich den Bug welchen ich beheben will.
Unten die Glastüren sind door1 und door2,
Oben die Glastüren sind door2 und door3.
Die 4 Metalltüren im Aufzug sind door5-8
serthy
du brauchst dafür dann sowas: door waittill( "movedone" );
das für jede tür dann, in einem seperaten thread

so in etwa:

//auf 0 setzen
aufzug.doorsClosed = 0;

//für jede tür die dann aufgehen soll:

asufzug thread waitForDoor( door1 );
asufzug thread waitForDoor( door2 );
asufzug thread waitForDoor( door3 );

//
while( true )
{
aufzug waittill( "door_closed" );//warten bis sich eine tür schließt
if( aufzug.doorsClosed == 0 )//wenn keine tür sich mehr bewegt, raus aus der schleife und weiter
break;
}

weiter...

und die funktion: (self = aufzug)
waitForDoor( door )
{
self.doorsClosed++;

door waittill( "movedone" );

self.doorsClosed--;

self notify( "door_closed" );
}
DjTranceFire
Ok, jetzt bin ich verwirrt.. grosses Grinsen
Habe ja bei allen Türen ein waittill movedone, weiß nur nicht wie ich den Aufzug drauf hören lasse.. :x
Wann bist denn du mal in XFire on?