Jump to content

TTBL225

Members
  • Posts

    46
  • Joined

  • Last visited

  • Days Won

    5

Posts posted by TTBL225

  1. I am having an issue where when I hit the returnto command, a select few vehicles will turn and face the VO but will never actually return. It is only with about half the vehicles in the script. The others work just fine. I have spent hours looking at the script and the map setup without finding any issues. As far as I know, the lines of the vehicles that work are exactly the same as the ones that don't work. Script and picture are attached. 

    Untitled.png

    BostonPolicePark.script

  2. 2 hours ago, TTBL225 said:

    @Chris07 I am having a problem with the same script and also the exact same problem with another script.

    Error:

      Reveal hidden contents

    ?(_RiversideSirenb0228c): Limitation: Statement too long
    ?(_RiversideSirenb0228c):  FILE:mod:/scripts/game/command/RiversideSiren.scriptb0228c LINE:138
    ?(_RiversideSirenb0228c): cint: Security mode 0x7:0x2 
    ?(_RiversideSirenb0228c): !!!Fatal error. Sorry, terminate cint session!!!

     

    Script:

      Reveal hidden contents


    const char CMD_AUTOSIREN_OFF[]        = "VcmdAutoSirenOff";
    const char EACTION_FINDPATH[]         = "EActionFindPath";
    const char EACTION_EXTINGUISH[]     = "EActionExtinguish";
    const char DUMMY_HASSIREN[]         = "DummyHasSiren";
    const char DUMMY_UPDATEPOS[]         = "DummyUpdatePos";
    const char DUMMY_FINDPATH[]         = "DummyFindPath";
    const char DUMMY_HOSESON[]         = "DummyHosesAreOn";
    const char NAME_DUMMYOBJECT[]         = "HelpingObjekt_Hoppah";
    const char DUMMY_GETTIL[]         = "DummyGetTiller";
    const char DUMMY_LIGHTS_ENABLE[]    = "DummyEnableLights";
    const char DUMMY_LIGHTS_DISABLE[]    = "DummyDisableLights";
    const char DUMMY_HASLIGHTS[]        = "DummyHasLights";

    const char PROTO_ENGINE1[]       = "mod:Prototypes/Vehicles/02 LA Fire Department/Engine 1.e4p";
    const char PROTO_ENGINE2[]       = "mod:Prototypes/Vehicles/02 LA Fire Department/Engine 2.e4p";
    const char PROTO_TANKER1[]      = "mod:Prototypes/Vehicles/02 LA Fire Department/Tanker 1.e4p";
    const char PROTO_TANKER2[]      = "mod:Prototypes/Vehicles/02 LA Fire Department/Tanker 2.e4p";
    const char PROTO_LADDER1[]       = "mod:Prototypes/Vehicles/02 LA Fire Department/Ladder 1.e4p";
    const char PROTO_HAZMAT1[]      = "mod:Prototypes/Vehicles/02 LA Fire Department/HazMat 1.e4p";
    const char PROTO_BATT1[]          = "mod:Prototypes/Vehicles/02 LA Fire Department/Battalion 1.e4p";

    const char PROTO_MEDIC1[]       = "mod:Prototypes/Vehicles/01 LA Ambulance/Medic 1.e4p";
    const char PROTO_MEDIC2[]        = "mod:Prototypes/Vehicles/01 LA Ambulance/Medic 2.e4p";
    const char PROTO_MEDIC3[]        = "mod:Prototypes/Vehicles/01 LA Ambulance/Medic 3.e4p";

    const char PROTO_MARY1[]       = "mod:Prototypes/Vehicles/03 LA Police/Mary 1.e4p";

    const char PROTO_BRUSH9[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Brush 9.e4p";
    const char PROTO_CHIEF4[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Chief 4.e4p";
    const char PROTO_CHIEF5[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Chief 5.e4p";
    const char PROTO_CHIEF6[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Chief 6.e4p";
    const char PROTO_CHIEF7[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Chief 7.e4p";
    const char PROTO_CHIEF8[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Chief 8.e4p";
    const char PROTO_CHIEF9[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Chief 9.e4p";
    const char PROTO_ENGINE4[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Engine 4.e4p";
    const char PROTO_ENGINE5[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Engine 5.e4p";
    const char PROTO_ENGINE51[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Engine 5_1.e4p";
    const char PROTO_ENGINE6[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Engine 6.e4p";
    const char PROTO_ENGINE7[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Engine 7.e4p";
    const char PROTO_ENGINE71[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Engine 7_1.e4p";
    const char PROTO_ENGINE8[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Engine 8.e4p";
    const char PROTO_ENGINE9[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Engine 9.e4p";
    const char PROTO_QUINT4[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Quint 4.e4p";
    const char PROTO_TRUCK5[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Truck 5.e4p";
    const char PROTO_TRUCK7[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Truck 7.e4p";
    const char PROTO_TRUCK8[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Truck 8.e4p";
    const char PROTO_RESCUE4[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Rescue 4.e4p";
    const char PROTO_RESCUE5[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Rescue 5.e4p";
    const char PROTO_RESCUE6[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Rescue 6.e4p";
    const char PROTO_SPECOPS6[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Special Operations 6.e4p";
    const char PROTO_TANKER4[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Tanker 4.e4p";
    const char PROTO_TANKER5[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Tanker 5.e4p";
    const char PROTO_TANKER51[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Tanker 5_1.e4p";
    const char PROTO_TANKER6[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Tanker 6.e4p";
    const char PROTO_TANKER7[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Tanker 7.e4p";
    const char PROTO_TANKER8[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Tanker 8.e4p";
    const char PROTO_TANKER9[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Tanker 9.e4p";
    const char PROTO_UTILITY51[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Utility 5_1.e4p";


    int DummyGroup = 23;

    object VcmdSiren : CommandScript
    {
        VcmdSiren()
        {
            SetIcon("sirenson");
            SetCursor("sirens");
            SetRestrictions(RESTRICT_SELFEXECUTE);
            SetPossibleCallers(ACTOR_VEHICLE);
             SetGroupID(DummyGroup);
             SetGroupLeader(true);
        }

        bool CheckPossible(GameObject *Caller)
        {
            if (!Caller->IsValid())
                return false;

            if (Caller->HasCommand(DUMMY_HASSIREN))
                SetIcon("sirensoff");
            else
                SetIcon("sirenson");

            if(Caller->HasCommand(DUMMY_HOSESON))
                return false;    

            return true;
        }

        bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
        {
            if (!Target->IsValid() || Target->GetID() != Caller->GetID())
                return false;

            return true;
        }

        void PushActions(GameObject *Caller, Actor *Target, int childID)
        {
            Vehicle v(Caller);
            if (!v.HasCommand(DUMMY_HASSIREN))
            {
                if (!v.HasCommand(DUMMY_HASLIGHTS))
                {
                    Game::ExecuteCommand(DUMMY_LIGHTS_ENABLE, &v, &v);
                }


                int soundID;
                Vector CarPos = v.GetPosition();
                 if (StrCompare(v.GetPrototypeFileName(), PROTO_ENGINE1) == 0 ||
                 StrCompare(v.GetPrototypeFileName(), PROTO_ENGINE2) == 0 ||
                 StrCompare(v.GetPrototypeFileName(), PROTO_TANKER1) == 0 ||
                 StrCompare(v.GetPrototypeFileName(), PROTO_TANKER2) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_LADDER1) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_HAZMAT1) == 0)        
                {
                    int random = Math::rand()%3;
                    if (random == 0)
                    {
                          soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Siren01.wav", CarPos, true);
                    } else
                    {
                          soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Siren02.wav", CarPos, true);
                    } else
                    {
                          soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Siren10.wav", CarPos, true);
                    }
                 }
                else if (StrCompare(v.GetPrototypeFileName(), PROTO_ENGINE4) == 0 ||
                 StrCompare(v.GetPrototypeFileName(), PROTO_ENGINE5) == 0 ||
                 StrCompare(v.GetPrototypeFileName(), PROTO_ENGINE51) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_ENGINE6) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_ENGINE7) == 0 ||    
                 StrCompare(v.GetPrototypeFileName(), PROTO_ENGINE71) == 0 ||
                 StrCompare(v.GetPrototypeFileName(), PROTO_ENGINE8) == 0 ||
                 StrCompare(v.GetPrototypeFileName(), PROTO_ENGINE9) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_QUINT4) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_TRUCK5) == 0 ||    
                StrCompare(v.GetPrototypeFileName(), PROTO_TRUCK7) == 0 ||    
                StrCompare(v.GetPrototypeFileName(), PROTO_TRUCK8) == 0 ||    
                 StrCompare(v.GetPrototypeFileName(), PROTO_SPECOPS6) == 0 ||
                 StrCompare(v.GetPrototypeFileName(), PROTO_RESCUE4) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_RESCUE5) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_RESCUE6) == 0 ||    
                StrCompare(v.GetPrototypeFileName(), PROTO_TANKER4) == 0 ||    
                StrCompare(v.GetPrototypeFileName(), PROTO_TANKER5) == 0 ||                 
                StrCompare(v.GetPrototypeFileName(), PROTO_TANKER51) == 0 ||    
                StrCompare(v.GetPrototypeFileName(), PROTO_TANKER6) == 0 ||                
                StrCompare(v.GetPrototypeFileName(), PROTO_TANKER7) == 0 ||    
                StrCompare(v.GetPrototypeFileName(), PROTO_TANKER8) == 0 ||                
                StrCompare(v.GetPrototypeFileName(), PROTO_TANKER9) == 0)            
                {
                    int random = Math::rand()%3;
                    if (random == 0)
                    {
                          soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Siren01.wav", CarPos, true);
                    } else
                    {
                          soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Siren02.wav", CarPos, true);
                    } else
                    {
                          soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Siren10.wav", CarPos, true);
                    }
                }
                 else if (StrCompare(v.GetPrototypeFileName(), PROTO_MEDIC1) == 0 ||
                 StrCompare(v.GetPrototypeFileName(), PROTO_MEDIC2) == 0 ||
                 StrCompare(v.GetPrototypeFileName(), PROTO_MEDIC3) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_BRUSH9) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_CHIEF4) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_CHIEF5) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_CHIEF6) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_CHIEF7) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_CHIEF8) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_CHIEF9) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_UTILITY51) == 0)
                {
                    int random = Math::rand()%2;
                    if (random == 0)
                    {
                          soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Siren03.wav", CarPos, true);
                    } else
                    {
                          soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Siren04.wav", CarPos, true);
                    }
                 }
                 else if (StrCompare(v.GetPrototypeFileName(), PROTO_MARY1) == 0)
                 {
                    int random = Math::rand()%2;
                    if (random == 0)
                    {
                          soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Siren05.wav", CarPos, true);
                    } else
                    {
                          soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Siren06.wav", CarPos, true);
                    }
                }
                int CarID = v.GetID();
                GameObject mDummy =  Game::CreateObject("mod:Prototypes/Objects/Misc/empty.e4p", NAME_DUMMYOBJECT);
                v.AssignCommand(DUMMY_HASSIREN);
                v.SetUserData(soundID);
                mDummy.Hide();
                //mDummy.SetUserData(v.GetID());
                mDummy.SetUserData(soundID);
                mDummy.AttachSound(soundID);
                mDummy.PushActionExecuteCommand(ACTION_NEWLIST, DUMMY_UPDATEPOS, &v, 0, false);
                return;
            }

            if (v.HasCommand(DUMMY_HASSIREN))
            {
                System::Log("Stop sample via VcmdSiren");
                if (childID == 1)
                {
                    Game::ExecuteCommand(DUMMY_LIGHTS_DISABLE, &v, &v);
                }
                int CarID = v.GetUserData();
                int ref = v.GetUserData();
                v.UnattachSound(ref);
                Audio::StopSample(ref);
                int mSirTest;
                GameObjectList list = Game::GetGameObjects(NAME_DUMMYOBJECT);
                for(int i=0; i<list.GetNumObjects(); i++)
                {
                    GameObject *obj = list.GetObject(i);
                    if (obj->GetUserData() == CarID)
                    {
                        mSirTest = i;
                    }
                }

                GameObject *obj = list.GetObject(mSirTest);
                obj->PushActionDeleteOwner(ACTION_NEWLIST);

                if (v.HasCommand(DUMMY_HASSIREN))
                    v.RemoveCommand(DUMMY_HASSIREN);

                return;
            }
        }
    };

    object DummyUpdatePos : CommandScript
    {
        DummyUpdatePos()
        {
            SetGroupID(DummyGroup);
        }

        bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
        {
        }

          void PushActions(GameObject *Caller, Actor *Target, int childID)
        {
            Vehicle v(Target);
            GameObject mDummy(Caller);

            if (v.IsDestroyed() || !v.IsValid())
            {
                int ref = mDummy.GetUserData();
                mDummy.UnattachSound(ref);
                Audio::StopSample(ref);

                if (v.HasCommand(DUMMY_HASSIREN))
                    v.RemoveCommand(DUMMY_HASSIREN);

                mDummy.PushActionDeleteOwner(ACTION_NEWLIST);
            } else
              {
                if (v.IsCurrentAction(EACTION_FINDPATH))
                {
                    if (!v.HasCommand(DUMMY_FINDPATH))
                    {
                        v.AssignCommand(DUMMY_FINDPATH);
                    }
                }
                Vector vPos = v.GetPosition();
                mDummy.SetPosition(vPos);
                mDummy.PushActionExecuteCommand(ACTION_NEWLIST, DUMMY_UPDATEPOS, Target, childID, false);
              }

            if (v.HasCommand(DUMMY_FINDPATH))
            {
                if (!v.IsCurrentAction(EACTION_FINDPATH) && v.HasCommand(CMD_AUTOSIREN_OFF) && (v.GetNumActions() == 0 || v.IsCurrentAction(EACTION_EXTINGUISH)))
                {
                    if (v.HasCommand(DUMMY_HASSIREN))
                        v.RemoveCommand(DUMMY_HASSIREN);

                    if (v.HasCommand(DUMMY_FINDPATH))
                        v.RemoveCommand(DUMMY_FINDPATH);

                    int CarID = v.GetUserData();
                    int ref = v.GetUserData();
                    v.UnattachSound(ref);
                    Audio::StopSample(ref);

                    GameObjectList list = Game::GetGameObjects(NAME_DUMMYOBJECT);
                    for(int i = 0; i < list.GetNumObjects(); i++)
                    {
                        int mSirTest;
                        GameObject *obj = list.GetObject(i);
                        if (obj->GetUserData() == CarID)
                        {
                            mSirTest = i;
                            GameObject *obj = list.GetObject(mSirTest);
                            obj->PushActionDeleteOwner(ACTION_NEWLIST);
                            if (v.HasCommand(DUMMY_HASSIREN))
                                v.RemoveCommand(DUMMY_HASSIREN);
                            if (v.HasCommand(DUMMY_FINDPATH))
                                v.RemoveCommand(DUMMY_FINDPATH);
                        }
                    }
                }
            }
        }
    };

    object DummyDisableSiren : CommandScript
    {
        DummyDisableSiren()
        {
            SetGroupID(DummyGroup);
        }

        bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
        {
        }

          void PushActions(GameObject *Caller, Actor *Target, int childID)
        {
            Vehicle v(Caller);
            if (childID == 1)
            {
                v.EnableBlueLights(false);
            }

            //int CarID = v.GetID();
            int CarID = v.GetUserData();
            int ref = v.GetUserData();
            v.UnattachSound(ref);
            Audio::StopSample(ref);

            GameObjectList list = Game::GetGameObjects(NAME_DUMMYOBJECT);
            for(int i = 0; i < list.GetNumObjects(); i++)
            {
                GameObject *obj = list.GetObject(i);
                if (obj->GetUserData() == CarID)
                {
                    int mSirTest = i;

                    GameObject *obj = list.GetObject(mSirTest);
                    obj->PushActionDeleteOwner(ACTION_NEWLIST);

                    if (v.HasCommand(DUMMY_HASSIREN))
                        v.RemoveCommand(DUMMY_HASSIREN);
                    if (v.HasCommand(DUMMY_FINDPATH))
                        v.RemoveCommand(DUMMY_FINDPATH);
                    if (v.HasCommand(DUMMY_GETTIL))
                        v.SetUserData(v.GetID());
                }
            }
        }
    };

    object DummyFindPath : CommandScript
    {
        DummyFindPath()
        {
            SetGroupID(DummyGroup);
        }

        bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
        {
            return false;
        }

          void PushActions(GameObject *Caller, Actor *Target, int childID)
        {
        }
    };

    object DummyHasSiren : CommandScript
    {
        DummyHasSiren()
        {
            SetGroupID(DummyGroup);
        }

        bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
        {
            return false;
        }

          void PushActions(GameObject *Caller, Actor *Target, int childID)
        {
        }
    };
     

     

    Disregard. I was able to solve after finding this thread.

     

     

  3. @Chris07 I am having a problem with the same script and also the exact same problem with another script.

    Error:

    Spoiler

    ?(_RiversideSirenb0228c): Limitation: Statement too long
    ?(_RiversideSirenb0228c):  FILE:mod:/scripts/game/command/RiversideSiren.scriptb0228c LINE:138
    ?(_RiversideSirenb0228c): cint: Security mode 0x7:0x2 
    ?(_RiversideSirenb0228c): !!!Fatal error. Sorry, terminate cint session!!!

     

    Script:

    Spoiler


    const char CMD_AUTOSIREN_OFF[]        = "VcmdAutoSirenOff";
    const char EACTION_FINDPATH[]         = "EActionFindPath";
    const char EACTION_EXTINGUISH[]     = "EActionExtinguish";
    const char DUMMY_HASSIREN[]         = "DummyHasSiren";
    const char DUMMY_UPDATEPOS[]         = "DummyUpdatePos";
    const char DUMMY_FINDPATH[]         = "DummyFindPath";
    const char DUMMY_HOSESON[]         = "DummyHosesAreOn";
    const char NAME_DUMMYOBJECT[]         = "HelpingObjekt_Hoppah";
    const char DUMMY_GETTIL[]         = "DummyGetTiller";
    const char DUMMY_LIGHTS_ENABLE[]    = "DummyEnableLights";
    const char DUMMY_LIGHTS_DISABLE[]    = "DummyDisableLights";
    const char DUMMY_HASLIGHTS[]        = "DummyHasLights";

    const char PROTO_ENGINE1[]       = "mod:Prototypes/Vehicles/02 LA Fire Department/Engine 1.e4p";
    const char PROTO_ENGINE2[]       = "mod:Prototypes/Vehicles/02 LA Fire Department/Engine 2.e4p";
    const char PROTO_TANKER1[]      = "mod:Prototypes/Vehicles/02 LA Fire Department/Tanker 1.e4p";
    const char PROTO_TANKER2[]      = "mod:Prototypes/Vehicles/02 LA Fire Department/Tanker 2.e4p";
    const char PROTO_LADDER1[]       = "mod:Prototypes/Vehicles/02 LA Fire Department/Ladder 1.e4p";
    const char PROTO_HAZMAT1[]      = "mod:Prototypes/Vehicles/02 LA Fire Department/HazMat 1.e4p";
    const char PROTO_BATT1[]          = "mod:Prototypes/Vehicles/02 LA Fire Department/Battalion 1.e4p";

    const char PROTO_MEDIC1[]       = "mod:Prototypes/Vehicles/01 LA Ambulance/Medic 1.e4p";
    const char PROTO_MEDIC2[]        = "mod:Prototypes/Vehicles/01 LA Ambulance/Medic 2.e4p";
    const char PROTO_MEDIC3[]        = "mod:Prototypes/Vehicles/01 LA Ambulance/Medic 3.e4p";

    const char PROTO_MARY1[]       = "mod:Prototypes/Vehicles/03 LA Police/Mary 1.e4p";

    const char PROTO_BRUSH9[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Brush 9.e4p";
    const char PROTO_CHIEF4[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Chief 4.e4p";
    const char PROTO_CHIEF5[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Chief 5.e4p";
    const char PROTO_CHIEF6[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Chief 6.e4p";
    const char PROTO_CHIEF7[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Chief 7.e4p";
    const char PROTO_CHIEF8[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Chief 8.e4p";
    const char PROTO_CHIEF9[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Chief 9.e4p";
    const char PROTO_ENGINE4[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Engine 4.e4p";
    const char PROTO_ENGINE5[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Engine 5.e4p";
    const char PROTO_ENGINE51[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Engine 5_1.e4p";
    const char PROTO_ENGINE6[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Engine 6.e4p";
    const char PROTO_ENGINE7[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Engine 7.e4p";
    const char PROTO_ENGINE71[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Engine 7_1.e4p";
    const char PROTO_ENGINE8[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Engine 8.e4p";
    const char PROTO_ENGINE9[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Engine 9.e4p";
    const char PROTO_QUINT4[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Quint 4.e4p";
    const char PROTO_TRUCK5[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Truck 5.e4p";
    const char PROTO_TRUCK7[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Truck 7.e4p";
    const char PROTO_TRUCK8[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Truck 8.e4p";
    const char PROTO_RESCUE4[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Rescue 4.e4p";
    const char PROTO_RESCUE5[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Rescue 5.e4p";
    const char PROTO_RESCUE6[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Rescue 6.e4p";
    const char PROTO_SPECOPS6[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Special Operations 6.e4p";
    const char PROTO_TANKER4[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Tanker 4.e4p";
    const char PROTO_TANKER5[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Tanker 5.e4p";
    const char PROTO_TANKER51[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Tanker 5_1.e4p";
    const char PROTO_TANKER6[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Tanker 6.e4p";
    const char PROTO_TANKER7[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Tanker 7.e4p";
    const char PROTO_TANKER8[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Tanker 8.e4p";
    const char PROTO_TANKER9[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Tanker 9.e4p";
    const char PROTO_UTILITY51[]       = "mod:Prototypes/Vehicles/02 Mutual Aid Fire/Utility 5_1.e4p";


    int DummyGroup = 23;

    object VcmdSiren : CommandScript
    {
        VcmdSiren()
        {
            SetIcon("sirenson");
            SetCursor("sirens");
            SetRestrictions(RESTRICT_SELFEXECUTE);
            SetPossibleCallers(ACTOR_VEHICLE);
             SetGroupID(DummyGroup);
             SetGroupLeader(true);
        }

        bool CheckPossible(GameObject *Caller)
        {
            if (!Caller->IsValid())
                return false;

            if (Caller->HasCommand(DUMMY_HASSIREN))
                SetIcon("sirensoff");
            else
                SetIcon("sirenson");

            if(Caller->HasCommand(DUMMY_HOSESON))
                return false;    

            return true;
        }

        bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
        {
            if (!Target->IsValid() || Target->GetID() != Caller->GetID())
                return false;

            return true;
        }

        void PushActions(GameObject *Caller, Actor *Target, int childID)
        {
            Vehicle v(Caller);
            if (!v.HasCommand(DUMMY_HASSIREN))
            {
                if (!v.HasCommand(DUMMY_HASLIGHTS))
                {
                    Game::ExecuteCommand(DUMMY_LIGHTS_ENABLE, &v, &v);
                }


                int soundID;
                Vector CarPos = v.GetPosition();
                 if (StrCompare(v.GetPrototypeFileName(), PROTO_ENGINE1) == 0 ||
                 StrCompare(v.GetPrototypeFileName(), PROTO_ENGINE2) == 0 ||
                 StrCompare(v.GetPrototypeFileName(), PROTO_TANKER1) == 0 ||
                 StrCompare(v.GetPrototypeFileName(), PROTO_TANKER2) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_LADDER1) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_HAZMAT1) == 0)        
                {
                    int random = Math::rand()%3;
                    if (random == 0)
                    {
                          soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Siren01.wav", CarPos, true);
                    } else
                    {
                          soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Siren02.wav", CarPos, true);
                    } else
                    {
                          soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Siren10.wav", CarPos, true);
                    }
                 }
                else if (StrCompare(v.GetPrototypeFileName(), PROTO_ENGINE4) == 0 ||
                 StrCompare(v.GetPrototypeFileName(), PROTO_ENGINE5) == 0 ||
                 StrCompare(v.GetPrototypeFileName(), PROTO_ENGINE51) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_ENGINE6) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_ENGINE7) == 0 ||    
                 StrCompare(v.GetPrototypeFileName(), PROTO_ENGINE71) == 0 ||
                 StrCompare(v.GetPrototypeFileName(), PROTO_ENGINE8) == 0 ||
                 StrCompare(v.GetPrototypeFileName(), PROTO_ENGINE9) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_QUINT4) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_TRUCK5) == 0 ||    
                StrCompare(v.GetPrototypeFileName(), PROTO_TRUCK7) == 0 ||    
                StrCompare(v.GetPrototypeFileName(), PROTO_TRUCK8) == 0 ||    
                 StrCompare(v.GetPrototypeFileName(), PROTO_SPECOPS6) == 0 ||
                 StrCompare(v.GetPrototypeFileName(), PROTO_RESCUE4) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_RESCUE5) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_RESCUE6) == 0 ||    
                StrCompare(v.GetPrototypeFileName(), PROTO_TANKER4) == 0 ||    
                StrCompare(v.GetPrototypeFileName(), PROTO_TANKER5) == 0 ||                 
                StrCompare(v.GetPrototypeFileName(), PROTO_TANKER51) == 0 ||    
                StrCompare(v.GetPrototypeFileName(), PROTO_TANKER6) == 0 ||                
                StrCompare(v.GetPrototypeFileName(), PROTO_TANKER7) == 0 ||    
                StrCompare(v.GetPrototypeFileName(), PROTO_TANKER8) == 0 ||                
                StrCompare(v.GetPrototypeFileName(), PROTO_TANKER9) == 0)            
                {
                    int random = Math::rand()%3;
                    if (random == 0)
                    {
                          soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Siren01.wav", CarPos, true);
                    } else
                    {
                          soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Siren02.wav", CarPos, true);
                    } else
                    {
                          soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Siren10.wav", CarPos, true);
                    }
                }
                 else if (StrCompare(v.GetPrototypeFileName(), PROTO_MEDIC1) == 0 ||
                 StrCompare(v.GetPrototypeFileName(), PROTO_MEDIC2) == 0 ||
                 StrCompare(v.GetPrototypeFileName(), PROTO_MEDIC3) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_BRUSH9) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_CHIEF4) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_CHIEF5) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_CHIEF6) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_CHIEF7) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_CHIEF8) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_CHIEF9) == 0 ||
                StrCompare(v.GetPrototypeFileName(), PROTO_UTILITY51) == 0)
                {
                    int random = Math::rand()%2;
                    if (random == 0)
                    {
                          soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Siren03.wav", CarPos, true);
                    } else
                    {
                          soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Siren04.wav", CarPos, true);
                    }
                 }
                 else if (StrCompare(v.GetPrototypeFileName(), PROTO_MARY1) == 0)
                 {
                    int random = Math::rand()%2;
                    if (random == 0)
                    {
                          soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Siren05.wav", CarPos, true);
                    } else
                    {
                          soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Siren06.wav", CarPos, true);
                    }
                }
                int CarID = v.GetID();
                GameObject mDummy =  Game::CreateObject("mod:Prototypes/Objects/Misc/empty.e4p", NAME_DUMMYOBJECT);
                v.AssignCommand(DUMMY_HASSIREN);
                v.SetUserData(soundID);
                mDummy.Hide();
                //mDummy.SetUserData(v.GetID());
                mDummy.SetUserData(soundID);
                mDummy.AttachSound(soundID);
                mDummy.PushActionExecuteCommand(ACTION_NEWLIST, DUMMY_UPDATEPOS, &v, 0, false);
                return;
            }

            if (v.HasCommand(DUMMY_HASSIREN))
            {
                System::Log("Stop sample via VcmdSiren");
                if (childID == 1)
                {
                    Game::ExecuteCommand(DUMMY_LIGHTS_DISABLE, &v, &v);
                }
                int CarID = v.GetUserData();
                int ref = v.GetUserData();
                v.UnattachSound(ref);
                Audio::StopSample(ref);
                int mSirTest;
                GameObjectList list = Game::GetGameObjects(NAME_DUMMYOBJECT);
                for(int i=0; i<list.GetNumObjects(); i++)
                {
                    GameObject *obj = list.GetObject(i);
                    if (obj->GetUserData() == CarID)
                    {
                        mSirTest = i;
                    }
                }

                GameObject *obj = list.GetObject(mSirTest);
                obj->PushActionDeleteOwner(ACTION_NEWLIST);

                if (v.HasCommand(DUMMY_HASSIREN))
                    v.RemoveCommand(DUMMY_HASSIREN);

                return;
            }
        }
    };

    object DummyUpdatePos : CommandScript
    {
        DummyUpdatePos()
        {
            SetGroupID(DummyGroup);
        }

        bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
        {
        }

          void PushActions(GameObject *Caller, Actor *Target, int childID)
        {
            Vehicle v(Target);
            GameObject mDummy(Caller);

            if (v.IsDestroyed() || !v.IsValid())
            {
                int ref = mDummy.GetUserData();
                mDummy.UnattachSound(ref);
                Audio::StopSample(ref);

                if (v.HasCommand(DUMMY_HASSIREN))
                    v.RemoveCommand(DUMMY_HASSIREN);

                mDummy.PushActionDeleteOwner(ACTION_NEWLIST);
            } else
              {
                if (v.IsCurrentAction(EACTION_FINDPATH))
                {
                    if (!v.HasCommand(DUMMY_FINDPATH))
                    {
                        v.AssignCommand(DUMMY_FINDPATH);
                    }
                }
                Vector vPos = v.GetPosition();
                mDummy.SetPosition(vPos);
                mDummy.PushActionExecuteCommand(ACTION_NEWLIST, DUMMY_UPDATEPOS, Target, childID, false);
              }

            if (v.HasCommand(DUMMY_FINDPATH))
            {
                if (!v.IsCurrentAction(EACTION_FINDPATH) && v.HasCommand(CMD_AUTOSIREN_OFF) && (v.GetNumActions() == 0 || v.IsCurrentAction(EACTION_EXTINGUISH)))
                {
                    if (v.HasCommand(DUMMY_HASSIREN))
                        v.RemoveCommand(DUMMY_HASSIREN);

                    if (v.HasCommand(DUMMY_FINDPATH))
                        v.RemoveCommand(DUMMY_FINDPATH);

                    int CarID = v.GetUserData();
                    int ref = v.GetUserData();
                    v.UnattachSound(ref);
                    Audio::StopSample(ref);

                    GameObjectList list = Game::GetGameObjects(NAME_DUMMYOBJECT);
                    for(int i = 0; i < list.GetNumObjects(); i++)
                    {
                        int mSirTest;
                        GameObject *obj = list.GetObject(i);
                        if (obj->GetUserData() == CarID)
                        {
                            mSirTest = i;
                            GameObject *obj = list.GetObject(mSirTest);
                            obj->PushActionDeleteOwner(ACTION_NEWLIST);
                            if (v.HasCommand(DUMMY_HASSIREN))
                                v.RemoveCommand(DUMMY_HASSIREN);
                            if (v.HasCommand(DUMMY_FINDPATH))
                                v.RemoveCommand(DUMMY_FINDPATH);
                        }
                    }
                }
            }
        }
    };

    object DummyDisableSiren : CommandScript
    {
        DummyDisableSiren()
        {
            SetGroupID(DummyGroup);
        }

        bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
        {
        }

          void PushActions(GameObject *Caller, Actor *Target, int childID)
        {
            Vehicle v(Caller);
            if (childID == 1)
            {
                v.EnableBlueLights(false);
            }

            //int CarID = v.GetID();
            int CarID = v.GetUserData();
            int ref = v.GetUserData();
            v.UnattachSound(ref);
            Audio::StopSample(ref);

            GameObjectList list = Game::GetGameObjects(NAME_DUMMYOBJECT);
            for(int i = 0; i < list.GetNumObjects(); i++)
            {
                GameObject *obj = list.GetObject(i);
                if (obj->GetUserData() == CarID)
                {
                    int mSirTest = i;

                    GameObject *obj = list.GetObject(mSirTest);
                    obj->PushActionDeleteOwner(ACTION_NEWLIST);

                    if (v.HasCommand(DUMMY_HASSIREN))
                        v.RemoveCommand(DUMMY_HASSIREN);
                    if (v.HasCommand(DUMMY_FINDPATH))
                        v.RemoveCommand(DUMMY_FINDPATH);
                    if (v.HasCommand(DUMMY_GETTIL))
                        v.SetUserData(v.GetID());
                }
            }
        }
    };

    object DummyFindPath : CommandScript
    {
        DummyFindPath()
        {
            SetGroupID(DummyGroup);
        }

        bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
        {
            return false;
        }

          void PushActions(GameObject *Caller, Actor *Target, int childID)
        {
        }
    };

    object DummyHasSiren : CommandScript
    {
        DummyHasSiren()
        {
            SetGroupID(DummyGroup);
        }

        bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
        {
            return false;
        }

          void PushActions(GameObject *Caller, Actor *Target, int childID)
        {
        }
    };
     

     

  4. Here is my folder containing all my most up to date public releases. The folder contains a "Credits" file which include proper credits. I will also attach one to this post. If there are any usage or crediting issues, please contact me so it an be rectified. I hope to update this post further with pictures and future updates.

    https://mega.nz/#F!oxdkBSYR!qrNUFRKbwRTSS2t2fipMWQ

    YouTube: https://www.youtube.com/user/TheMentor1159

    ** I work full-time hours at two departments and I am also in Paramedic school. Time is very limited to work so most updates will be far apart. Things will be updated and completed as time allows. **

     

    Credits.txt

  5. I don’t have the ability to provide pictures at the moment but I will do what I can. 

     

    You first need to locate all the model files for the associated vehicle. It should have a base model, doors and possibly wheels. 

     

    When you you make a copy of the base model, but not the doors, the doors on all the future models will share the door texture from the original, unless you make separate copies of the doors. 

     

    You must then make make sure that the individual model files are pointed to the right texture file or you will run into the same issue. 

  6. 15 hours ago, simking said:

    Maybe i am crazy but why are there no commands? on any of the vehicles or personnel?

    Bad install or that will happen if you load two mods without restarting the game first. Try it again with only loading harbor city and see if it persists. If it does, I would reinstall or even a fresh download and install.

  7. I am working on a call script, basically editing the battalion chief script from Hoppah's LA Mod. I am trying to make a mod that is based off of using this script to dispatch units. That being said, there is a few things I am having issues with.

    My stations are fully functional, such as, working gates, roof, alarm system, ability to call individual personnel.

    That being said here is the issues I wish to fix:

    - Disable alarm, vehicle staffing, gates, and roof at initial startup of game

    - Gates are setup properly, however, there is issues with the call script where vehicles may drive through a closed gate, or the script wont open the gate(Seems to happen when I manually open or close the gates with the control panel)

    - Tried creating a dummy script where I can deem a vehicle available or busy, in order to allow a vehicle to be dispatched if its returning from a call(Ex. When vehicle is dispatched, Dummy_Busy is assigned, Dummy_Available is removed. When ToStation is hit the opposite occurs.) I have been unable to seem to get this to work.

     

    My script is setup not to call a specific vehicle, but certain types, like Engine or medic or ladder. It finds the closest one and dispatches it. I have this part working properly besides the issues above. Any insight or fixes would be appreciated.

     

×
×
  • Create New...