// Tutorial-Mission: gaaaanz vorsichtig den Leuten das Fliegen beibringen

// Blabla ausgeben
LadeBild "Mission/Bild00_1"
ZeigeText 1
Einblenden
WarteTaste
Ausblenden

LadeRaumer 76   // Tutorial-Spielerraumer ohne Standardwaffe
LadeRaumer 77   // Tutorialdrohne
LadeRaumer RebelFighter2
LadeRaumer RebelFighter3

// Mission laden
StartMission 0
// Ich glaub nich, da jemals jemand stirbt in dieser Mission
NewShip 105, 76, , 0, 1, WirTot
SetVar RS_Schatten( 0), 10

// Steuerung retten
SetVar Z, RS_Steuerung( 0)
// und den Spieler willig schalten
ChgCtrl 0, DummSchlumpf
// und reinkommen lassen
ChgAim 0, , 94

SpieleMusik "Musik/Story6"

Wait 50
Text 213, 50, 4
Wait 60
Text 213, 50, 5
Wait 70

Text 1, 50, 6, 0
Wait 90

Text 213, 50, 7
Wait 60
Text 213, 50, 8
Wait 30
ChgCtrl 0, Patrol
Wait 50

Text 1, 50, 9, 0
Wait 80

Text 213, 50, 10
Wait 60
Text 213, 50, 11
Wait 90

Text 213, 50, 12
Wait 60
Text 213, 50, 13
Wait 80

Text 213, 50, 14
Wait 60
Text 213, 100, 15
Wait 110
Text 213, 50, 16
Wait 60
Text 213, 50, 87
Wait 30
HelpMenu
Wait 80

Text 213, 50, 17
Wait 80
Text 1, 50, 18, 0
Wait 80
Text 213, 50, 19

Wait 30
// Blinken lassen und Steuerung zurcksetzen
NeuObjekt RS_PosX( 0), RS_PosY(0), 0, 0, 389, TranspAdd
SetVar RS_Steuerung(0), Z
// Spielerposition retten
SetVar A, RS_PosX( 0)
SetVar B, RS_PosY( 0)

Wait 60
Text 213, 50, 20
Wait 60
Text 213, 50, 21
Wait 100

Text 213, 50, 22
Wait 60
Text 213, 50, 23
Wait 60
Text 213, 50, 24
Wait 90

// hat er sich seitdem nennenswert bewegt?
Sub A, RS_PosX( 0)
Div A, 256
Mul A, A
Sub B, RS_PosY( 0)
Div B, 256
Mul B, B

Add A, B

if(A < 400) {
  // wenn nich, zutexten
  Text 213, 50, 25
  Wait 60
  Text 213, 50, 26
  Wait 90
  Text 213, 50, 27
  Wait 80
  }

// Ziel erklren
Text 213, 50, 28
Wait 60
Text 213, 50, 29

// Zhler initialisieren
SetVar A, 0
Dauerpfeil 62720, 109824
SetMarke ErstesZiel

Wait 10
Add A, 1
NeuObjekt 62720, 109824, 0, 0, GrauKreis, TranspAdd

// "los jetzt" sagen
if(A = 4) {
  Text 213, 50, 30
  }

// Nhe zur Zielpos ausrechnen
SetVar X, RS_PosX( 0)
Sub X, 62720
Div X, 256
Mul X, X

SetVar Y, RS_PosY( 0)
Sub Y, 109824
Div Y, 256
Mul Y, Y

Add X, Y

// zu weit weg -> weiterwarten
if(X > 400) { Goto ErstesZiel }

// Wir sind da -> Wieder Steuerung totschalten
NeuObjekt RS_PosX( 0), RS_PosY(0), 0, 0, 389, TranspAdd
NewShip , 83, , 0, 1, WirTot
Dauerpfeil

Wait 20
Text 213, 50, 32
Wait 60
Text 213, 50, 33
Wait 30

SetVar A, 0  // Zeitzhler
SetVar B, 0  // -1 fr warten, sonst rundennummer
SetVar C, 1  // aktuell anzusteuernder Punkt
SetVar X, 21248  // Position dieses Punktes
SetVar Y, 101376

SetMarke Runde

