Jump to content
Hoppah

[Released] Limited Water Supply Logic

Recommended Posts

Got the water tanker to work in the mission script. It seems to work fine. Now I still gotta do the freeplay compatibility.

I fixed the small ladder issue too, and the rapid deploy finds the closest hydrant (for the supply line) within a certain distance now instead of any hydrant within that distance.

 

I'm still hesitating wether a command to the fire engine's (or the GTF vehicletype cars) which enables the pumps on the engine should be added to the mod. So I'm leaving this decision up to the forumppl and added a poll. Enabling that command would be required to use any hose and it will require 1 fire fighter to man the pump panel. It's a little more realism, and the chance of lag in freeplay MAY be less.

Link to comment
Share on other sites

I'd say yes. A little more complexity sounds good to me.

 

Edit: A bug I forgot to report. If a person already has a firehose, they sometimes won't hook up to the vehicle during rapiddeployment. It's usually just one of them.

Also, how can I make it so that rapiddeployment ignores certain person prototypes?

Link to comment
Share on other sites

I am always for realism  :D its a shame that we can't have two FF and a hose line as well  :) mind you that would mean more units on scene.

 

Although maybe more realistic, I don't know how to do that. Forcing players to always use 2 fire fighters to control 1 hose would be more annoying than fun too probably.

 

 

I'd say yes. A little more complexity sounds good to me.

 

Edit: A bug I forgot to report. If a person already has a firehose, they sometimes won't hook up to the vehicle during rapiddeployment. It's usually just one of them.

Also, how can I make it so that rapiddeployment ignores certain person prototypes?

 

Okey, I've started to work on the activate pump command.

 

