Jump to content

Bernt

Members
  • Posts

    759
  • Joined

  • Last visited

  • Days Won

    11

Posts posted by Bernt

  1. Hello Scripters,

    I have a problem with this script, this script call the nearst car on the map.

    But i can only use this one time at the same point.

    If i want a second car on the emergency, then must i call this one on the another side of the map...

    //Version 1.2 //
    //Frei verwendbar, solang diese Kommentare erhalten bleiben //
    //und per PN oder E-Mail eine schriftliche Erlaubniss vorliegt //
    //Version 1.0 //
    //©Gerrit & Bernt van Dongen //

    const char IMG_ICON[] = "A1";
    const char IMG_CURSOR[] = "send";

    object Alarmambu : CommandScript
    {

    Alarmambu()
    {
    SetIcon(IMG_ICON);
    SetCursor(IMG_CURSOR);
    SetValidTargets(ACTOR_FLOOR | ACTOR_STREET);
    }

    bool CheckPossible(GameObject *Caller)
    {
    return true;
    }

    bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
    {
    Person p(Caller);

    if (!Game::IsFreeplay())
    return false;

    if (Caller->GetID() == Target->GetID())
    return false;

    return true;
    }

    void PushActions(GameObject *Caller, Actor *Target, int ChildID)
    {
    VehicleList vl_rtw1("ambu");
    VehicleList vl_rtw2("ambu2");
    VehicleList vl_rtw3("ambu3");

    Vehicle v_rtw1 = vl_rtw1.GetVehicle(0);
    Vehicle v_rtw2 = vl_rtw2.GetVehicle(0);
    Vehicle v_rtw3 = vl_rtw3.GetVehicle(0);

    Vector v_est = Game::GetCommandPos();

    float f_est_x = v_est.x; //x, y und z der EST
    float f_est_y = v_est.y;
    float f_est_z = v_est.z;

    float f_rtw1d = v_rtw1.Distance(f_est_x, f_est_y, f_est_z); //distanzen jeden NEFs zur EST
    float f_rtw2d = v_rtw2.Distance(f_est_x, f_est_y, f_est_z);
    float f_rtw3d = v_rtw3.Distance(f_est_x, f_est_y, f_est_z);

    if(v_rtw1.HasCommand("ich_bin_nicht_frei")) //Wenn ich nicht frei bin bin ich gaaaanz weit weg
    f_rtw1d = 99999.9;

    if(v_rtw2.HasCommand("ich_bin_nicht_frei"))
    f_rtw2d = 99999.9;

    if(v_rtw3.HasCommand("ich_bin_nicht_frei"))
    f_rtw3d = 99999.7;


    if(f_rtw1d < f_rtw2d && f_rtw1d < f_rtw3d)
    Game::ExecuteCommand("PCmdFPAlarmambu",Caller,Target);

    if(f_rtw2d < f_rtw1d && f_rtw2d < f_rtw3d)
    Game::ExecuteCommand("PCmdFPAlarmambu2",Caller,Target);

    if(f_rtw3d < f_rtw1d && f_rtw3d < f_rtw2d)
    Game::ExecuteCommand("PCmdFPAlarmambu3",Caller,Target);
    }
    };

    //////////////////////////////////////////////////////////////////////////////////////////////////////////
    // A-Rescue Mod - Freeplay Alarm RTW1 - Script v1.7 //
    // ************************************************ //
    // //
    // 1.0| PCmdFPAlarmRTW1 //
    // //
    // _____________________ //
    // Skript frei fuer alle //
    //////////////////////////////////////////////////////////////////////////////////////////////////////////


    const char IMG_ICON[] = "heal";
    const char IMG_CURSOR[] = "send";

    const char COMMANDABLE_TRUE[] = "DUMMYSetCommandableTrue";
    const char COMMANDABLE_FALSE[] = "DUMMYSetCommandableFalse";

    const char FREEFORALERT_TRUE[] = "DUMMYFPSetFreeForAlertTrue";
    const char FREEFORALERT_FALSE[] = "DUMMYFPSetFreeForAlertFalse";
    const char FREEFORALERT[] = "DUMMYFPIsFreeForAlert";

    const char INBASE_TRUE[] = "DUMMYFPSetInBaseTrue";
    const char INBASE_FALSE[] = "DUMMYFPSetInBaseFalse";
    const char INBASE[] = "DUMMYFPIsInBase";

    // 1.0
    object PCmdFPAlarmambu : CommandScript
    {

    PCmdFPAlarmambu()
    {
    SetIcon(IMG_ICON);
    SetCursor(IMG_CURSOR);
    SetValidTargets(ACTOR_FLOOR | ACTOR_STREET);
    }

    bool CheckPossible(GameObject *Caller)
    {
    GameObjectList ol;
    GameObject *o;
    ol = Game::GetGameObjects("ambu");
    o = *ol.GetObject(0);
    Vehicle v(o);

    // nicht einsatzbereit
    if (!v.HasCommand(FREEFORALERT))
    return false;

    return true;
    }

    bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
    {
    Person p(Caller);

    if (!Game::IsFreeplay())
    return false;

    if (p.HasName("LeitstellePerson"))
    return true;

    if (Caller->GetID() == Target->GetID())
    return false;

    return false;
    }

    void PushActions(GameObject *Caller, Actor *Target, int childID)
    {
    GameObjectList ol;
    GameObject *o;
    ActorList al;
    Actor spawnpoint;
    Vector spawnpos;
    Person p;
    float rot[9];
    float childRot[9];
    Vector tpos;
    PersonList pl;

    // fahrzeug finden
    ol = Game::GetGameObjects("ambu");

    // fahrzeug anwaehlen
    o = *ol.GetObject(0);
    Vehicle v(o);

    // ersatzfahrzeug?
    if (v.IsDestroyed())
    {
    // spaeter wird hier ersatzfahrzeug gefordert
    Mission::PlayHint("RTW1 wurde zerstoert und steht deshalb nicht mehr zur Verfuegung.");
    return; // abbrechen
    }

    // frei fuer einsatz?
    if (!v.HasCommand(FREEFORALERT))
    {
    Game::ExecuteCommand("PCmdFPAlarmambu2",Caller,Target);
    return;
    }
    else
    {
    // alarm-meldung ausgeben
    Mission::PlayHint("A1 Inzet 21-101");

    // fahrzeug auf "im einsatz" setzen
    v.PushActionExecuteCommand(ACTION_NEWLIST, FREEFORALERT_FALSE, &v, 1, true);

    // wache-eingang finden
    al=Game::GetActors("ambue");
    if(al.GetNumActors() > 0)
    {
    spawnpoint = *al.GetActor(0);
    spawnpos = spawnpoint.GetPosition();
    }
    else
    {
    Mission::PlayHint("Kann Rettungswache1-Eingang nicht finden!");
    return;
    }

    // besatzung erzeugen?
    bool ob_ra1 = false;
    bool ob_ra2 = false;
    pl = v.GetPassengers();
    for(int i=0; i < pl.GetNumPersons(); i++)
    {
    //Mission::PlayHint(v.GetName());
    if (pl.GetPerson(i)->HasCommand("PcmdStabilize"))
    {
    if(ob_ra1)
    {
    ob_ra2 = true;
    //Mission::PlayHint("Test... Habe Sani 2 an Board");
    }
    else
    {
    ob_ra1 = true;
    //Mission::PlayHint("Test... Habe Sani 1 an Board");
    }
    }
    if (pl.GetPerson(i)->IsParamedicTeam())
    {
    ob_ra1 = true;
    ob_ra2 = true;
    //Mission::PlayHint("Test... Habe Sani-Team an Board");
    }
    }
    bool vinbase = false;
    if (v.HasCommand(INBASE))
    {
    vinbase = true;
    Mission::PlayHint("Ambulance 22-201 Status 1!");
    }

    // Sanitaeter 1 // besatzung erzeugen (1/2)
    if (!ob_ra1 && vinbase)
    {
    p = Game::CreatePerson("mod:Prototypes/Persons/01Ambulance/sani.e4p","Verpleeg");
    p.GetRotation(rot[0], rot[1], rot[2], rot[3], rot[4], rot[5], rot[6], rot[7], rot[8]);
    Math::EulerToMatrix(0.f, 0.f, 0.f, childRot);
    Math::MultiplyMatrices(childRot, rot);
    p.SetRotation(childRot[0], childRot[1], childRot[2], childRot[3], childRot[4], childRot[5], childRot[6], childRot[7], childRot[8]);

    // " an wache-eingang spawnen
    GameObject *px(p);
    Game::FindFreePosition(px, spawnpos, 100);
    p.SetPosition(spawnpos);

    // " set commandable false
    p.PushActionExecuteCommand(ACTION_NEWLIST, COMMANDABLE_FALSE, &p, 1, true);

    // " set commandable true
    p.PushActionExecuteCommand(ACTION_APPEND, COMMANDABLE_TRUE, &p, 1, true);

    // " in fahrzeug einsteigen
    p.PushActionExecuteCommand(ACTION_APPEND, "entercar", o, 0, false);
    }

    // Sanitaeter 2 // besatzung erzeugen (2/2)
    if (!ob_ra2 && vinbase)
    {
    p = Game::CreatePerson("mod:Prototypes/Persons/01Ambulance/sani.e4p","Verpleeg");
    p.GetRotation(rot[0], rot[1], rot[2], rot[3], rot[4], rot[5], rot[6], rot[7], rot[8]);
    Math::EulerToMatrix(0.f, 0.f, 0.f, childRot);
    Math::MultiplyMatrices(childRot, rot);
    p.SetRotation(childRot[0], childRot[1], childRot[2], childRot[3], childRot[4], childRot[5], childRot[6], childRot[7], childRot[8]);

    // " an wache-eingang spawnen
    GameObject *px(p);
    Game::FindFreePosition(px, spawnpos, 100);
    p.SetPosition(spawnpos);

    // " set commandable false
    p.PushActionExecuteCommand(ACTION_NEWLIST, COMMANDABLE_FALSE, &p, 1, true);

    // " set commandable true
    p.PushActionExecuteCommand(ACTION_APPEND, COMMANDABLE_TRUE, &p, 1, true);

    // " in fahrzeug einsteigen
    p.PushActionExecuteCommand(ACTION_APPEND, "entercar", o, 0, false);
    }
    //
    // besatzung einsatzbereit?
    bool ready = false;
    if (ob_ra1 && ob_ra2)
    {
    ready= true;
    }

    // in basis
    if (vinbase)
    {
    v.PushActionWait(ACTION_APPEND, 4.0); //Zeit bevor Tor aufgeht
    v.PushActionExecuteCommand(ACTION_APPEND, "OpenGate", &v, 1, true);
    v.PushActionWait(ACTION_APPEND, 3.0); //Zeit bis Fahrzeug fŠhrt nachdem das Tor offen ist
    //Mission::PlayHint(v.GetName());
    }

    // nicht in basis und nicht einsatzbereit?
    if (!ready && !vinbase))
    {
    Mission::PlayHint(v.GetName());
    Mission::PlayHint("Ohne zwei Sani. oder einem Sani.-Team, Einsatz nicht moeglich!");
    v.PushActionExecuteCommand(ACTION_APPEND, "VCmdFPGoHome", &v, 1, true);
    return;
    }

    // fahrzeug set commandable true
    v.PushActionExecuteCommand(ACTION_APPEND, COMMANDABLE_TRUE, &v, 1, true);

    // bl und sosi an
    if(!v.HasCommand("DUMMYHasSiren"))
    {
    v.PushActionExecuteCommand(ACTION_APPEND, "VCmdSiren", o, 0, false);
    }

    // verlaesst basis
    v.PushActionExecuteCommand(ACTION_APPEND, INBASE_FALSE, &v, 1, true);

    if (!vinbase)
    {
    // warnleuchten aus
    v.PushActionExecuteCommand(ACTION_APPEND, "VCmdWarningLightsOff", &v, 1, true);
    // sl aus (beleuchtung)
    v.PushActionExecuteCommand(ACTION_APPEND, "VCmdSpecialLightsOff", &v, 1, true);
    }

    // losfahren zum einsatzort
    tpos = Game::GetCommandPos();
    v.PushActionMove(ACTION_APPEND, tpos);

    }
    }
    };

    // 1.0
    object PCmdFPAlarmambu2 : CommandScript
    {

    PCmdFPAlarmambu2()
    {
    SetIcon(IMG_ICON);
    SetCursor(IMG_CURSOR);
    SetValidTargets(ACTOR_FLOOR | ACTOR_STREET);
    }

    bool CheckPossible(GameObject *Caller)
    {
    GameObjectList ol;
    GameObject *o;
    ol = Game::GetGameObjects("ambu2");
    o = *ol.GetObject(0);
    Vehicle v(o);

    // nicht einsatzbereit
    if (!v.HasCommand(FREEFORALERT))
    return false;

    return true;
    }

    bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
    {
    Person p(Caller);

    if (!Game::IsFreeplay())
    return false;

    if (p.HasName("LeitstellePerson"))
    return true;

    if (Caller->GetID() == Target->GetID())
    return false;

    return false;
    }

    void PushActions(GameObject *Caller, Actor *Target, int childID)
    {
    GameObjectList ol;
    GameObject *o;
    ActorList al;
    Actor spawnpoint;
    Vector spawnpos;
    Person p;
    float rot[9];
    float childRot[9];
    Vector tpos;
    PersonList pl;

    // fahrzeug finden
    ol = Game::GetGameObjects("ambu2");

    // fahrzeug anwaehlen
    o = *ol.GetObject(0);
    Vehicle v(o);

    // ersatzfahrzeug?
    if (v.IsDestroyed())
    {
    // spaeter wird hier ersatzfahrzeug gefordert
    Mission::PlayHint("RTW1 wurde zerstoert und steht deshalb nicht mehr zur Verfuegung.");
    return; // abbrechen
    }

    // frei fuer einsatz?
    if (!v.HasCommand(FREEFORALERT))
    {
    Game::ExecuteCommand("PCmdFPAlarmambu3",Caller,Target);
    return;
    }
    else
    {
    // alarm-meldung ausgeben
    Mission::PlayHint("A1 inzet 21-106");

    // fahrzeug auf "im einsatz" setzen
    v.PushActionExecuteCommand(ACTION_NEWLIST, FREEFORALERT_FALSE, &v, 1, true);

    // wache-eingang finden
    al=Game::GetActors("ambue");
    if(al.GetNumActors() > 0)
    {
    spawnpoint = *al.GetActor(0);
    spawnpos = spawnpoint.GetPosition();
    }
    else
    {
    Mission::PlayHint("Kann Rettungswache1-Eingang nicht finden!");
    return;
    }

    // besatzung erzeugen?
    bool ob_ra1 = false;
    bool ob_ra2 = false;
    pl = v.GetPassengers();
    for(int i=0; i < pl.GetNumPersons(); i++)
    {
    //Mission::PlayHint(v.GetName());
    if (pl.GetPerson(i)->HasCommand("PcmdStabilize"))
    {
    if(ob_ra1)
    {
    ob_ra2 = true;
    //Mission::PlayHint("Test... Habe Sani 2 an Board");
    }
    else
    {
    ob_ra1 = true;
    //Mission::PlayHint("Test... Habe Sani 1 an Board");
    }
    }
    if (pl.GetPerson(i)->IsParamedicTeam())
    {
    ob_ra1 = true;
    ob_ra2 = true;
    //Mission::PlayHint("Test... Habe Sani-Team an Board");
    }
    }
    bool vinbase = false;
    if (v.HasCommand(INBASE))
    {
    vinbase = true;
    //Mission::PlayHint("Test... Fahrzeug ist auf seinem Stellplatz");
    }

    // Sanitaeter 1 // besatzung erzeugen (1/2)
    if (!ob_ra1 && vinbase)
    {
    p = Game::CreatePerson("mod:Prototypes/Persons/01Ambulance/sani.e4p","Verpleeg");
    p.GetRotation(rot[0], rot[1], rot[2], rot[3], rot[4], rot[5], rot[6], rot[7], rot[8]);
    Math::EulerToMatrix(0.f, 0.f, 0.f, childRot);
    Math::MultiplyMatrices(childRot, rot);
    p.SetRotation(childRot[0], childRot[1], childRot[2], childRot[3], childRot[4], childRot[5], childRot[6], childRot[7], childRot[8]);

    // " an wache-eingang spawnen
    GameObject *px(p);
    Game::FindFreePosition(px, spawnpos, 100);
    p.SetPosition(spawnpos);

    // " set commandable false
    p.PushActionExecuteCommand(ACTION_NEWLIST, COMMANDABLE_FALSE, &p, 1, true);

    // " set commandable true
    p.PushActionExecuteCommand(ACTION_APPEND, COMMANDABLE_TRUE, &p, 1, true);

    // " in fahrzeug einsteigen
    p.PushActionExecuteCommand(ACTION_APPEND, "entercar", o, 0, false);
    }

    // Sanitaeter 2 // besatzung erzeugen (2/2)
    if (!ob_ra2 && vinbase)
    {
    p = Game::CreatePerson("mod:Prototypes/Persons/01Ambulance/sani.e4p","Verpleeg");
    p.GetRotation(rot[0], rot[1], rot[2], rot[3], rot[4], rot[5], rot[6], rot[7], rot[8]);
    Math::EulerToMatrix(0.f, 0.f, 0.f, childRot);
    Math::MultiplyMatrices(childRot, rot);
    p.SetRotation(childRot[0], childRot[1], childRot[2], childRot[3], childRot[4], childRot[5], childRot[6], childRot[7], childRot[8]);

    // " an wache-eingang spawnen
    GameObject *px(p);
    Game::FindFreePosition(px, spawnpos, 100);
    p.SetPosition(spawnpos);

    // " set commandable false
    p.PushActionExecuteCommand(ACTION_NEWLIST, COMMANDABLE_FALSE, &p, 1, true);

    // " set commandable true
    p.PushActionExecuteCommand(ACTION_APPEND, COMMANDABLE_TRUE, &p, 1, true);

    // " in fahrzeug einsteigen
    p.PushActionExecuteCommand(ACTION_APPEND, "entercar", o, 0, false);
    }
    //
    // besatzung einsatzbereit?
    bool ready = false;
    if (ob_ra1 && ob_ra2)
    {
    ready= true;
    }

    // in basis
    if (vinbase)
    {
    v.PushActionWait(ACTION_APPEND, 4.0); //Zeit bevor Tor aufgeht
    v.PushActionExecuteCommand(ACTION_APPEND, "OpenGate", &v, 1, true);
    v.PushActionWait(ACTION_APPEND, 3.0); //Zeit bis Fahrzeug fŠhrt nachdem das Tor offen ist
    //Mission::PlayHint(v.GetName());
    }

    // nicht in basis und nicht einsatzbereit?
    if (!ready && !vinbase))
    {
    Mission::PlayHint(v.GetName());
    Mission::PlayHint("Ohne zwei Sani. oder einem Sani.-Team, Einsatz nicht moeglich!");
    v.PushActionExecuteCommand(ACTION_APPEND, "VCmdFPGoHome", &v, 1, true);
    return;
    }

    // fahrzeug set commandable true
    v.PushActionExecuteCommand(ACTION_APPEND, COMMANDABLE_TRUE, &v, 1, true);

    // bl und sosi an
    if(!v.HasCommand("DUMMYHasSiren"))
    {
    v.PushActionExecuteCommand(ACTION_APPEND, "VCmdSiren", o, 0, false);
    }

    // verlaesst basis
    v.PushActionExecuteCommand(ACTION_APPEND, INBASE_FALSE, &v, 1, true);

    if (!vinbase)
    {
    // warnleuchten aus
    v.PushActionExecuteCommand(ACTION_APPEND, "VCmdWarningLightsOff", &v, 1, true);
    // sl aus (beleuchtung)
    v.PushActionExecuteCommand(ACTION_APPEND, "VCmdSpecialLightsOff", &v, 1, true);
    }

    // losfahren zum einsatzort
    tpos = Game::GetCommandPos();
    v.PushActionMove(ACTION_APPEND, tpos);

    }
    }
    };

    // 1.0
    object PCmdFPAlarmambu3 : CommandScript
    {

    PCmdFPAlarmambu3()
    {
    SetIcon(IMG_ICON);
    SetCursor(IMG_CURSOR);
    SetValidTargets(ACTOR_FLOOR | ACTOR_STREET);
    }

    bool CheckPossible(GameObject *Caller)
    {
    GameObjectList ol;
    GameObject *o;
    ol = Game::GetGameObjects("ambu3");
    o = *ol.GetObject(0);
    Vehicle v(o);

    // nicht einsatzbereit
    if (!v.HasCommand(FREEFORALERT))
    return false;

    return true;
    }

    bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
    {
    Person p(Caller);

    if (!Game::IsFreeplay())
    return false;

    if (p.HasName("LeitstellePerson"))
    return true;

    if (Caller->GetID() == Target->GetID())
    return false;

    return false;
    }

    void PushActions(GameObject *Caller, Actor *Target, int childID)
    {
    GameObjectList ol;
    GameObject *o;
    ActorList al;
    Actor spawnpoint;
    Vector spawnpos;
    Person p;
    float rot[9];
    float childRot[9];
    Vector tpos;
    PersonList pl;

    // fahrzeug finden
    ol = Game::GetGameObjects("ambu3");

    // fahrzeug anwaehlen
    o = *ol.GetObject(0);
    Vehicle v(o);

    // ersatzfahrzeug?
    if (v.IsDestroyed())
    {
    // spaeter wird hier ersatzfahrzeug gefordert
    Mission::PlayHint("RTW1 wurde zerstoert und steht deshalb nicht mehr zur Verfuegung.");
    return; // abbrechen
    }

    // frei fuer einsatz?
    if (!v.HasCommand(FREEFORALERT))
    {
    Game::ExecuteCommand("PCmdFPAlarmambu5",Caller,Target);
    return;
    }
    else
    {
    // alarm-meldung ausgeben
    Mission::PlayHint("A1 inzet 21-107");

    // fahrzeug auf "im einsatz" setzen
    v.PushActionExecuteCommand(ACTION_NEWLIST, FREEFORALERT_FALSE, &v, 1, true);

    // wache-eingang finden
    al=Game::GetActors("ambue");
    if(al.GetNumActors() > 0)
    {
    spawnpoint = *al.GetActor(0);
    spawnpos = spawnpoint.GetPosition();
    }
    else
    {
    Mission::PlayHint("Kann Rettungswache1-Eingang nicht finden!");
    return;
    }

    // besatzung erzeugen?
    bool ob_ra1 = false;
    bool ob_ra2 = false;
    pl = v.GetPassengers();
    for(int i=0; i < pl.GetNumPersons(); i++)
    {
    //Mission::PlayHint(v.GetName());
    if (pl.GetPerson(i)->HasCommand("PcmdStabilize"))
    {
    if(ob_ra1)
    {
    ob_ra2 = true;
    //Mission::PlayHint("Test... Habe Sani 2 an Board");
    }
    else
    {
    ob_ra1 = true;
    //Mission::PlayHint("Test... Habe Sani 1 an Board");
    }
    }
    if (pl.GetPerson(i)->IsParamedicTeam())
    {
    ob_ra1 = true;
    ob_ra2 = true;
    //Mission::PlayHint("Test... Habe Sani-Team an Board");
    }
    }
    bool vinbase = false;
    if (v.HasCommand(INBASE))
    {
    vinbase = true;
    //Mission::PlayHint("Test... Fahrzeug ist auf seinem Stellplatz");
    }

    // Sanitaeter 1 // besatzung erzeugen (1/2)
    if (!ob_ra1 && vinbase)
    {
    p = Game::CreatePerson("mod:Prototypes/Persons/01Ambulance/sani.e4p","Verpleeg");
    p.GetRotation(rot[0], rot[1], rot[2], rot[3], rot[4], rot[5], rot[6], rot[7], rot[8]);
    Math::EulerToMatrix(0.f, 0.f, 0.f, childRot);
    Math::MultiplyMatrices(childRot, rot);
    p.SetRotation(childRot[0], childRot[1], childRot[2], childRot[3], childRot[4], childRot[5], childRot[6], childRot[7], childRot[8]);

    // " an wache-eingang spawnen
    GameObject *px(p);
    Game::FindFreePosition(px, spawnpos, 100);
    p.SetPosition(spawnpos);

    // " set commandable false
    p.PushActionExecuteCommand(ACTION_NEWLIST, COMMANDABLE_FALSE, &p, 1, true);

    // " set commandable true
    p.PushActionExecuteCommand(ACTION_APPEND, COMMANDABLE_TRUE, &p, 1, true);

    // " in fahrzeug einsteigen
    p.PushActionExecuteCommand(ACTION_APPEND, "entercar", o, 0, false);
    }

    // Sanitaeter 2 // besatzung erzeugen (2/2)
    if (!ob_ra2 && vinbase)
    {
    p = Game::CreatePerson("mod:Prototypes/Persons/01Ambulance/sani.e4p","Verpleeg");
    p.GetRotation(rot[0], rot[1], rot[2], rot[3], rot[4], rot[5], rot[6], rot[7], rot[8]);
    Math::EulerToMatrix(0.f, 0.f, 0.f, childRot);
    Math::MultiplyMatrices(childRot, rot);
    p.SetRotation(childRot[0], childRot[1], childRot[2], childRot[3], childRot[4], childRot[5], childRot[6], childRot[7], childRot[8]);

    // " an wache-eingang spawnen
    GameObject *px(p);
    Game::FindFreePosition(px, spawnpos, 100);
    p.SetPosition(spawnpos);

    // " set commandable false
    p.PushActionExecuteCommand(ACTION_NEWLIST, COMMANDABLE_FALSE, &p, 1, true);

    // " set commandable true
    p.PushActionExecuteCommand(ACTION_APPEND, COMMANDABLE_TRUE, &p, 1, true);

    // " in fahrzeug einsteigen
    p.PushActionExecuteCommand(ACTION_APPEND, "entercar", o, 0, false);
    }
    //
    // besatzung einsatzbereit?
    bool ready = false;
    if (ob_ra1 && ob_ra2)
    {
    ready= true;
    }

    // in basis
    if (vinbase)
    {
    v.PushActionWait(ACTION_APPEND, 4.0); //Zeit bevor Tor aufgeht
    v.PushActionExecuteCommand(ACTION_APPEND, "OpenGate", &v, 1, true);
    v.PushActionWait(ACTION_APPEND, 3.0); //Zeit bis Fahrzeug fŠhrt nachdem das Tor offen ist
    //Mission::PlayHint(v.GetName());
    }

    // nicht in basis und nicht einsatzbereit?
    if (!ready && !vinbase))
    {
    Mission::PlayHint(v.GetName());
    Mission::PlayHint("Ohne zwei Sani. oder einem Sani.-Team, Einsatz nicht moeglich!");
    v.PushActionExecuteCommand(ACTION_APPEND, "VCmdFPGoHome", &v, 1, true);
    return;
    }

    // fahrzeug set commandable true
    v.PushActionExecuteCommand(ACTION_APPEND, COMMANDABLE_TRUE, &v, 1, true);

    // bl und sosi an
    if(!v.HasCommand("DUMMYHasSiren"))
    {
    v.PushActionExecuteCommand(ACTION_APPEND, "VCmdSiren", o, 0, false);
    }

    // verlaesst basis
    v.PushActionExecuteCommand(ACTION_APPEND, INBASE_FALSE, &v, 1, true);

    if (!vinbase)
    {
    // warnleuchten aus
    v.PushActionExecuteCommand(ACTION_APPEND, "VCmdWarningLightsOff", &v, 1, true);
    // sl aus (beleuchtung)
    v.PushActionExecuteCommand(ACTION_APPEND, "VCmdSpecialLightsOff", &v, 1, true);
    }

    // losfahren zum einsatzort
    tpos = Game::GetCommandPos();
    v.PushActionMove(ACTION_APPEND, tpos);

    }
    }
    };

    Thx,

    Bernt

  2. Hello,

    I added 2 lines to my script, but now i recieve a error.

    I hope some one can help me.

    1293260624-970.png

    This i added:

      
    // BMA-Einsätze initialisieren
    ofz->PushActionExecuteCommand(ACTION_APPEND,"bmaeinsatz_initialisierung",ofz,0,false);

    My script:

    //////////////////////////////////////////////////////////////////////////////////////////////////////////
    // Brabant Mod - Freeplay - Script v1.1 //
    // ************************************* //
    // //
    // 1.0| FPPlaceUnits //
    // | | //
    // | |- Units worden geplaatst, comment lijnen (//) is verdeeld in blokken. //
    // | | Elk van hen kan worden verwijderd zonder dat het script fouten geeft. //
    // | | //
    // | '- Die met een Ster (*) markeert is moet aangepast worden. //
    // | Meerdere sterren betekent dat er meedere dingen moeten worden aangepast //
    // | Daarbij geld: 2 steren 2 aanpassingen, enzo verder. //
    // | //
    // 2.0| FPMSG_1 //
    // | //
    // 2.1| FPMSG_2 //
    // | //
    // 3.0| OnLoad //
    // //
    // _____________________ //
    // Skript frei fuer alle //
    //////////////////////////////////////////////////////////////////////////////////////////////////////////


    // 1.0
    void FPPlaceUnits()
    {

    // Grüne Schatten deaktivieren
    System::SetEnv("e4_doocclusion", 0);

    Camera::SetMinCamZ(500.0f);
    Camera::SetMaxCamZ(9000.0f);

    Camera::SetMinCamPitch(20.0f);
    Camera::SetMaxCamPitch(90.0f);

    // Parameter fuer Fahrzeugerzeugung definieren
    Vector parkplatz;
    Actor parkobj;
    float rot[9];
    float childRot[9];
    Vehicle v;
    ActorList l1;
    GameObjectList vl;
    GameObject *o1;
    GameObjectList ol1;
    GameObject *o2;
    GameObjectList ol2;
    GameObject *ofz;
    GameObjectList lfz;
    ActorList fzl;

    //Mission::PlayHint("Meldkamer word ingericht");

    ol1=Game::GetGameObjects("LeitstellePerson");
    if(ol1.GetNumObjects() > 0)
    {
    //Brandweer1
    o1 = *ol1.GetObject(0);
    Game::AddToGroup(o1,0);
    Person p1(o1);
    p1.AssignCommand("Alarmering_Neven");
    p1.AssignCommand("Alarmering_Centrum");
    p1.AssignCommand("Alarmering_PostN");
    p1.AssignCommand("Alarmering_PostC");

    //Brandweer2
    o1 = *ol1.GetObject(1);
    Game::AddToGroup(o1,1);
    Person p2(o1);
    p2.AssignCommand("PCmdFPAlarmTS3P");
    p2.AssignCommand("PCmdFPAlarmAL2P");
    p2.AssignCommand("PCmdFPAlarmSWP");
    p2.AssignCommand("PCmdFPAlarmTWP");
    p2.AssignCommand("PCmdFPAlarmDB2P");

    //Ambulance
    o1 = *ol1.GetObject(2);
    Game::AddToGroup(o1,2);
    Person p3(o1);
    p3.AssignCommand("Alarmambu");
    p3.AssignCommand("PCmdFPAlarmFR");
    p3.AssignCommand("PCmdFPAlarmMMTA");
    p3.AssignCommand("PCmdFPAlarmOVDG");
    p3.AssignCommand("PCmdFPAlarmLH");

    //Politie
    o1 = *ol1.GetObject(3);
    Game::AddToGroup(o1,3);
    Person p4(o1);
    p4.AssignCommand("PCmdFPAlarmTouran");
    p4.AssignCommand("PCmdFPAlarmTouran2");
    p4.AssignCommand("PCmdFPAlarmTouran3");
    p4.AssignCommand("PCmdFPAlarmGolf");
    p4.AssignCommand("PCmdFPAlarmGolf2");
    p4.AssignCommand("PCmdFPAlarmGolf3");
    p4.AssignCommand("PCmdFPAlarmT5");
    p4.AssignCommand("PCmdFPAlarmOVDP");

    //Overige
    o1 = *ol1.GetObject(4);
    Game::AddToGroup(o1,4);
    Person p5(o1);
    p5.AssignCommand("PCmdFPAlarmEOC");
    p5.AssignCommand("PCmdFPAlarmANWB");

    //Buiten de map
    o1 = *ol1.GetObject(5);
    Game::AddToGroup(o1,5);
    Person p6(o1);
    p6.AssignCommand("PCmdFPAlarmMEA");
    p6.AssignCommand("PCmdFPAlarmVOA");
    p6.AssignCommand("PCmdFPAlarmATA");
    p6.AssignCommand("PCmdFPAlarmHV2P");
    p6.AssignCommand("PCmdFPAlarmA1");
    p6.AssignCommand("PCmdFPAlarmA2");
    p6.AssignCommand("PCmdFPAlarmA3");
    p6.AssignCommand("PCmdFPAlarmA4");

    }
    else
    {
    Mission::PlayHint("Kan de centralisten niet vinden!");
    }


    ol2 = Game::GetGameObjects("Meldkamer");
    if(ol2.GetNumObjects() > 0)
    {
    o2 = *ol2.GetObject(0);
    OpenHouse oh(o2);
    oh.ShowCeiling(false,false,false);
    }
    else
    {
    Mission::PlayHint("Kan de meldkamer niet vinden!");
    }

    // BMA-Einsätze initialisieren
    ofz->PushActionExecuteCommand(ACTION_APPEND,"bmaeinsatz_initialisierung",ofz,0,false);


    //Mission::PlayHint("Hulpverleningsvoertuigen worden op de map gezet!");

    /////// Touran ///////////////////////////////////////////////////////////////////////////////////////////////////////////

    vl=Game::GetGameObjects("Touran"); // *
    if(vl.GetNumObjects() > 0)
    {
    Mission::PlayHint("STW1 befindet sich bereits auf der Karte!"); // *
    }
    else
    {
    l1=Game::GetActors("Touran"); // *
    if(l1.GetNumActors() > 0)
    {
    parkobj = *l1.GetActor(0);
    parkplatz = parkobj.GetPosition();
    v = Game::CreateVehicle("mod:Prototypes/Vehicles/03Politie/touran_weiss.e4p","Touran"); // **
    v.SetSpeed(14.0f); // *
    v.SetMaxPassengers(2); // *
    v.SetMaxTransports(2); // *
    v.EnableBlueLights(false);
    v.EnableBreakLights(false);
    v.EnableSpecialLights(false);
    v.GetRotation(rot[0], rot[1], rot[2], rot[3], rot[4], rot[5], rot[6], rot[7], rot[8]);
    Math::EulerToMatrix(0.f, 0.f, 0.f, childRot); // *
    Math::MultiplyMatrices(childRot, rot);
    v.SetRotation(childRot[0], childRot[1], childRot[2], childRot[3], childRot[4], childRot[5], childRot[6], childRot[7], childRot[8]);
    v.SetPosition(parkplatz);
    v.SetCommandable(false);
    v.RemoveCommand("DUMMYHasAutoSiren");
    v.RemoveCommand("GoHome");
    v.AssignCommand("DUMMYFPIsFreeForAlert");
    v.AssignCommand("VCmdFPSetFreeForAlert");
    v.AssignCommand("DUMMYFPIsInBase");
    v.AssignCommand("VCmdFPGoHome");
    v.SetParking(true); // test
    }
    else
    {
    Mission::PlayHint("Kann Parkplatz fuer STW1 nicht finden!"); // *
    }
    }
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    };

    // 2.0
    void FPMSG_1()
    {
    //Mission::PlayHint("Kaart word ingericht");
    };

    // 2.1
    void FPMSG_2()
    {
    Camera::SetCameraToLocation("Meldkamer");

    Mission::PlayHint("Kaart ingericht! Michael en Bernt wensen u veel plezier met het spelen van de mod!!");
    };

    // 3.0
    bool OnLoad()
    {
    FPMSG_1();
    FPPlaceUnits();
    FPMSG_2();
    Process::Kill();
    return true;
    }

    Happy x-mas

×
×
  • Create New...