Wait 1
Add A, 1

// Evtl. texten
if(A = 30) {
  Text 213, 50, 34
  }

if(A = 75) {
  Text 213, 50, 35
  SpieleMusik "Musik/Story1"
  }

if(A = 135) {
  Text 213, 50, 36
  }

if(A = 180) {
  Text 213, 50, 37
  NewShip , 76, , 0, 1, WirTot
  NeuObjekt RS_PosX(0), RS_PosY(0), 0, 0, 389, TranspAdd
  SetVar B, 0
  }

// welcher Kreis soll grade angezeigt werden?
if(A < 180) {
  // whrend Vorbereitungszeit den ganzen Kurs blinken lassen
  SetVar D, A
  SetVar E, D
  Div E, 12
  Mul E, 12
  Sub D, E
  }

// whrend des eigentlichen Rennens nur nchsten Punkt anzeigen
if(A > 179) {
  SetVar D, A
  Div D, 7
  Mul D, 7
  if(D ! A) {
    Goto Noe
    }

  SetVar D, C
  }

if(D = 0) { NeuObjekt 62720, 109824, 0, 0, GrauKreis, TranspAdd }
if(D = 1) { NeuObjekt 21248, 101376, 0, 0, GrauKreis, TranspAdd }
if(D = 2) { NeuObjekt 25600, 68352, 0, 0, GrauKreis, TranspAdd }
if(D = 3) { NeuObjekt 44800, 55296, 0, 0, GrauKreis, TranspAdd }
if(D = 4) { NeuObjekt 71168, 61696, 0, 0, GrauKreis, TranspAdd }
if(D = 5) { NeuObjekt 93440, 83200, 0, 0, GrauKreis, TranspAdd }
if(D = 6) { NeuObjekt 98000, 109824, 0, 0, GrauKreis, TranspAdd }
if(D = 7) { NeuObjekt 119808, 127488, 0, 0, GrauKreis, TranspAdd }
if(D = 8) { NeuObjekt 117248, 176640, 0, 0, GrauKreis, TranspAdd }
if(D = 9) { NeuObjekt 74752, 162304, 0, 0, GrauKreis, TranspAdd }
if(D = 10) { NeuObjekt 81920, 139008, 0, 0, GrauKreis, TranspAdd }
if(D = 11) { NeuObjekt 80128, 115712, 0, 0, GrauKreis, TranspAdd }

SetMarke Noe

// auf aktuellen Checkpoint vergleichen
if(B > -1) {
  SetVar I, RS_PosX( 0)
  Sub I, X
  Div I, 256
  Mul I, I

  SetVar J, RS_PosY( 0)
  Sub J, Y
  Div J, 256
  Mul J, J

  Add I, J

  // nah genug am Punkt
  if(I < 1000) {
    // aktuellen aufblitzen lassen
    NeuObjekt X, Y, 0, 0, 389, TranspAdd

    // nchsten Punkt anwhlen
    Add C, 1
    if( C>11) { SetVar C, 0 }

    if(C = 0) {
      SetVar X, 62720
      SetVar Y, 109824
      Add B, 1
      Text 213, 50, 43, , B
      }

    if(C = 0) { SetVar X, 62720  SetVar Y, 109824 }
    if(C = 1) { SetVar X, 21248  SetVar Y, 101376 }
    if(C = 2) { SetVar X, 25600  SetVar Y, 68352 }
    if(C = 3) { SetVar X, 44800  SetVar Y, 55296 }
    if(C = 4) { SetVar X, 71168  SetVar Y, 61696 }
    if(C = 5) { SetVar X, 93440  SetVar Y, 83200 }
    if(C = 6) { SetVar X, 95744  SetVar Y, 109824 }
    if(C = 7) { SetVar X, 119808  SetVar Y, 127488 }
    if(C = 8) { SetVar X, 117248  SetVar Y, 176640 }
    if(C = 9) { SetVar X, 74752  SetVar Y, 162304 }
    if(C = 10) { SetVar X, 81920  SetVar Y, 139008 }
    if(C = 11) { SetVar X, 80128  SetVar Y, 115712 }

    // neue Stelle auch gleich markieren
    NeuObjekt X, Y, 0, 0, GrauKreis, TranspAdd
    }
  }

