Jump to content


Photo

[Released] Limited Water Supply Logic


  • Please log in to reply
253 replies to this topic

#1 Hoppah

Hoppah

    Boss cat

  • Administrators
  • 3,879 posts
  • Gender:Male
  • Location:Special Needs Department

Posted 14 August 2013 - 06:14 PM

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.
 
Attached File  nyc mod limited water supply.jpg   175.45KB   36 downloads Attached File  Em4Deluxe 2013-09-03 22-41-06-51.jpg   170.73KB   25 downloads
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!
 
Hoppah

Attached Files



#2 Wkboy714

Wkboy714

    Senior Captain

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

Posted 14 August 2013 - 08:21 PM

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.



#3 Hoppah

Hoppah

    Boss cat

  • Administrators
  • 3,879 posts
  • Gender:Male
  • Location:Special Needs Department

Posted 14 August 2013 - 08:30 PM

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. :)



#4 Freelancer

Freelancer

    Senior Captain

  • Members
  • 296 posts
  • Gender:Male
  • Location:Düsseldorf, North Rhine-Westphalia, Germany
  • Interests:3D Art,Rolling Stones, AC/DC, Pink Floyd, Led Zeppelin, Mick Jagger, Keith Richards, Rock, Guitar.

Posted 14 August 2013 - 08:36 PM

Finally :D

 

thanks Hoppah for this! 

Freelancer


3D Modeler
2D Artist


#5 CFDDIVE11

CFDDIVE11

    Captain

  • Members
  • 171 posts
  • Gender:Male

Posted 14 August 2013 - 08:53 PM

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


Signature Removed due to size


#6 Hoppah

Hoppah

    Boss cat

  • Administrators
  • 3,879 posts
  • Gender:Male
  • Location:Special Needs Department

Posted 14 August 2013 - 09:53 PM

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



#7 Dyson

Dyson

    Assistant Chief

  • Members
  • 2,399 posts
  • Gender:Not Telling

Posted 15 August 2013 - 01:16 AM

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



#8 theparanoid

theparanoid

    Battalion Chief

  • Members
  • 672 posts
  • Gender:Male
  • Location:Planet Earth
  • Interests:HO Model Traings
    Emergency!
    CHiPS
    Star Trek
    Star Wars
    Computers
    Electronics
    Star Trek Online

Posted 15 August 2013 - 12:01 PM

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.  



#9 Rascle_08

Rascle_08

    Lieutenant

  • Members
  • 77 posts
  • Gender:Male
  • Location:California, Maryland

Posted 16 August 2013 - 09:16 PM

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?


mva3_thumb.jpg


#10 Hoppah

Hoppah

    Boss cat

  • Administrators
  • 3,879 posts
  • Gender:Male
  • Location:Special Needs Department

Posted 16 August 2013 - 09:39 PM

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.



#11 Rascle_08

Rascle_08

    Lieutenant

  • Members
  • 77 posts
  • Gender:Male
  • Location:California, Maryland

Posted 16 August 2013 - 09:45 PM

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


mva3_thumb.jpg


#12 e34p

e34p

    Senior Captain

  • Members
  • 357 posts
  • Gender:Male

Posted 16 August 2013 - 11:27 PM

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!

Welfordshire_County_Council.jpg


#13 Axxif

Axxif

    Lieutenant

  • Members
  • 46 posts

Posted 17 August 2013 - 03:58 AM

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

#14 NathanDollinger

NathanDollinger

    Captain

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

Posted 17 August 2013 - 05:45 AM

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! )

 

Spoiler

 

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 ??


banner.jpg


#15 paulo ve

paulo ve

    Captain

  • Members
  • 205 posts

Posted 17 August 2013 - 07:29 AM

would be possible to connect the hose from a truck to the other? would be interesting!



#16 The Loot

The Loot

    Battalion Chief

  • Members
  • 725 posts
  • Gender:Male

Posted 17 August 2013 - 07:48 AM

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! )


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.



#17 Hoppah

Hoppah

    Boss cat

  • Administrators
  • 3,879 posts
  • Gender:Male
  • Location:Special Needs Department

Posted 17 August 2013 - 08:44 AM

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! )

 

Spoiler

 

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.



#18 NathanDollinger

NathanDollinger

    Captain

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

Posted 17 August 2013 - 09:56 AM

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!


banner.jpg


#19 NathanDollinger

NathanDollinger

    Captain

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

Posted 17 August 2013 - 10:04 AM

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!


banner.jpg


#20 Hoppah

Hoppah

    Boss cat

  • Administrators
  • 3,879 posts
  • Gender:Male
  • Location:Special Needs Department

Posted 17 August 2013 - 01:48 PM

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.

 

Spoiler

 

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