Ga naar inhoud


Foto

[Released] Limited Water Supply Logic


  • Please log in to reply
253 replies to this topic

#21 n00bingtarget

n00bingtarget

    Captain

  • Members
  • 102 Posts:
  • Gender:Male
  • Location:Menasha, WI

Gepost 17 augustus 2013 - 02:15

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.

 

 

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.


Firefighter / EMT
Boulder Junction Volunteer Fire Department 1989-1996

Firefighter
Town of Menasha Fire Department 1998-1999

Once a Firefighter, ALWAYS a Firefighter. Boy do I miss it!

#22 Hoppah

Hoppah

    Boss cat

  • Administrators
  • 3879 Posts:
  • Gender:Male
  • Location:Special Needs Department

Gepost 17 augustus 2013 - 03: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

Bijgesloten bestand(en)


Deze post is bewerkt door Hoppah: 17 augustus 2013 - 11:08


#23 paulo ve

paulo ve

    Captain

  • Members
  • 205 Posts:

Gepost 18 augustus 2013 - 04:06

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.



#24 NathanDollinger

NathanDollinger

    Captain

  • Members
  • 170 Posts:
  • Gender:Male
  • Location:Asheville, NC, US
  • Interests:Games, Family, Fire Fighting ( Not in that order lol )

Gepost 18 augustus 2013 - 05:35

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);
			}
		}
	}
};

Deze post is bewerkt door NathanDollinger: 18 augustus 2013 - 07:28

banner.jpg


#25 FDNY2352

FDNY2352

    Lieutenant

  • Members
  • 70 Posts:
  • Gender:Male
  • Interests:Royal Air Force
    Fire Department New York
    New York City
    Graphic Design

Gepost 18 augustus 2013 - 12:31

Surely you could rename the mission script to 'fp_freeplay' and it would hopefully work in freeplay right?


2u5zy13.png


#26 NathanDollinger

NathanDollinger

    Captain

  • Members
  • 170 Posts:
  • Gender:Male
  • Location:Asheville, NC, US
  • Interests:Games, Family, Fire Fighting ( Not in that order lol )

Gepost 18 augustus 2013 - 12:46

Surely you could rename the mission script to 'fp_freeplay' and it would hopefully work in freeplay right?

No it is two completely different ways of writing the script, 

 

Also I worked out my previous issue and believe i will have a working free play version some time later this after noon! 

 

Will post updates later but for now its time for sleep!


banner.jpg


#27 paulo ve

paulo ve

    Captain

  • Members
  • 205 Posts:

Gepost 18 augustus 2013 - 12:54

Hello Nathan, congratulations for the script, it would be possible to spend a tank of water to support another tank??.



#28 Axxif

Axxif

    Lieutenant

  • Members
  • 46 Posts:

Gepost 18 augustus 2013 - 01:45

Oh, that's a good point, routing water through trucks to other trucks in general

#29 Hoppah

Hoppah

    Boss cat

  • Administrators
  • 3879 Posts:
  • Gender:Male
  • Location:Special Needs Department

Gepost 18 augustus 2013 - 05:37

@ 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



#30 erfd

erfd

    District Chief

  • Members
  • 1122 Posts:
  • Gender:Male
  • Location:Minnesota
  • Interests:Football ( The US version), fishing, Police/Fire Dept.
    https://www.facebook.com/fireemsdaily

Gepost 18 augustus 2013 - 05:57

This is why we love you Hoppah!



#31 Wkboy714

Wkboy714

    Senior Captain

  • Members
  • 489 Posts:
  • Gender:Male
  • Location:England, UK

Gepost 18 augustus 2013 - 06:15

Oh Hoppah. How do I send you my money?

#32 Hoppah

Hoppah

    Boss cat

  • Administrators
  • 3879 Posts:
  • Gender:Male
  • Location:Special Needs Department

Gepost 18 augustus 2013 - 06:21

Oh Hoppah. How do I send you my money?

 

money-envelope-l.jpg



#33 rgalante

rgalante

    Captain

  • Members
  • 117 Posts:
  • Gender:Male
  • Location:Seixal, Portugal
  • Interests:Emergency 4, music, football manager, modding, history

Gepost 18 augustus 2013 - 07:00

:OOOOO. Hoppah you're epic :D

 

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


Portuguese Emergency Services Spotter - My Channel - http://www.youtube.c.../TheRfog/videos

fE1FMK.gifmd_syO.gif

 

Visit my EM4 mod Page - https://www.facebook...506146336098414

Supporter of The Portuguese Modification.

 


#34 Fred03

Fred03

    District Chief

  • Members
  • 1412 Posts:
  • Gender:Not Telling
  • Location:The path less traveled

Gepost 18 augustus 2013 - 07:21

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.


Also Supporting: RCMP mod, Stillwater mod, Lampard mod, Ravenna sub-mod,  Rockport mod.

xnzgxu9.png

State & National Park enthusiast can help modders in park related issues.

My statements in no way respect the views of any agency I am or was formerly associated with.


#35 NathanDollinger

NathanDollinger

    Captain

  • Members
  • 170 Posts:
  • Gender:Male
  • Location:Asheville, NC, US
  • Interests:Games, Family, Fire Fighting ( Not in that order lol )

Gepost 18 augustus 2013 - 08:09

@ 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:

 
 
Fire Engine with supply line on the EM4 deluxe map:
 

 

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

 

 

.... Grr lol 

 

Good job Hoppah! 

Hope to see it soon!


banner.jpg


#36 Dyson

Dyson

    Assistant Chief

  • Members
  • 2399 Posts:
  • Gender:Not Telling

Gepost 18 augustus 2013 - 08:12

@ 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:

 
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

 
By the power of greyskull...
tumblr_m9jmrvGatD1qlvd4eo1_250.gif

#37 RedHawk504

RedHawk504

    Double Account Holder. Hi Officermax

  • Members
  • 926 Posts:
  • Gender:Male
  • Location:In the middle of the northpool
  • Interests:Cars, Fire Department

Gepost 18 augustus 2013 - 08:36

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!


Posted Image

Your signature was too big. But I kinda like that other gif, so it stays.


#38 mariuswww

mariuswww

    Senior Captain

  • Members
  • 325 Posts:
  • Gender:Male

Gepost 18 augustus 2013 - 08:58

0NZqAoM.gif



#39 paulo ve

paulo ve

    Captain

  • Members
  • 205 Posts:

Gepost 18 augustus 2013 - 09:04

You're the beast hoppah has a script in manhatan the firefighter engages a hose on a truck on the other, it would be possible to put together with the water supply?



#40 Hoppah

Hoppah

    Boss cat

  • Administrators
  • 3879 Posts:
  • Gender:Male
  • Location:Special Needs Department

Gepost 18 augustus 2013 - 09:40

: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