Hoppah Posted August 14, 2013 Report Share Posted August 14, 2013 Dear forumbuddy's, As some of you may have read in the US Army Mod topic, I have made a script that limits water supply for fire engine's. A functionality that's been widely requested on the forums here to make the game more realistic. Due to the popularity of this functionality, I decided to make a demo using the logic from the US Army Mod and two FDNY Engine's taken from the New York City Mod made by Mikey_PI and associates. The first screenshot shows the functionality in the demo mission. The second screenshot shows the functionality in a freeplay mode. Can I use this logic in my mod? Yes, the entire idea of this demo is to distribute it, so you may copy the entire script and interface objects to your mod and release it for public. I'd appreciate if you'd credit me (Hoppah) for the logic though. Consult the attached file 'Limited Water Supply Logic - Mod Implementation Guide.pdf' for further instructions or take some time to read the topic for further details regarding implementation. Bugs - The fire fighter who spawns outside to control the pump of a fire engine may not be recognized by the vehicle sometimes, resulting in connected firehoses not working. To fix this, simply select the fire fighter and click on the fire engine to activate the pump again. - In a rare occasion, the water tanker may not be recognized by the script, resulting in a water tanker with fire engine traits (1000 gallon tank for example) and not being able to supply other vehicles. Especially after playing freeplay directly after the demo mission may cause this problem. Credits Mikey_PI: FNDY Fire Engine models and FDNY Fire Fighter textures Freakinmusket: Water Tanker model Hoppah: All Interface changes and limited water supply logic/scripts Note: I am aware other mod-creators have made a similar logic before. No interface elements nor script codes in this modification were taken from other modifications. The entire logic is made by myself, so I could alter it to my own wishes and make a public release without any problematic copyright claims. Feedback would be appreciated! Limited_Water_Supply_Test_Mod-v1-2-by_Hoppah.rar Limited Water Supply Logic - Mod Implementation Guide v1.2.pdf Hoppah 2 Quote Link to comment Share on other sites More sharing options...
Wkboy714 Posted August 14, 2013 Report Share Posted August 14, 2013 Hey Hoppah,I tried your demo mission and was impressed. It all seems to work perfectly Would it work for gated wyes?I do hope someone can work out how to transfer this into a script that can be added into freeplays, it'd be amazing. Quote Link to comment Share on other sites More sharing options...
Hoppah Posted August 14, 2013 Author Report Share Posted August 14, 2013 No, this script is not compatible with gated wye's yet, but I'm sure it's possible to get that to work. Glad someone likes the demo. 1 Quote Link to comment Share on other sites More sharing options...
Freelancer Posted August 14, 2013 Report Share Posted August 14, 2013 Finally thanks Hoppah for this! Freelancer Quote Link to comment Share on other sites More sharing options...
CFDDIVE11 Posted August 14, 2013 Report Share Posted August 14, 2013 So to put this into lets say montana mod i just drag and drop? (Im dumb when it comes to modding) Quote Link to comment Share on other sites More sharing options...
Hoppah Posted August 14, 2013 Author Report Share Posted August 14, 2013 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 Quote Link to comment Share on other sites More sharing options...
Dyson Posted August 15, 2013 Report Share Posted August 15, 2013 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 From what I've seen in it it's relatively simple to follow, but mission scripts are so alien to me I'm struggling to extract a command script to work from, this has well and truly stumped me. I need to learn more about missionscripts before even approaching this I think x Quote Link to comment Share on other sites More sharing options...
theparanoid Posted August 15, 2013 Report Share Posted August 15, 2013 very nice. There got be a way to do this is freeplay. Reason begin it been done. Winterberg has limit water supply for several years now. However I seem to recall that they went to studio at one point and got help from the game designers. Quote Link to comment Share on other sites More sharing options...
Rascle_08 Posted August 16, 2013 Report Share Posted August 16, 2013 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? Quote Link to comment Share on other sites More sharing options...
Hoppah Posted August 16, 2013 Author Report Share Posted August 16, 2013 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? ), 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. Quote Link to comment Share on other sites More sharing options...
Rascle_08 Posted August 16, 2013 Report Share Posted August 16, 2013 the only problem for me would be that if you used that rapid deployment feature as such, the application in rural areas would not work as the ff would try to go to the closest hydrant unless you set up the gated wye so that you have a layout feature instead of rapid deployment and you can have rural layout where the ff grabs the wye and sets it out for supply or urban layout where he finds the hydrant closest Quote Link to comment Share on other sites More sharing options...
Guest e34p Posted August 16, 2013 Report Share Posted August 16, 2013 Looks good Hoppah!If we weren't so close to release for the Welfordshire mod, I would look into it for version one. Our mod uses freeplay so I'd have to look into possibly using the commandicon percentage idea. Maybe an idea for version two haha!Great work though, well done! Quote Link to comment Share on other sites More sharing options...
Axxif Posted August 17, 2013 Report Share Posted August 17, 2013 Hmmm... would it be possible to set up a dump tank? That could solve the issue with rural departments, and could even be useful in the US Army mod Quote Link to comment Share on other sites More sharing options...
NathanDollinger Posted August 17, 2013 Report Share Posted August 17, 2013 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 level5. 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 ?? Quote Link to comment Share on other sites More sharing options...
paulo ve Posted August 17, 2013 Report Share Posted August 17, 2013 would be possible to connect the hose from a truck to the other? would be interesting! Quote Link to comment Share on other sites More sharing options...
The Loot Posted August 17, 2013 Report Share Posted August 17, 2013 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 level5. A code idea ( i am fully aware that this is not actually right it is just a brain storm! )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 ?? I like it. If I still had Winterberg installed I'd try to look at the method they found, though theirs is way too restrictive considering an American-style engine usually has a tank capable of holding a few hundred gallons at the least. Quote Link to comment Share on other sites More sharing options...
Hoppah Posted August 17, 2013 Author Report Share Posted August 17, 2013 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 level5. 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. Quote Link to comment Share on other sites More sharing options...
NathanDollinger Posted August 17, 2013 Report Share Posted August 17, 2013 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. 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! Quote Link to comment Share on other sites More sharing options...
NathanDollinger Posted August 17, 2013 Report Share Posted August 17, 2013 I like it. If I still had Winterberg installed I'd try to look at the method they found, though theirs is way too restrictive considering an American-style engine usually has a tank capable of holding a few hundred gallons at the least.I looked at trying to find it in the winterberg mods ones and quickly realized i don't read German very well! Quote Link to comment Share on other sites More sharing options...
Hoppah Posted August 17, 2013 Author Report Share Posted August 17, 2013 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. Quote Link to comment Share on other sites More sharing options...
n00bingtarget Posted August 17, 2013 Report Share Posted August 17, 2013 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? ), 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. 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. Quote Link to comment Share on other sites More sharing options...
Hoppah Posted August 17, 2013 Author Report Share Posted August 17, 2013 (edited) 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. HoppahRapidDeployment.rar Edited August 17, 2013 by Hoppah Quote Link to comment Share on other sites More sharing options...
paulo ve Posted August 18, 2013 Report Share Posted August 18, 2013 Hoppah Hello, congratulations for the script, I have a serving for freeplay so that the water turns into a truck TLF and asks for a hydrant to testing it with the water supply. Quote Link to comment Share on other sites More sharing options...
NathanDollinger Posted August 18, 2013 Report Share Posted August 18, 2013 (edited) 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.The part below this code in the missionscript is only dedicated to the visual aspect, the information panel. Okay so here is what i got, when loading i get limitation statement to long as an error ( Around line 60 ) This is playing for about an hour with the code any thoughts?int ETL[] = 1000;const char OBJ_E04[] = "mod:Prototypes/Vehicles/02 Fire Department/engine01.e4p";int OUTTAKE_HOSE = 6;int OUTTAKE_CANNON = 10;int INTAKE_SUPPLYLINE = 24;int WaterLevel;int Engine01Level;object VcmdWaterLVL : CommandScript{ VcmdWaterLVL() { SetCursor(""); SetIcon(""); SetGroupID(DummyGroup); SetGroupLeader(true); SetRestrictions(RESTRICT_SELFEXECUTE); } Vehicle veh(StrCompare(v.GetPrototypeFileName(), OBJ_E04); { if (veh)->HasCommand("DummyLimitedWater")) { int numActiveHoses = 0; int numActiveCannons = 0; int numSupplyLines = 0; int Outtake = 0; int Intake = 0; 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() == v.GetID()) { Engine01Level = Engine01Level+Intake-Outtake; if (Engine01Level < 20) veh.AssignCommand("DummyEmptyTank"); if (Engine01Level > ELT) Engine01Level = ELT; else if (Engine01Level < 0) Engine01Level = 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() && Engine01Level < 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() && Engine01Level > 20))) { can.EnableAutoTarget(true); } else { can.EnableAutoTarget(false); can.ClearActions(); can.PushActionWait(ACTION_NEWLIST, 2.f); System::Log("Disable cannon"); } } } if (veh.GetID() && !Engine01Empty) { Engine01Empty = true; Game::ShowHelpTextWindow("Water tank of Local Fire Truck is empty!"); } if ((veh.GetID() && Engine01Level > 20)) { veh.RemoveCommand("DummyEmptyTank"); if (veh.HasCommand("Extinguish")) veh.EnableCommand("Extinguish", true); if (veh.HasCommand("Cool")) veh.EnableCommand("Cool", true); if (veh.GetID() && Engine01Empty) Engine01Empty = false; } else { if (veh.HasCommand("Extinguish")) veh.EnableCommand("Extinguish", false); if (veh.HasCommand("Cool")) veh.EnableCommand("Cool", false); } } }}; Edited August 18, 2013 by NathanDollinger Quote Link to comment Share on other sites More sharing options...
FDNY2352 Posted August 18, 2013 Report Share Posted August 18, 2013 Surely you could rename the mission script to 'fp_freeplay' and it would hopefully work in freeplay right? Quote Link to comment Share on other sites More sharing options...