// solange weiterzhlen, bis zwei Runden geschafft sind
if(B < 2) { Goto Runde }

NeuObjekt RS_PosX( 0), RS_PosY(0), 0, 0, 389, TranspAdd
SetVar RS_Steuerung( 0), Computer1
SpieleMusik "Musik/Story6"

Wait 70

// Zeit ausrechnen
Sub A, 180
Div A, 10

// und je nach Zeit labern
if( A<35) {
  Text 213, 50, 38, , A
  Goto LaberFertig
  }
if( A<40) {
  Text 213, 50, 39, , A
  Goto LaberFertig
  }
if( A<45) {
  Text 213, 50, 40, , A
  Goto LaberFertig
  }
if( A<50) {
  Text 213, 50, 41, , A
  Goto LaberFertig
  }

Text 213, 50, 42, , A

SetMarke LaberFertig

// jetzt gehts zum Ballern
Wait 90
Text 213, 50, 44
Wait 60
Text 213, 50, 45
Wait 30
NeuObjekt RS_PosX(0), RS_PosY(0), 0, 0, 389, TranspAdd
AddWaffe 0, 1

Wait 30
Text 213, 50, 46
Wait 60
Text 213, 50, 47

Wait 20

// Anzahl Drohnen
SetVar C, 0

// zehn Drohnen erzeugen
SetMarke GenDrohne1
SetVar A, C
Add A, 104
SetVar B, C
Add B, 10

NewShip A, 77, Patrol, B, 2, DrohneTot
SetVar RS_Schatten( B), 10
Add C, 1
Wait 2
if(C < 10) { Goto GenDrohne1 }

// Warten, bis alle abgeschossen sind
SetVar RS_Steuerung( 0), Z
NeuObjekt RS_PosX(0), RS_PosY(0), 0, 0, 389, TranspAdd

Wait 20
Text 213, 50, 48

SetMarke DrohnenEins

Wait 10
if(C > 0) { Goto DrohnenEins }

// Waffenblabla loswerden
Text 1, 50, 50, 0
Wait 80

Text 213, 60, 51
Wait 70
Text 213, 50, 52
Wait 40

// drei Packen Raketen geben
NeuObjekt RS_PosX(0), RS_PosY( 0), 0, 0, 389, TranspAdd
AddWaffe 0, 3   AddWaffe 0, 3  AddWaffe 0, 3

Wait 20

// zehn neue Drohnen generieren
SetVar C, 0

SetMarke GenDrohne2
SetVar A, C
Add A, 104
SetVar B, C
Add B, 10

NewShip A, 77, Patrol, B, 2, DrohneTot
SetVar RS_Schatten( B), 10
Add C, 1
Wait 2
if(C < 10) { Goto GenDrohne2 }

Text 213, 50, 53

// und diese schlachten lassen
SetMarke DrohnenZwei

Wait 10
if(C > 0) { Goto DrohnenZwei }

// Steuerung wieder totschalten
SetVar RS_Steuerung( 0), Computer1
NeuObjekt RS_PosX(0), RS_PosY(0), 0, 0, 389, TranspAdd

// finales Metzelgelaber
Text 1, 30, 54, 0
Wait 60
Text 213, 50, 55
Wait 60
Text 213, 50, 56
Wait 80

// Versteckgelaber
Text 213, 50, 57
Wait 60
Text 213, 50, 58
Wait 70

SetVar RS_Steuerung( 0), Z
NeuObjekt RS_PosX(0), RS_PosY(0), 0, 0, 389, TranspAdd

SetVar C, -1   // Anzahl bereits vergeigter Versuche
SetVar A, 0   // vergangene Zeit

// ab hier geht die Sucherei los
SetMarke VersteckSpiel

Add C, 1

if(C = 0) {
  // erster Versuch -> Leute generieren
  Text 213, 50, 59
  Dauerpfeil 93440, 139008

  Wait 20

  // Sucher reinkommen lassen
  NewShip 110, RebelFighter2, DummSchlumpf, 10, 2
  SetVar RS_Schatten( 10), 9
  ChgCtrl 10, DummSchlumpf, , Treffer
  ChgAim 10, , 60

  NewShip 110, RebelFighter3, DummSchlumpf, 11, 2
  SetVar RS_Schatten( 11), 8
  Add RS_PosY( 11), 7000
  ChgCtrl 11, DummSchlumpf, , Treffer
  ChgAim 11, , 102
  }

