Jump to content

Hoppah

Members
  • Posts

    7,379
  • Joined

  • Last visited

  • Days Won

    284

Posts posted by Hoppah

  1.  

    dyson created this!
     
    //******************************************************************************************
    // #Version 1.6#
    // Script by Dyson - Use in other mods is permited but credit is required
    //
    //******************************************************************************************
    int DummyGroup = 20;
    const char NAME_WATERCON[] = "hose_connection";
    const char NAME_HYDRANT[] = "hydrant";
    const char CMD_DUMMYATTACHFH[] = "DummyAttachFirehose";
    const char CMD_REMOVEFH[] = "RemoveFirehose";
    const char DUMMY_CHANGE[] = "DummyChange";
    const char AUDIO_HOSE[] = "mod:Audio/FX/equipment/hosecoupling.wav";
    const char PROTO_UFL[] = "mod:Prototypes/Objects/Equipment/firehose02.e4p";
    const char PROTO_SROHR[] =  "mod:Prototypes/Objects/Street/hydrant01.e4p";
     
     
    object AttachFHVehicle : CommandScript
    {
    AttachFHVehicle()
    {
    SetValidTargets(ACTOR_OBJECT | ACTOR_VEHICLE);
    SetPossibleCallers(ACTOR_PERSON);
    SetPossibleEquipment(EQUIP_FIREHOSE);
    SetIcon("AttachFireHose");
    SetCursor("AttachFireHose");
    SetPriority(120);
    }
     
    bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
    {
    if(!Caller->IsValid() || !Target->IsValid() || (Caller->GetID()==Target->GetID()))
    return false;
     
    Person c(Caller);
    if (c.GetEnteredCarID() != -1)
    return false;
     
    if(Target->GetType() != ACTOR_VEHICLE)
            return false;
     
     
                    Vehicle v(Target);
                    if(v.HasCommand(DUMMY_CHANGE))
                        return false;
     
    if(v.GetEnergy() > 0.1f * v.GetMaxEnergy() && v.HasChild(NAME_WATERCON))
    return true;
           return false;
    }
     
    void PushActions(GameObject *Caller, Actor *Target, int childID)
    {
                             Vehicle v(Target);
                             Caller->PushActionMove(ACTION_NEWLIST, v.GetChildPosition(NAME_WATERCON));
                             Caller->PushActionExecuteCommand(ACTION_APPEND, CMD_DUMMYATTACHFH, Target, 2, false);
    }
    };
     
    object DummyAttachFirehose : CommandScript
    {
    DummyAttachFirehose()
    {
                SetGroupID(DummyGroup);
    }
     
    bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
    {
    }
     
    void PushActions(GameObject *Caller, Actor *Target, int childID)
    {
       Person p(Caller);
                switch(childID)
                {
                  case 1 :
                  {
                     char wstring[5];
                     snprintf(wstring, 5, "%s", Target->GetName());
                     if(wstring[0]!='v' || wstring[1]!='e' || wstring[2]!='r' || wstring[3]!='t')
                     {
                            p.RemoveObjectInRightHand();
                            if(Target->GetType() == ACTOR_OBJECT || Target->HasName(NAME_HYDRANT))
                                    p.AssignCommand("AttachFHVehicle");
                            p.EnableAutoTarget(false);
                            
                      }
                      else
                      {
                            p.PlaceObjectInRightHand("mod:Models/Objects/Equipment/firehose02.v3o");
                            p.EnableAutoTarget(true);
                      }
                    }
                    break;
     
                    case 2 :
                    {
                            Vehicle v(Target);
                            if(p.GetBoundingRadiusDistXYToObject(&v) > 50.f)
                            {
                                Game::ShowHelpTextWindow("Vehicle too far away!");
                                return;
                            }
                            float r[9];
                            v.GetRotation(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8]);
                            p.SetPosition(v.GetChildPosition(NAME_WATERCON));
                            p.SetRotation(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8]);
                            p.SetAnimation("none");
                    p.EnableAutoTarget(false);
    //p.Deselect();
    p.SetFlag(OF_HIDDEN);
    //p.SetCommandable(true);
    Audio::PlaySample3D(AUDIO_HOSE, v.GetChildPosition(NAME_WATERCON));
    p.SetResistance(INJUREREASON_UNKNOWN, 100000.0f);
    p.SetResistance(INJUREREASON_CONTAM_ATOM, 100000.0f);
    p.SetResistance(INJUREREASON_CONTAM_CHEM, 100000.0f);
    p.SetResistance(INJUREREASON_CONTAM_BIO, 100000.0f);
    p.SetUserData(v.GetID());
    Person n = Game::CreatePerson(p.GetPrototypeFileName(), Caller->GetName());
    p.GetRotation(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8]);
    Vector PerPos = p.GetPosition();
    if (n.IsValid())
    {
    Game::FindFreePosition(&n, PerPos, 100.f);
    n.SetPosition(PerPos);
    //n.SetRotation(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8]);
    n.SetPlayerMP(p.GetPlayerMP());
    n.SetHealth(p.GetHealth());
    n.SetUpgradeLevel(3);
    if(p.IsSelected())
    {
                                         n.Select();
                                         p.Deselect();
                                    }
                                    char wstring[6];
                                    snprintf(wstring, 6, "%s", v.GetName());
                                    wstring[0] = '0';
                                    int vID = atoi(wstring);
                           char nstring[9];
                                   snprintf(nstring, 9, "vert%i", vID);
                                    GameObjectList list = Game::GetGameObjects(nstring);
                                    for(int i = 0; i < list.GetNumObjects(); i++)
           {
        list.GetObject(i)->AssignCommand(CMD_DUMMYATTACHFH);
           }
    }
    Game::ShowHelpTextWindow("Engine Hooked Up to Hydrant");
                     }
                     break;
     
                     case 3 :
                     {
                    
                          Vehicle v(Target);
                          Person p(Caller);
                          float r[9];
                          p.GetRotation(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8]);
                          GameObjectList list = p.GetObjectsInRange(400.0f, ACTOR_PERSON);
         for(int i = 0; i < list.GetNumObjects(); i++)
         {
                                  Person n = list.GetObject(i);
          if (n.GetUserData() == v.GetID())
    {
    n.ClearFlag(OF_HIDDEN);
    n.PushActionSwitchAnim(ACTION_NEWLIST, "idle");
    if (p.IsSelected())
    n.Select();
    n.SetUserData(0);
    if(StrCompare(n.GetPrototypeFileName(), p.GetPrototypeFileName())!=0)
    {
        n.ChangeModel(p.GetModelFileName());
        n.AssignCommand(DUMMY_CHANGE);
                                            }
    n.SetResistance(INJUREREASON_UNKNOWN, 0.0f);
    n.SetResistance(INJUREREASON_CONTAM_ATOM, 0.0f);
    n.SetResistance(INJUREREASON_CONTAM_CHEM, 0.0f);
    n.SetResistance(INJUREREASON_CONTAM_BIO, 0.0f);
    n.SetPosition(p.GetPosition());
    n.SetRotation(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8]);
    p.PushActionDeleteOwner(ACTION_NEWLIST);
    n.PushActionExecuteCommand(ACTION_APPEND, CMD_REMOVEFH, &n, 0, false);
    char wstring[6];
                                            snprintf(wstring, 6, "%s", v.GetName());
                                            wstring[0] = '0';
                                            int vID = atoi(wstring);
                                   char nstring[9];
                                           snprintf(nstring, 9, "vert%i", vID);
                                            GameObjectList list = Game::GetGameObjects(nstring);
                                            for(int i = 0; i < list.GetNumObjects(); i++)
                   {
                                                  Vehicle vert = list.GetObject(i);
                 vert.RemoveCommand(CMD_DUMMYATTACHFH);
                 if(vert.GetNumUsedConnectors()>1)
                 {
                                                        Game::ShowHelpTextWindow("Water Supply Needed");
                                                        /*GameObjectList list2 = vert.GetObjectsInRange(3000.0f, ACTOR_PERSON);
                                                        for(int a = 0; a < list2.GetNumObjects(); a++)
                                       {
                                                             Person ff = list2.GetObject(i);
                                                             GameObject hydrant = ff.GetHydrant();
                                                             if(hydrant.GetID() == vert.GetID());
                                                                  ff.PushActionExecuteCommand(ACTION_NEWLIST, CMD_REMOVEFH, &ff, 0, false);
                                                        } */
                                                  }
                   }
                          }
         }
                     }
                     break;
     
                     case 4 :
                     {
                         Vehicle v(Target);
                         if(v.GetNumUsedConnectors()>0 && !v.HasCommand(CMD_DUMMYATTACHFH) && !v.HasName(NAME_SROHR))
                                 Game::ShowHelpTextWindow("Water Supply Needed");
                         else
                         {
                                 Caller->PushActionCheckFreeConnector(ACTION_APPEND, Target);
                        Caller->PushActionUseEquipment(ACTION_APPEND, Target, childID, 1.0f);
                Caller->PushActionExecuteCommand(ACTION_APPEND, CMD_DUMMYATTACHFH, Target, 1, false);
                         }
                      }
                      break;
     
                      case 5 :
                      {
                         Vehicle v(Target);
                         if(v.GetNumUsedConnectors()==0)
                         {
                                 Caller->PushActionCheckFreeConnector(ACTION_APPEND, Target);
                       Caller->PushActionUseEquipment(ACTION_APPEND, Target, childID, 1.0f);
                       p.PlaceObjectInRightHand("mod:Models/Objects/Equipment/firehose02.v3o");
                         }
     
                      }
                      break;
     
                      case 6 :
                      {
                            GameObject g(Target);
                            float r[9];
                            g.GetRotation(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8]);
                            System::Log("wFreeplayLog: Placing Standrohr");
                            Vehicle s = Game::CreateVehicle(PROTO_SROHR, NAME_SROHR);
                            if (s.IsValid())
    {
       s.SetRotation(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8]);
                       s.SetPosition(Target->GetPosition());
                            }
    int PlayerID = Caller->GetPlayerMP();
    s.SetPlayerMP(PlayerID);
    Caller->PushActionUseEquipment(ACTION_APPEND, &s, childID, 1.0f);
           Caller->PushActionExecuteCommand(ACTION_APPEND, CMD_DUMMYATTACHFH, &s, 1, false);
                         }
                         break;
                }
    }
    };

     

     

    I believe he took it the majority from another modification, but oh well, what's your point of posting this? If I'm not mistaken, this script has a command to attach a supply line to a vehicle, while in my demo mod this feature is entirely incorporated in and merged with the 'attach hose' script.

  2. Hoppah have in mind to make a scritp to attach a tank to another tank??

     

    2 tanks that collide, you can find that here: http://www.ventube.com/wp-content/uploads/2012/10/HD-Tank-Collision-Wallpaper-Backgrounds.jpeg To attach them you need welding equipment however.

     

    Seriously:

     

    I do think it's possible, but it's not on my to-do list yet. I don't have a tanker model either, but I guess you could hook up a hose to the tanker first and then to the fire engine's supply line connector to get it work.

     

    Make me beautiful tanker, I make you beautiful script.

  3.  

    //******************************************************************************************
    // #Version 1.1#
    //
    // Script by Hoppah
    //
    // Usage of this script in other mods is NOT allowed without permission of Hoppah
    //
    //******************************************************************************************
     
    bool OnLoad()
    {
    start();
    System::SetEnv("e4_doocclusion", 0);
    Process::Kill();
    return true;
    }
     
    void start()
    {
    GameObjectList l1("fs1_cp");
    if (l1.GetNumObjects() > 0)
    {
    GameObject Obj = l1.GetObject(0);
    Game::ExecuteCommand("VcmdStart", &Obj);
    }
     
    GameObjectList l2("random_check");
    if (l2.GetNumObjects() > 0)
    {
    GameObject obj = l2.GetObject(0);
    obj.SetUserData(1);
    obj.Hide();
    Game::ExecuteCommand("RandomSpawn", &obj);
    }
    };
     
    Help as is??

     

     

    Did u actually read the guide? It clearly says you have to add a part, but you didn't even try. It really aint that hard.  :huh:

     

    Use this:

    bool OnLoad(){	start();	System::SetEnv("e4_doocclusion", 0);	Process::Kill();	return true;}void start(){	GameObjectList l3("water_supply_main");	if(l3.GetNumObjects() > 0)	{		GameObject Obj1 = l3.GetObject(0);		Game::ExecuteCommand("DummyCheckWaterSupply", &Obj1);		System::Log("WATER, Start DummyCheckWaterSupply");	} else	System::Log("WATER, Can not find object with name: water_supply_main");	GameObjectList l1("fs1_cp");	if (l1.GetNumObjects() > 0)	{		GameObject Obj = l1.GetObject(0);		Game::ExecuteCommand("VcmdStart", &Obj);	}	GameObjectList l2("random_check");	if (l2.GetNumObjects() > 0)	{		GameObject obj = l2.GetObject(0);		obj.SetUserData(1);		obj.Hide();		Game::ExecuteCommand("RandomSpawn", &obj);	}}; 

  4. Important message:

     

    This demo mod and its script logic is NOT fully compatible with the LA Mod. The fire engine's in the LA Mod make use of a custom hose connection script which is not compatible with the limited water logic. I can't really take all the custom stuff into account, can I? That would make the scripts way too complicated again.

     

    In order to make the LA Mod's fire engines compatible with the limited water supply logic, you will need to change the fire engine's vehicletype to GTF, remove the deck gun superchild and add 4 hose connection superchilds. After that, see if everything works and then use a custom deck gun script to also get a functional deck gun again. The demo mod comes with custom deck gun script, but that one has to be changed to work with the LA Mod's fire engine's.

  5. Freeplay and Challenge mode give the same error,

    Here is the script

     

    bool OnLoad()

    {

        start();

        System::SetEnv("e4_doocclusion", 0);

        Process::Kill();

        return true;

    }

    void start()

    {

    GameObjectList l1("water_supply_main");

        if(l1.GetNumObjects() > 0)

        {

            GameObject Obj = l1.GetObject(0);

            Game::ExecuteCommand("DummyCheckWaterSupply", &Obj);

            System::Log("WATER, Start DummyCheckWaterSupply");

        } else

            System::Log("WATER, Can not find object with name: water_supply_main");    

    {

        GameObjectList l1("fire_station_controlpanel");

        GameObject Obj = l1.GetObject(0);

        Game::ExecuteCommand("VcmdStart", &Obj);

        

        GameObjectList l2("spawn_check");

        if (l2.GetNumObjects() > 0)

        {

            GameObject obj = l2.GetObject(0);

            Game::ExecuteCommand("VcmdTillerCheck", &obj);

            obj.SetSelectable(false);

        } else

            System::Error("Spawn_check not found!");

    };

     

    There is one { too much and GameObjectList l1 exists twice (first to get 'water_supply_main', then again to get 'fire_station_controlpanel').

     

    So try this one:

    bool OnLoad(){	start();	System::SetEnv("e4_doocclusion", 0);	Process::Kill();	return true;}void start(){	GameObjectList l3("water_supply_main");	if(l3.GetNumObjects() > 0)	{		GameObject Obj1 = l3.GetObject(0);		Game::ExecuteCommand("DummyCheckWaterSupply", &Obj1);		System::Log("WATER, Start DummyCheckWaterSupply");	} else        System::Log("WATER, Can not find object with name: water_supply_main");	GameObjectList l1("fire_station_controlpanel");	GameObject Obj = l1.GetObject(0);	Game::ExecuteCommand("VcmdStart", &Obj);		GameObjectList l2("spawn_check");	if (l2.GetNumObjects() > 0)	{		GameObject obj = l2.GetObject(0);		Game::ExecuteCommand("VcmdTillerCheck", &obj);		obj.SetSelectable(false);	} else		System::Error("Spawn_check not found!");};
  6. Doesn't crash on me either. I've got it set up and working in the Manhattan Mod, however the script only recognises the deck gun as an outsource and wont recognise the hydrant hookup as an intake..

     

    The mod runs on the same system as the LA mod, and as far as I'm aware pretty much the same hydrant connect system.

     

    Yes, but the hydrant connection system in this demo mod isn't the same as in LA Mod, where a custom script is used to spawn the connectors. In this demo mod, as well as the US Army Mod, it's the other way around. Instead of the custom connectors on a TLF vehicletype, a custom deck gun script is being used for GTF vehicletypes. I did this, so the deck gun's autotargeting functionality isn't enabled by default and so I could spawn a deck gun controller on top of the vehicle to add a little more realism. So if you want to get this script to work in the Manhattan Mod, you will have to change the fire engines, change their types to GTF, add the hose connectors as a superchild (remove the current cannon superchild) and create a custom deck gun script, like the one in this demo mod. Same thing for the LA Mod actually.

  7. Demo looks great. Freeplay crashed on load, so I don't know if you hadn't finished it in the last upload. Also noticed that you had the "guy on cannon" set up for those engines, nice to see that it can work for existing engines.

     

    What did you come up with for connections to ladder trucks or the LAX Crash engine (though I'm assuming some prototype editing will be needed)? I thought of the humorous situation that will happen with the brush truck. One guy on the hose, then we'd have a guy waiting with a supply hose so when the tank is empty they'd have to switch to refill.

     

    Also, anyone that has ideas for good values that get as close to how many lines a pump can support without draining the tank, please post.

     

    Hmm, I did finish the freeplay part and it doesn't crash on me. Do more people experience this?

  8. Tem um problema hoppah,erro sintx???

     

    ?

     

    No hablo español.

     

    But it's not hard to guess what you were trying and you're code will not work because it executes the wrong command. Like I said before, I'll post instructions tomorrow. It's fairly easy to implement this into another mod, you just need to know which files you gotta copy.

     

     

    Just some interesting playing around i did until hoppah gives us instruction to add this to other mods ( I tryed didn't go so well so now im waiting! ) 

     

    Based off the US general pump rated of 1000 Gallons / Minute I found that with the following settings 

    int MAX_WATER_TLF	 		= 1300;int MAX_WATER_LPF	 		= 400;int MAX_WATER_GTF	 		= 1000;int MAX_WATER_DLK	 		= 500;int OUTTAKE_HOSE 			= 30;	//outtake per secondint OUTTAKE_TLF_CANNON 		= 50;int OUTTAKE_LPF_CANNON 		= 50;int OUTTAKE_DLK_CANNON 		= 50;int INTAKE_SUPPLYLINE 		= 80;

    You can run 3 hose lines at a time with out depleting your water source( 4 or more will work until the tank is empty ), Or you can run one hose line and the deck cannon. ( 2 ore more hose lines and the deck cannon works until the tank is empty)

     

    With this it ads more to the script to limit just how much water you can flow, Hydrants have limits to you know! 

     

    That's cool. Glad to see some people are playing around with the scripts. That's exactly why those values can be found on top, so you can change them easily. :) It kinda depends how much realism you want. To keep a better gameplay balance, I would've personally turned those outtake values a bit down so the water tank doesn't empty in only 10-11 seconds with 3 hoses.

  9. :OOOOO. Hoppah you're epic  :D

     

    Question: So in the freeplay all vehicles that are TLF, LPF or GTF can have limited water supply? 

     

     

    Yes, the script runs in the background and automatically recognizes those vehicle types and assignes the limited water supply logic to them. I'm currently making it compatible with DLK types too, because I forget about the basket's water cannon.

     

     

    Hai,

     

    Looks great!!! But unfortunately for you this script was once made by a german modder for freeplay too...

    But this one is less buggy i hope!

    Can't wait to use it!

     

    Why would it be 'unfortunately'? I'm not claiming I'm the first one to do this and I can't really care about it either. Hell, the first post even mentions something about other mod-creators doing a similar logic. I wrote my own scripts so I could alter it to my own wishes (for the US Army Mod and NYC Mod) and so I could release a version to the public without having to deal with possible copyright claims. As far as I know, my script isn't buggy at all and works flawlessly. The only possible issue might be a performance issue when you're dispatching like 20 fire engine's, but I haven't tested that yet.

     

     

    Oh great and powerful Hoppah we thank your for your work. Would it be possible to make trucks connect to each other so something like a tanker could be made practical. Since I''m not sure of your familiarity with US fire engines it might work like this. A truck with a 500 gallon tank attacks a fire and soon the tank drops to 200. A tanker arrives and is connected to the first truck, the tanker has a 2000 gallon tank. The water level in the tanker now starts to drop while the water level in the first truck stays steady (since the water is now coming from the tanker). Once the tanker is out of water the water level in the first truck starts to drop again. In theory could this be done? I can think of at least one mod that would benefit greatly from a functional tanker script.

     

    I do think it's possible, but it's not on my to-do list yet. I don't have a tanker model either, but I guess you could hook up a hose to the tanker first and then to the fire engine's supply line connector to get it work.

     

    Hoppah

  10. @ NathanDollinger,

     

    Nice try, but that's not gonna work I'm afraid. If you'd execute your command the second time, it will reset the water level back to ETL (1000). The script has to be set up to check the water levels like once per second so it can update and save the water level for each vehicle and thats not very easy to realise. One of the few ways to do that is using a hidden dummy object which keeps track of the vehicles.

     

    However, I've got some good news. Got a little bit bored today and did it myself. That means:

     

    You can have limited water supply in freeplay too now

     

    So shit just got real.

     

    Pictures first:

     

    Original TLF on the default EM4 freeplay map:

    wu2rk4.jpg
     
    Fire Engine with supply line on the EM4 deluxe map:
    206n5g1.jpg

     

    As you can see the vehicles have an extra command (instead of the information panel) which shows the relative water tank level in 100, 80, 60, 40, 20 or 0% by changing the icons. In game, you can click the command and it will inform you of the actual water levels in gallon and the exact relative amount (as shown in the screenshots too). To make the logic as useful as possible for everyone, I decided to use the vehicleclasses (TLF, LPF and GTF) as references for the maximum water tank amounts. That means it should work with ALL vehicles that are either a TLF, LPF or GTF type and that's it. Other than that, the limited water supply works the exact same as in the demo mission, although the logic is implemented differently. I still need to give the freeplay logic a few extra tests and will release the entire functionality tonight or tomorrow.

     

    Hoppah

  11. Not quite right Hoppah.  American fire engines have a LIMITED tank.  Usually somewhere between 500 and 1000 gallons.  Many times the tank is equal or smaller than the pump capacity (i.e. 1250 gpm (gallons per minute)).  This allows for a truck to fast attack a small fire (garbage / car) without having to first connect to a hydrant, and give the crew a little time to get the hydrant line connected.

     

    Thanks. :)

     

     

    Almost got the 'rapid deployment' command to also automatically install and deinstall the supply line. I will release this minor addition soon.

     

    Edit 1:

    You can find the 'rapid deployment' compatibility files in the attachment. Simply unrar the package and move the files to your "\Mods\Limited Water Supply Test Mod\Scripts\Game\Command\" folder and overwrite the older files. This addition does need some extra testing (I got a ton of CTD's before I got it to work), but it should work fine in general. When clicking the 'rapid deployment' command, one of the fire fighters should install the supply line first now, before he attaches his own hose. Same thing for the reversed command basically.

     

    Edit 2:

    Also managed to get the gated wye to work with the limited water functionality. Seems to work fine. I'll re-release the entire demo mod with the new additions in a few days again.

     

    Hoppah

    RapidDeployment.rar

  12. As i said next to number one  "Possibly even a different script for each truck would be necessary to keep track of its water level better"

    Thinking about it further i would about say that is with out a doubt the best option, Each truck with its own script would make for a simplistic start to finding a solution!

     

    Hoppah could you break down the part of the code that dose adding and subtracting? I don't really know the mission scripting stuff but if i had the basics to put in to a command script i might be able to play around with it a bit better!

     

    Sure,

     

    The following part gets all the GTF type vehicle in a vehiclelist, then checks per found vehicle if there are any active hoses, deck guns or suppy lines. Then changes the water level, and -when required- disables (or re-enables) the hose connections or deck gun(s) when the tank is empty.

     

    VehicleList fflist(VT_FIREFIGHTERS_GTF, VT_FIREFIGHTERS_GTF);for(int i = 0; i < fflist.GetNumVehicles(); i++){		if (fflist.GetVehicle(i)->HasCommand("DummyLimitedWater"))	{		int numActiveHoses = 0;		int numActiveCannons = 0;		int numSupplyLines = 0;		int Outtake = 0;		int Intake = 0;		Vehicle veh(fflist.GetVehicle(i));		if (veh.HasCommand("DummyWaterSupplyOn"))			numSupplyLines++;		if (veh.GetVehicleType() == VT_FIREFIGHTERS_GTF && veh.IsInstalled())		{			PersonList Pconnected(ROLE_SQUAD);			for(int k = 0; k < Pconnected.GetNumPersons(); k++)			{				if (Pconnected.GetPerson(k)->GetEquipment() == EQUIP_FIREHOSE && Pconnected.GetPerson(k)->GetType() == ACTOR_PERSON && Pconnected.GetPerson(k)->GetFirehoseID() != 0 && !Pconnected.GetPerson(k)->IsFlagSet(OF_HIDDEN))				{					Vector TargetPos;					GameObject Phydrant = Pconnected.GetPerson(k)->GetHydrant();					if (Phydrant.GetID() == veh.GetID())					{						Person p(Pconnected.GetPerson(k));						if (p.IsCurrentAction("EActionExtinguish") || p.IsCurrentAction("EActionCool"))							numActiveHoses++;					}				}			}		}		if (veh.HasCommand("VcmdWaterSwitch") && veh.IsCurrentAnimation("activate"))		{			GameObjectList cannonlist = Game::GetGameObjectsWithPrefix("engine_water_cannon");			for(int j = 0; j < cannonlist.GetNumObjects(); j++)			{				Vehicle cannon = cannonlist.GetObject(j);				if (cannon.GetUserData() == veh.GetID() && (cannon.IsCurrentAction("EActionExtinguish") || cannon.IsCurrentAction("EActionCool")))					numActiveCannons++;			}		}		Intake = numSupplyLines*INTAKE_SUPPLYLINE;		Outtake = numActiveHoses*OUTTAKE_HOSE+numActiveCannons*OUTTAKE_CANNON;		if (veh.GetID() == mEngine01.GetID())		{			Engine01Level = Engine01Level+Intake-Outtake;			if (Engine01Level < 20)				veh.AssignCommand("DummyEmptyTank");			if (Engine01Level > MAX_WATER_ENGINE01)				Engine01Level = MAX_WATER_ENGINE01;			else if (Engine01Level < 0)				Engine01Level = 0;		}		if (veh.GetID() == mEngine02.GetID())		{			Engine02Level = Engine02Level+Intake-Outtake;			if (Engine02Level < 20)				veh.AssignCommand("DummyEmptyTank");			if (Engine02Level > MAX_WATER_ENGINE02)				Engine02Level = MAX_WATER_ENGINE02;			else if (Engine02Level < 0)				Engine02Level = 0;		}		if (veh.HasCommand("DummyEmptyTank"))		{			PersonList Pconnected(ROLE_SQUAD);			for(int k = 0; k < Pconnected.GetNumPersons(); k++)			{				if (Pconnected.GetPerson(k)->GetEquipment() == EQUIP_FIREHOSE && Pconnected.GetPerson(k)->GetType() == ACTOR_PERSON && Pconnected.GetPerson(k)->GetFirehoseID() != 0 && !Pconnected.GetPerson(k)->IsFlagSet(OF_HIDDEN))				{					Vector TargetPos;					GameObject Phydrant = Pconnected.GetPerson(k)->GetHydrant();					if (Phydrant.GetID() == veh.GetID())					{						Person p(Pconnected.GetPerson(k));						if ((veh.GetID() == mEngine01.GetID() && Engine01Level < 20) || (veh.GetID() == mEngine02.GetID() && Engine02Level < 20))						{								if (p.IsCommandEnabled("Extinguish"))							{								p.EnableCommand("Extinguish", false);								p.EnableCommand("Cool", false);								p.EnableAutoTarget(false);								p.ClearActions();								p.PushActionWait(ACTION_NEWLIST, 2.f);							}						} else						{							p.EnableCommand("Extinguish", true);							p.EnableCommand("Cool", true);							p.EnableAutoTarget(true);						}					}				}			}			if (veh.HasCommand("VcmdWaterSwitch") && veh.IsCurrentAnimation("activate"))			{				GameObjectList canlist = Game::GetGameObjectsWithPrefix("engine_water_cannon");				for(int j = 0; j < canlist.GetNumObjects(); j++)				{					Vehicle can = canlist.GetObject(j);					if (can.GetUserData() == veh.GetID() && ((veh.GetID() == mEngine01.GetID() && Engine01Level > 20) || (veh.GetID() == mEngine02.GetID() && Engine02Level > 20)))					{						can.EnableAutoTarget(true);					} else					{						can.EnableAutoTarget(false);						can.ClearActions();						can.PushActionWait(ACTION_NEWLIST, 2.f);						System::Log("Disable cannon");					}				}			}			if (veh.GetID() == mEngine01.GetID() && !Engine01Empty)			{				Engine01Empty = true;				Game::ShowHelpTextWindow("Water tank of Local Fire Truck is empty!");			}			if (veh.GetID() == mEngine02.GetID() && !Engine02Empty)			{				Engine02Empty = true;				Game::ShowHelpTextWindow("Water tank of Local Fire Truck is empty!");			}			if ((veh.GetID() == mEngine01.GetID() && Engine01Level > 20) || (veh.GetID() == mEngine02.GetID() && Engine02Level > 20))			{				veh.RemoveCommand("DummyEmptyTank");				if (veh.HasCommand("Extinguish"))					veh.EnableCommand("Extinguish", true);				if (veh.HasCommand("Cool"))					veh.EnableCommand("Cool", true);				if (veh.GetID() == mEngine01.GetID() && Engine01Empty)					Engine01Empty = false;				if (veh.GetID() == mEngine02.GetID() && Engine02Empty)					Engine02Empty = false;			} else			{				if (veh.HasCommand("Extinguish"))					veh.EnableCommand("Extinguish", false);				if (veh.HasCommand("Cool"))					veh.EnableCommand("Cool", false);			}		}	}}

     

    The part below this code in the missionscript is only dedicated to the visual aspect, the information panel.

  13. This is so very frustrating as a moder, and EM4 player this in freeplay would be so great, However it acts to escape  every one!

     

    Here has what i came up with, and maybe will give some with more knowledge and skill a way to look!

     

    1. The best way would be to assign a tank level to one class of units, ( Possibly even a different script for each truck would be necessary to keep track of its water level better )

    2. Then have preset way of adding and subtraction between 0 ( tank empty ) and the tank full level ( W/E Its set at )

    3. To update on tank level you could do a text at the top of the screen or as hoppah suggested icons ( However i think this is the lest import aspect of the script)

    4.  Lag would be a potential problem due to the fact that each truck is constantly updating its water level

    5. A code idea ( i am fully aware that this is not actually right it is just a brain storm! )

     

    const char ETL[]				=  "1000";const char OUTTAKE_HOSE 			= 6;const char OUTTAKE_CANNON 			= 10;const char INTAKE_SUPPLYLINE 		= 24;object VcmdWaterLVL : CommandScript{	VcmdWaterLVL()	{				SetGroupID(DummyGroup); 		SetGroupLeader(true);			}Vehicle v(Caller);		if (v.GetVehicleType() == VT_FIREFIGHTERS_GTF)			// Some how set Water level ( ETL )		if (v.HasCommand(DUMMY_HOSESON))		// some how set OUTTAKE_HOSE		if (v.HasCommand(WaterOn))		// some how set OUTTAKE_CANNON 

     

    Please any suggestions or ideas off this would be welcomed 

    between all of us we can make it work, Even with a little lag! 

     

    Ideas ??

     

    Appreciate the input, but even with classes of units the game still has to check each individual vehicle because each vehicle must have an individual unique water tank. The problem is not how the game shows the update to the player, but how updating the water tanks is done in the background and how the water levels of EACH tank/vehicle are stored and saved. The way of adding and subtraction can be copied from the demo I made which is not really a problem.. :)

     

    I do have a couple of ideas though, which I will look into later.

  14. Hoppah,

     

    Very good. Been waiting for this for a while! Any chance you could set up engine to engine supplies to where the water from the hydrant will supply both units simultaneously? Also I would really like to see this put into other mods. could the mod creator build a patch for mods with it?

     

    Well, there's plenty of improvement options left. One them would be your idea. Another one would be an improved 'rapid deployment' command, so a 5th fire fighter automatically installs a water supply line (hydrant to engine). That one would be great for American mods, because most American fire engine's do not have a water tank at all (right?  :blush: ), so you will HAVE TO to install a water supply line before you can use any hoses or the deck gun to maintain this level of realism.

     

    A third idea would be gated wye compatibility.

     

    We'll see what I can achieve in the future to further improve this demo mod. At least the base is there, but I first want to focus on the US Army Mody again.

  15. Personally, I'm not convinced that the map is the root of performance and crash issues. I think it mostly comes from the extreme resources devoted to vehicle models and textures (and probably the complex lighting to some degree). The vehicle model folder is almost the same size as the rest of the model folders put together.

     

    I know accuracy and quality is important to the team, but gameplay and stability is more important to an end-user. I know Hoppah at one point made a suggestion on how to cut down on the size of either models or textures; there has to be some compromise that can be made.

     

     

    Nope it's the map ;) we have another SD version out that intel users can play, its essentially the same minus the big map

     

    I kinda have to agree with Hereweard Fyning here. While I'm sure the mod runs better for Intel players because of the map, but that doesn't mean ALL performance issues were or still are caused by the map alone.

     

    I do believe that the main performance issues are also caused by the model and textures sizes (vehicles and buildings mostly), as well as the insane amount of lights used on vehicles. Therefore, the advice that I gave a couple of months ago still stands: spend more time on downsizing models and textures (instead of adding new stuff that'll only make the mod even more unstable) and the mod should run much better. 

     

    The highly detailed models are the direct reason why it takes so long to load the mod (not the map, just the mod itself) compared to other mods. Upon loading a mod, the game precaches ALL playable units (see logfile) which means it loads all the prototype files and the corresponding models and textures.

     

    Same thing why it takes so long to load the map, because the game loads ALL objects that are present on the map and precaches the prototypes, models and textures too. Simply check out the logfile if you don't believe me.

     

    Conclusion: most, if not all performance related issues and crashes could've been resolved if v3.0 was released a week later. Emergency 4 does not run on an engine that is set up for highly detailed models and big textures and Manhatty Mody is the best example which proofs that. It's up to the team what to do with my advice and if you're willing to make concessions to people with lower end computers. I think the SD version shouldn't be necessary at all and it kinda feels like I do not get the whole package if my pc would only run this SD version. A mod that runs smooth for most players will definately be more appealing, more popular and would create a whole lot more goodwill.

     

    Hoppah

  16. So to put this into lets say montana  mod i just drag and drop? (Im dumb when it comes to modding)

     

    Absolutely not. The first post already mentioned that the entire logic is specifically set up for 2 fire engine's (as shown in the demo) in a missionscript. Unless you have plenty of scripting experience, it's nearly impossible to implement this into another mod. The logic is not compatible with freeplay either, while the majority of the mods are built for the freeplay modes.

     

    The reason why I released this demo is to show people the functionality and give others an opportunity to play with the code. I do believe there is a workaround to get this logic to work in freeplay too (without the interface elements obviously) and people are free to give it a shot. The biggest concern to get this code to work in freeplay would be the way the tank volumes for each vehicle are kept and saved ánd how often the volumes are monitored realtime to check if hoses or deck guns are active so the volumes can be changed almost realtime (there's IMO a risk of lag when 20 fire trucks are being monitored twice a second in the background). 

     

    In the missionscript that comes with this demo, the watertank volumes are stored as simple integers (like: "int MAX_WATER_ENGINE01 = 2000;" for the tank volume of one of the engine's). As soon hoses or the deck gun are being used, the missionscript simply changes the integer almost realtime by subtracting/adding the calculated water out-/intake. For freeplay, you're unfortunately stuck to commandscripts and it would be more complex to get the same logic to work. It's definately not possible to add interface elements to freeplay, since only missionscripts can load the xml dialogs. A workaround for that would be using commandicons to inform players what the relative tank volume is (like 10, 20, 30 percent etc..), but like I said, that's not the biggest concern. Hopefully, a workaround will be found. :)

     

    Hoppah

×
×
  • Create New...