The rapid deployment issue (can't really call it a bug) sometimes happens. I'd say in 6 out of 10 times, all 4 fire fighters do hook up their hoses. Sometimes one of them can't find the connector indeed. Unfortunately, I can't really fix that and it's not a big issue imo. 

 

In the next version of the demo, only fire fighters with the command "AttachFireHose" will do the rapid deploy. It's fairly easy to change that, but I suggest you wait for updated demo. :)

 

There will be a lot of new functionalities in the updated demo mod with a lot of changes to scripts. You will probably have to do the personal changes all over again.

 

Hoppah

Link to comment
Share on other sites

 

 

 

Although maybe more realistic, I don't know how to do that. Forcing players to always use 2 fire fighters to control 1 hose would be more annoying than fun too probably.

 

 

 

Okey, I've started to work on the activate pump command.

 

The rapid deployment issue (can't really call it a bug) sometimes happens. I'd say in 6 out of 10 times, all 4 fire fighters do hook up their hoses. Sometimes one of them can't find the connector indeed. Unfortunately, I can't really fix that and it's not a big issue imo. 

 

In the next version of the demo, only fire fighters with the command "AttachFireHose" will do the rapid deploy. It's fairly easy to change that, but I suggest you wait for updated demo. :)

 

There will be a lot of new functionalities in the updated demo mod with a lot of changes to scripts. You will probably have to do the personal changes all over again.

 

Hoppah

 

Any chance you could go ahead with the fix for the aerials?

Link to comment
Share on other sites

Currently working on a step-by-step tutorial for adding the freeplay script to a mod and setting up the map, vehicles, people, deck gun dummies, and scripts. I'll be waiting for Hoppah's next revision before I release anything, but I've got all non-script steps written out already.

 

Will it be possible to feed water from tanker to both engine and ladder?

Hoppah will correct me if I'm wrong, but he's probably only planning on allowing single supply connections.

Any chance you could go ahead with the fix for the aerials?

He's most likely going to roll it into the next revision.

The rapid deployment issue (can't really call it a bug) sometimes happens. I'd say in 6 out of 10 times, all 4 fire fighters do hook up their hoses. Sometimes one of them can't find the connector indeed. Unfortunately, I can't really fix that and it's not a big issue imo. 

 

In the next version of the demo, only fire fighters with the command "AttachFireHose" will do the rapid deploy. It's fairly easy to change that, but I suggest you wait for updated demo. :)

 

There will be a lot of new functionalities in the updated demo mod with a lot of changes to scripts. You will probably have to do the personal changes all over again.

Maybe having them remove their hoses during rapid"un"deploy would just bypass the connection issue.

I looked a Shane Green's rapiddeployment mod, and figured it out. The first time I tried it, it made no difference, but I have it fine now.

I've got most of my changes done, so unless you add something completely new, I should be able redo it no problem.

Link to comment
Share on other sites

Any chance you could go ahead with the fix for the aerials?

 

Yea, it's a very easy fix actually.

 

Open up WaterSupplyFreeplay.script and find the part of the code I copied in the spoiler and add the pointed out exclamation mark (the ! symbol).

 

if (v.GetVehicleType() == VT_FIREFIGHTERS_DLK && v.IsInstalled() && v.IsUplifted() && !v.IsBasketEmpty())

{

    PersonList DLKGuy(ROLE_SQUAD);

    for(int k = 0; k < DLKGuy.GetNumPersons(); k++)

    {

        if (DLKGuy.GetPerson(k)->CanUseDLKCannon() && DLKGuy.GetPerson(k)->GetEnteredCarID() == v.GetID())        

        {

            Person p(DLKGuy.GetPerson(k));

            if (WaterLevel <= 20)

            {

                if (p.IsCommandEnabled("Extinguish"))

                {

                    p.EnableCommand("Extinguish", false);

                    p.EnableCommand("Cool", false);

                    p.EnableAutoTarget(false);

                    p.ClearActions();

                    p.PushActionWait(ACTION_NEWLIST, 4.f);

                }

            }

            else

            {

                if (!p.IsCommandEnabled("Extinguish"))

                {

                    p.EnableCommand("Extinguish", true);

                    p.EnableCommand("Cool", true);

                    p.EnableAutoTarget(true);

                }

            }

        }

    }

}

 

 

Currently working on a step-by-step tutorial for adding the freeplay script to a mod and setting up the map, vehicles, people, deck gun dummies, and scripts. I'll be waiting for Hoppah's next revision before I release anything, but I've got all non-script steps written out already.

 

Thanks! With the screenshots it should be easier to add everything. In regards to the scripting, you may add the scripting part that involves the freeplay scripts in the \Scripts\Missions\ folder, because nothing has changed to that.

Link to comment
Share on other sites

Yea, it's a very easy fix actually.

 

Open up WaterSupplyFreeplay.script and find the part of the code I copied in the spoiler and add the pointed out exclamation mark (the ! symbol).

 

if (v.GetVehicleType() == VT_FIREFIGHTERS_DLK && v.IsInstalled() && v.IsUplifted() && !v.IsBasketEmpty())

{

    PersonList DLKGuy(ROLE_SQUAD);

    for(int k = 0; k < DLKGuy.GetNumPersons(); k++)

    {

        if (DLKGuy.GetPerson(k)->CanUseDLKCannon() && DLKGuy.GetPerson(k)->GetEnteredCarID() == v.GetID())        

        {

            Person p(DLKGuy.GetPerson(k));

            if (WaterLevel <= 20)

            {

                if (p.IsCommandEnabled("Extinguish"))

                {

                    p.EnableCommand("Extinguish", false);

                    p.EnableCommand("Cool", false);

                    p.EnableAutoTarget(false);

                    p.ClearActions();

                    p.PushActionWait(ACTION_NEWLIST, 4.f);

                }

            }

            else

            {

                if (!p.IsCommandEnabled("Extinguish"))

                {

                    p.EnableCommand("Extinguish", true);

                    p.EnableCommand("Cool", true);

                    p.EnableAutoTarget(true);

                }

            }

        }

    }

}

 

 

 

Thanks! With the screenshots it should be easier to add everything. In regards to the scripting, you may add the scripting part that involves the freeplay scripts in the \Scripts\Missions\ folder, because nothing has changed to that.

Thanks!

Link to comment
Share on other sites

Hoppah, quick semi-related question. I'm tweaking the extinguish values for various sources. I believe I found the normal firehose value here.

float Energy = (Caller->GetEquipment()==EQUIP_FIREHOSE) ? 20.0f : 12.5f;            Caller->PushActionExtinguish(ACTION_APPEND, Target, Energy);

Now, in this section...

if(v.GetVehicleType()==VT_FIREFIGHTERS_TLF)    Energy = 20.0f;else if(v.GetVehicleType()==VT_FIREFIGHTERS_LPF)    Energy = 30.0f;else if(v.GetVehicleType()==VT_FIREFIGHTERS_FLB)    Energy = 40.0f;else    Energy = 100.0f;

...does "else" end up just affecting, say, the Fire Plane? DLK types aren't mentioned there. The only thing I see of them is above that...

if (useDLKlogic)        {            Person p(Caller);            if (p.GetEnteredCarTargetID() == -1)            {                Caller->PushActionTurnBase(ACTION_NEWLIST, Target);                Caller->PushActionCannonExtinguish(ACTION_APPEND, Target, 25.f, false);            }            else                Caller->PushActionCannonExtinguish(ACTION_NEWLIST, Target, 25.f, false);            return;        }

...but there's no mention of the energy value for the action there.

 

Link to comment
Share on other sites

Yes, I believe the 100.f is for the Fire Plane, but Im not sure since I never really played with those values.

 

 

Here's a screenshot of the current update I'm working on. You can see the new water tanker (thanks to FreakingMusket for the model!) and its connection to the fire engine.

However, the water tanker feature is not finished yet since I've ran into some issues  :( . After I fixed that, I still need to convert the logic for the freeplay version, but shouldn't be too hard.

 
post-4-0-97540900-1378045367.jpg
 

The guy behind the fire engine is the guy who controls the pumps. Without this 'controllor' you will not be able to use the hoses on the engine.

 

Hoppah

Link to comment
Share on other sites

So is this going to be incorporated into a mod and then released? Because how are we going to use the tanker if we put this script into another mod?

 

This demo mod is basically open source. Just like the current version that can be downloaded, I will release a new demo mod with the new features. You can try out or test the demo mod to see how it works. The scripts can be copied to other mods. Implementation in other modifications isn't that hard if you know what you're doing, I've already written a guide how to do that and which files are necessary. Someone else also made a guide with screenshots.

 

 

H

Link to comment
Share on other sites

I think I got most of the new features to work in freeplay as well. I still want to give it a few extra tests before the next demo mode can be released.

 

 

Summarized, the new update will contain the following new features:

 

- Water Tanker vehicle (model by Freakinmusket)

- Working water tanker functionality (you can supply fire engine's with the water tanker)

- Extend hose command for fire fighters

- 'Activate engine pump' command (to use hoses from an engine a fire fighter to control the pump panel is required)

- New icons

- Rapid deployment improvements + ladder vehicle compatibility

- Several minor changes and fixes under 'the hood' (VcmdWaterSwitch renamed to VcmdCannonSwitch to prevent confusions with other scripts)

 

Most of the scripts have been changed intensively for the water tanker functionality and the pump command, so if you have the logic already implemented in your mod, you probably need to do all the personal changes again unfortunately.

 

Hoppah

Link to comment
Share on other sites

I think I got most of the new features to work in freeplay as well. I still want to give it a few extra tests before the next demo mode can be released.

 

 

Summarized, the new update will contain the following new features:

 

- Water Tanker vehicle (model by Freakinmusket)

- Working water tanker functionality (you can supply fire engine's with the water tanker)

- Extend hose command for fire fighters

- 'Activate engine pump' command (to use hoses from an engine a fire fighter to control the pump panel is required)

- New icons

- Rapid deployment improvements + ladder vehicle compatibility

- Several minor changes and fixes under 'the hood' (VcmdWaterSwitch renamed to VcmdCannonSwitch to prevent confusions with other scripts)

 

Most of the scripts have been changed intensively for the water tanker functionality and the pump command, so if you have the logic already implemented in your mod, you probably need to do all the personal changes again unfortunately.

 

Hoppah

- Awesome.

- I fear this will run into the same problem as the wye does for me. I think I'll just forget about the LA mods Barriers, Cones and Flares (I rarely use them anyways) and make sure to just take the pickup script straight from you.

- Pumps will add a welcome layer of complexity and strategy.

- Never had a problem with your icons, but I'm sure the new ones will be snazzy.

- Looking forward to the new deployment capabilities. Some hints on how to modify it personal liking would be welcome.

 

While I'll have to do some needed tweaking to new features, I'm confidant I can easily re-add my changes to the new version. Once again, thanks for the great work Hoppah.

 

Edit for Bug:

Hoppah, I've noticed that while vehicles that start spawned on the map work fine, vehicles that are spawned "off-map" through call scripts aren't getting the water system assigned to them. Will I need to manually assign the dummies in the call script, or is there a change to the water script that will work with that?

 

It seems to affect any vehicle spawned after the initial setup, either through menu or script.

Link to comment
Share on other sites

hi hoppah

 

i have a attach fire hose script that opens the rear doors of my fire engine when you connect a hose.  at the end of the script there are the open door parts.  where should i put this in the limited water supply script?

 

object AttachFireHose : CommandScript
{
    AttachFireHose()
    {
        SetValidTargets(ACTOR_OBJECT | ACTOR_VEHICLE);
        SetGroupID(CGROUP_FIREHOSE);
        SetGroupLeader(true);
        SetPossibleCallers(ACTOR_PERSON);
        SetPossibleEquipment(EQUIP_FIREHOSE);
        SetPossibleExists(CPE_FREE_HOSE_CONNECTION);
        SetNeedsConnectedHose(CFN_FAIL);
        SetRestrictions2(RESTRICT2_ISHYDRANT);
        SetPriority(220);
    }

    /*bool CheckPossible(GameObject *Caller)
    {
        if(!Caller->IsValid() || Caller->GetType() != ACTOR_PERSON)
            return false;
        return Caller->GetFirehoseID() == 0 && Caller->GetEquipment()==EQUIP_FIREHOSE && Game::ExistsFreeHoseConnection();
    }*/

    bool CheckGroupVisibility(GameObject *Caller)
    {
        if(!Caller->IsValid() || Caller->GetType() != ACTOR_PERSON)
            return false;
        return Caller->GetFirehoseID() == 0;
    }
    
    bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
    {
        if(!Caller->IsValid() || !Target->IsValid() || (Caller->GetID()==Target->GetID()))
            return false;
            
        if(Caller->GetFirehoseID())
            return false;
            
        if(Caller->GetType()!=ACTOR_PERSON)
            return false;
        Person c(Caller);
        if (c.GetEnteredCarID() != -1)
            return false;
            
        if(Caller->GetEquipment()==EQUIP_FIREHOSE)
        {
            if(Target->GetType() == ACTOR_OBJECT)
            {
                GameObject obj(Target);
                if(obj.IsHydrant() && !obj.IsHydrantInUse())
                    return true;
                return false;
            } else
            if(Target->GetType() == ACTOR_VEHICLE)
            {
                    Vehicle v(Target);
                    if(v.GetVehicleType() == VT_FIREFIGHTERS_GTF && v.GetEnergy() > 0.1f * v.GetMaxEnergy() && v.IsConnectorFree())
                        return true;
                    return false;
            }
        }

        return false;
    }

    void PushActions(GameObject *Caller, Actor *Target, int childID)
    {
        Caller->PushActionMove(ACTION_NEWLIST, Target, TARGET_FREE_CONNECTOR);
        if (Target->GetType() == ACTOR_VEHICLE)
            Caller->PushActionCheckFreeConnector(ACTION_APPEND, Target);
        Caller->PushActionUseEquipment(ACTION_APPEND, Target, childID, 1.0f);

        if (Target->GetType() == ACTOR_VEHICLE)
        {
            Vehicle v(Target);
            if (v.HasCommand("Cidea"))
            {
                v.EnableBlinker(BLT_BOTH);
                Game::ExecuteCommand("DUMMYOpenDoor1", &v, &v);
                Game::ExecuteCommand("DUMMYOpenDoor2", &v, &v);
            }
        }
    }
};
 

Link to comment
Share on other sites

Hey Hoppah

 

After i place the script in my mod i gave it to my friends to play and the water supply doesn't work on MP,

How hard will it be for you to make it work for MP

This is simple!

 

Go under the missions folder in the scripts 

Copy the fp_challenge and fp_freeplay

paste

and rename copy's to

mp_challenge and mp_freeplay

and they will work in multiplayer

Link to comment
Share on other sites

v1.2 released! Download link can be found on the first page: http://forum.emergency-planet.com/index.php?/topic/18262-released-limited-water-supply-logic/?p=258435

 

post-4-0-97540900-1378045367.jpg
 

New features:

- Water Tanker vehicle (model by Freakinmusket)

- Working water tanker functionality (you can supply fire engine's with the water tanker)

- Extend hose command for fire fighters

- 'Activate engine pump' command (to use hoses from an engine a fire fighter to control the pump panel is required)

- New icons

- Rapid deployment improvements + ladder vehicle compatibility

- Several minor changes and fixes under 'the hood' (VcmdWaterSwitch renamed to VcmdCannonSwitch to prevent confusions with other scripts)

 

Gameplay instructions

 

Water Tanker

You can install 1 hose from the water tanker to a fire engine, as well as a supply line from a hydrant to the tanker. The water tanker can not be used to extinguish fires by itself.

 

Activate pumps

You cannot use any installed hose from a fire engine if the pumps are not activated. You can activate the pumps of an engine in 3 (yes 3, wtf) different ways:

- Use the 'Engine pumps on/off' command (requires a fire fighter in the vehicle). A fire fighter will exit the vehicle and take position at the pump panel.

- Use the 'Rapid Deployment' command. Besides the four fire fighters who install their hoses to the fire engine, a fifth fire fighter will exit the vehicle to control the pumps.

- Select an fire fighter who is not equipped and click on the engine after the hoses are installed.

You can deactivate the pump by simply giving the fire fighter who is controlling the pumps a new command, or to use either the 'Engine pumps on/off' or 'Rapid Deployment' command to deinstall the fire engine.

Note: it is not required to activate the pumps to use the deck gun of an engine.

 

Rapid deployment

Using 'rapid deploy' from the water tanker only works if the tanker is parked in the vicinity of a fire engine (and a hydrant). Two fire fighters will exit the vehicle and get a hose from the nearest fire engine. The first fire fighter will install a supply line from the tanker to the nearest fire engine. If a hydrant is in the vicinity of the tanker, the second fire fighter will install a supply line from that hydrant to the tanker in order to supply the tanker. 'Rapid undeploy' finds the nearest idle and unequipped fire fighter who will remove any install supply lines running from and to the water tanker.

 

Rapid deployment is also compatible with DLK-vehicletypes (ladders) now. Using 'Rapid deploy', a fire fighter will install a supply line (if a hydrant is close) to the ladder vehicle and enter the basket. The other fire fighters inside the ladder will get a variety of equipment (pneumatic scissors, fire extinguisher, chainsaw, axe, jumppad and fire hose). 'Rapid undeploy' will only deinstall the entire vehicle, which means the fire fighter in the basket will exit the basket, remove the supply line (if present) and enter the vehicle.

 

Important note for modders:

Compared to the previous version, a lot has been changed in the new version. Vehicles have new ('PcmdPumpSwitch') and reamed commands ('VcmdCannonSwitch)' and a new child (for the pump controller) too. In case you want to implement the entire functionality to your own modification, please be aware that any vehicle in your mod will probably not be fully compatible with v1.2 anymore.

 

Bugs in v1.2

 

- The fire fighter who spawns outside to control the pump of a fire engine may not be recognized (script wise) 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.

 

Hope you like this upgrade :)

 

Hoppah

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...