// nach evtl. Fehlern zurckkommandieren
if(C > 0) {
  Text 213, 50, 64
  ChgCtrl 10, DummSchlumpf, , Treffer
  ChgAim 10, , 60
  ChgCtrl 11, Dummschlumpf, , Treffer
  ChgAim 11, , 102
  }

// Warten bis alle auf ihren Pltzen sind
SetVar E, 0
SetVar F, 0
SetVar G, 0
SetMarke VersteckInit

NeuObjekt 93440, 139008, 0, 0, GrauKreis, TranspAdd
Wait 20

SetVar X, RS_PosX( 0)
Sub X, 93440
Div X, 256
Mul X, X

SetVar Y, RS_PosY( 0)
Sub Y, 139008
Div Y, 256
Mul Y, Y

Add X, Y

if(X < 400) { SetVar E, 1 }
if(RS_NaherLP( 10) = 60) { SetVar F, 1 }
if(RS_NaherLP( 11) = 102) { SetVar G, 1 }

if(E = 0) { Goto VersteckInit }
if(F = 0) { Goto VersteckInit }
if(G = 0) { Goto VersteckInit }

Dauerpfeil

// Zwischenaktionen
if(C = 0) {
  // beim ersten Mal Sucher vorstellen und blinken lassen
  Text 213, 60, 60
  Wait 20
  NeuObjekt RS_PosX( 10), RS_PosY( 10), 0, 0, GrauKreis, TranspAdd
  Wait 10
  NeuObjekt RS_PosX( 11), RS_PosY( 11), 0, 0, GrauKreis, TranspAdd
  }

// beim zweiten Mal etwas deutlicher werden
if(C = 1) {
  Text 213, 50, 65
  }

// beim dritten Mal Ordnungsgong
if(C = 2) {
  Text 213, 50, 66
  }

Wait 20
// Sucher auf Patrouille schicken
ChgCtrl 10, Patrol, Sicht, Treffer
ChgCtrl 11, Patrol, Sicht, Treffer

if(C=0) {
  SpieleMusik "Musik/Story2"
  }

// Entdeckt-Flag nullen
SetVar D, 0
// Zeit zurcksetzen
SetVar A, 0

// ab jetzt luft die Zeit
SetMarke VersteckDreh

Add A, 1
Wait 10

// erster Versuch -> nhere Erluterungen
if(C = 0) {
  if(A = 2) {
    Text 213, 50, 61
    }

  if(A = 9) {
    Text 213, 50, 62
    }
  }

// solange kreisen bis entdeckt oder Zeit vorrber
if(D = 0) {
  if(A < 120) {
    Goto VersteckDreh
    }
  }

// wurde der Spieler entdeckt?
if(D = 1) {
  // beim ersten Mal Simpelspruch
  if(C = 0) {
    Text 240, 50, 63
    Wait 70
    Goto VersteckSpiel
    }

  // beim zweiten Mal deutlicher werden
  if(C = 1) {
    Text 213, 50, 67
    Wait 70
    Goto VersteckSpiel
    }

  // beim dritten Mal abbrechen
  if(C = 2) {
    Text 213, 50, 68
    Wait 70
    Text 213, 60, 69
    Wait 70
    Text 213, 50, 70
    Wait 80
    }
  }

if(D = 2) {
  // Abbruch durch Beschuss... gaaanz finster
  Text 213, 50, 73
  Wait 70
  Goto VersteckSpiel
  }

if(D = 0) {
  // nicht entdeckt wurden -> Lob
  Text 213, 60, 71
  ChgCtrl 10, Computer1, , Treffer
  ChgCtrl 11, Computer1, , Treffer
  Wait 80
  }

SpieleMusik "Musik/Story6"

// die Sucher zurckbeordern
Text 213, 50, 72
Wait 40

ChgCtrl 10, DummSchlumpf, , Treffer
ChgAim 10, , 110
ChgCtrl 11, DummSchlumpf, , Treffer
ChgAim 11, , 110

Wait 60

Text 213, 50, 74

// warten, bis sie zurck sind
SetVar A, 2
SetVar B, 0

SetMarke SuchDreh
Wait 5
Add B, 1

if(RS_NaherLP( 10) = 110) {
  SetVar RS_Team( 10), 0
  Sub A, 1
  }
if(RS_NaherLP( 11) = 110) {
  SetVar RS_Team( 11), 0
  Sub A, 1
  }

// Texten derweil
if(B = 12) {
  Text 213, 50, 75
  }

if(B = 24) {
  Text 213, 50, 76
  }

if(B = 36) {
  Text 213, 50, 77
  }

// Waffen geben
if(B = 50) {
  Text 213, 50, 78

  // alte Waffen rauswerfen
  NewShip , Transporter1, , 0, 1, WirTot
  NewShip , 76, , 0, 1, WirTot

  // neue Waffen geben
  AddWaffe 0, 1
  AddWaffe 0, 17  AddWaffe 0, 17
  AddWaffe 0, 3  AddWaffe 0, 3

  // blinken
  NeuObjekt RS_PosX(0), RS_PosY( 0), 0, 0, 389, TranspAdd
  }

if(B = 62) {
  Text 213, 50, 79
  }

if(A > 0) { Goto SuchDreh }
if(B < 62) { Goto SuchDreh }

// Text vergehen lassen
Wait 30
NewShip 110, RebelBomber3, DummSchlumpf, 10, 2
SetVar RS_Schatten( 10), 10
ChgAim 10, , 60
AddWaffe 10, 7 AddWaffe 10, 7
AddWaffe 10, 16 AddWaffe 10, 16

SpieleMusik "Musik/Story3"

Wait 40
// Fight!
Text 213, 50, 80, 10
ChgCtrl 10, Computer5

// warten, bis einer knapp an Energie ist
SetVar A, 0
SetVar C, 0
SetMarke KampfDreh

Wait 2
Add A, 1

if(RS_Energie( 0) < 40) {
  Text 213, 50, 82, 10
  SetVar C, 1
  }

if( RS_Energie( 10) < 40) {
  Text 213, 50, 81, 10
  SetVar C, 2
  }

if(C = 0) { Goto KampfDreh }

// Waffen wegnehmen
NeuObjekt RS_PosX(0), RS_PosY( 0), 0, 0, 389, TranspAdd
SetVar RS_Steuerung( 0), Computer1

// Gegner stillschalten
ChgCtrl 10, Computer1
SetVar RS_Team( 10), 1

Wait 80
Text 213, 50, 83, 10
Wait 60
Text 213, 50, 84, 10
Wait 80
Text 1, 50, 85, 0
Wait 30
ZeigeInfo MSuccess
Wait 30
EndMission 8
Wait 100

Ende


// ************ Interupts **********
SetMarke DrohneTot

Sub C, 1
if(C = 5) {
  Text 1, 50, 49, 0
  }
Return

// Die Suchenden haben den Spieler entdeckt
SetMarke Sicht
SetVar D, 1
ChgCtrl 10, Computer1, , Treffer
ChgCtrl 11, Computer1, , Treffer

// Sichtlinie markieren
SetVar I, RS_PosX( A)
SetVar K, RS_PosX( B)
Sub K, I
Div K, 20

SetVar J, RS_PosY( A)
SetVar L, RS_PosY( B)
Sub L, J
Div L, 20

SetVar M, 0
SetMarke MarkDreh

Add I, K
Add J, L

NeuObjekt I, J, 0, 0, GrossRauch, TranspAdd
Add M, 1

if(M < 19) { Goto MarkDreh }

Return

// Ein Suchender wurde beschossen
SetMarke Treffer
if(RS_Steuerung( 10) = Patrol) {
  SetVar D, 2
  ChgCtrl 10, Computer1
  ChgCtrl 11, Computer1
  }

// Waffen wegnehmen
NewShip , Transporter1, , 0, 1, WirTot
NewShip , 76, , 0, 1, WirTot

Return


// falls es tatschlich jemals einer schafft
SetMarke WirTot
EndMission -1
Ende

