Jump to content
Hoppah

[Released] Limited Water Supply Logic

Recommended Posts

@Steven Dang that sounds like your FF/EMTs are missing the "PickUp" command. 

Assuming LA Mod is still at 2.1, you could try adding a snippet of code to the end of the Usejumppad script in order to ensure that you can pick it back up. Something like the last two lines of code here...

 

//******************************************************************************************
// #Version 1.1#
//
// 		Changes: - UseJumppad and RemoveEquipment command will be removed.
//
//******************************************************************************************

const char DUMMY_EQUIPMENT[] 		= "DummyEquipmentCommands";

object UseJumppad : CommandScript
{
	UseJumppad()
	{
		SetValidTargets(ACTOR_OPEN_HOUSE);
		SetPossibleCallers(ACTOR_PERSON);
		SetPossibleEquipment(EQUIP_JUMPPAD);
		SetPossibleExists(CPE_HOUSE_FOR_JUMPPAD);
	}

	/*bool CheckPossible(GameObject *Caller)
	{
		if(!Caller->IsValid() || Caller->GetType() != ACTOR_PERSON || Caller->GetEquipment()!=EQUIP_JUMPPAD)
			return false;
		return Game::ExistsHouseForJumpad();
	}*/
	
	bool CheckTarget(GameObject *Caller, Actor *Target, int ChildID)
	{
		if(!Caller->IsValid() || Caller->GetEquipment()!= EQUIP_JUMPPAD )
			return false;

		if (Caller->GetType() != ACTOR_PERSON)
			return false;
		Person p(Caller);
		if(p.GetEnteredCarID() != -1)
			return false;

		if ( Target->GetType() == ACTOR_OPEN_HOUSE )
		{
			OpenHouse house(Target);
			if ( house.HasJumppadTarget() )
				return true;
		}

		return false;
	}

	void PushActions(GameObject *Caller, Actor *Target, int ChildID)
	{
		OpenHouse house(Target);
		Vector TargetPos = house.GetJumppadTarget();

		Caller->PushActionMove(ACTION_APPEND, TargetPos);
		Caller->PushActionUseEquipment(ACTION_APPEND, Target, ChildID, 3.f);
		Caller->PushActionExecuteCommand(ACTION_APPEND, DUMMY_EQUIPMENT, Target, 10, false); 

		// go back 300 units
		Vector BackPos = Caller->GetPosition();
		BackPos.x -= TargetPos.x;
		BackPos.y -= TargetPos.y;
		BackPos.z -= TargetPos.z;
		float len = Math::dist(BackPos.x, BackPos.y, BackPos.z, 0, 0, 0);
		if ( len )
		{
			BackPos.x *= 300/len;
			BackPos.y *= 300/len;
			BackPos.z *= 300/len;
		}
		BackPos.x += TargetPos.x;
		BackPos.y += TargetPos.y;
		BackPos.z += TargetPos.z;
		Caller->PushActionMove(ACTION_APPEND, BackPos);
		if(!p.HasCommand("PickUp"))
		{
			p.AssignCommand("PickUp");
		}
	}
};

In particular:

if(!p.HasCommand("PickUp"))

{

p.AssignCommand("Pickup");

}

Edit: I'm not sure whether that is a valid syntax for this usage or if it needs to be formatted around Caller. Lemme know if it works and if not I'll look into it and try it out (particularly when it's not 4:30 in the morning )

Link to comment
Share on other sites

3 hours ago, Axxif said:

@Steven Dang that sounds like your FF/EMTs are missing the "PickUp" command. 

Assuming LA Mod is still at 2.1, you could try adding a snippet of code to the end of the Usejumppad script in order to ensure that you can pick it back up. Something like the last two lines of code here...

 


//******************************************************************************************
// #Version 1.1#
//
// 		Changes: - UseJumppad and RemoveEquipment command will be removed.
//
//******************************************************************************************

const char DUMMY_EQUIPMENT[] 		= "DummyEquipmentCommands";

object UseJumppad : CommandScript
{
	UseJumppad()
	{
		SetValidTargets(ACTOR_OPEN_HOUSE);
		SetPossibleCallers(ACTOR_PERSON);
		SetPossibleEquipment(EQUIP_JUMPPAD);
		SetPossibleExists(CPE_HOUSE_FOR_JUMPPAD);
	}

	/*bool CheckPossible(GameObject *Caller)
	{
		if(!Caller->IsValid() || Caller->GetType() != ACTOR_PERSON || Caller->GetEquipment()!=EQUIP_JUMPPAD)
			return false;
		return Game::ExistsHouseForJumpad();
	}*/
	
	bool CheckTarget(GameObject *Caller, Actor *Target, int ChildID)
	{
		if(!Caller->IsValid() || Caller->GetEquipment()!= EQUIP_JUMPPAD )
			return false;

		if (Caller->GetType() != ACTOR_PERSON)
			return false;
		Person p(Caller);
		if(p.GetEnteredCarID() != -1)
			return false;

		if ( Target->GetType() == ACTOR_OPEN_HOUSE )
		{
			OpenHouse house(Target);
			if ( house.HasJumppadTarget() )
				return true;
		}

		return false;
	}

	void PushActions(GameObject *Caller, Actor *Target, int ChildID)
	{
		OpenHouse house(Target);
		Vector TargetPos = house.GetJumppadTarget();

		Caller->PushActionMove(ACTION_APPEND, TargetPos);
		Caller->PushActionUseEquipment(ACTION_APPEND, Target, ChildID, 3.f);
		Caller->PushActionExecuteCommand(ACTION_APPEND, DUMMY_EQUIPMENT, Target, 10, false); 

		// go back 300 units
		Vector BackPos = Caller->GetPosition();
		BackPos.x -= TargetPos.x;
		BackPos.y -= TargetPos.y;
		BackPos.z -= TargetPos.z;
		float len = Math::dist(BackPos.x, BackPos.y, BackPos.z, 0, 0, 0);
		if ( len )
		{
			BackPos.x *= 300/len;
			BackPos.y *= 300/len;
			BackPos.z *= 300/len;
		}
		BackPos.x += TargetPos.x;
		BackPos.y += TargetPos.y;
		BackPos.z += TargetPos.z;
		Caller->PushActionMove(ACTION_APPEND, BackPos);
		if(!p.HasCommand("PickUp"))
		{
			p.AssignCommand("PickUp");
		}
	}
};

In particular:

if(!p.HasCommand("PickUp"))

{

p.AssignCommand("Pickup");

}

Edit: I'm not sure whether that is a valid syntax for this usage or if it needs to be formatted around Caller. Lemme know if it works and if not I'll look into it and try it out (particularly when it's not 4:30 in the morning )

Thanks, i will try. I'm using The RiverSide Mod, everything is work fine with jumpad until i copy and replace some scripts such as: Pickup, hoseextension, attachfirehose, watersupply into this mod then i can not pick up the jumpad after deployed :|

 

Edit: Well, it works with ff_emt, but it's not work with usfs :|, i think the problem come from the Pickup.script

 

Link to comment
Share on other sites

So, I've compared a couple PickUp scripts I've got, and I think I might have found your possible problem. If I may direct your attention to this segment:

	bool CheckPossible(GameObject *Caller)
	{
		if (!Caller->IsValid())
			return false;
		if (Caller->GetType() == ACTOR_VEHICLE)
		{
			Vehicle v(Caller);
			if (v.GetVehicleType() == VT_FIREFIGHTERS_FMB)
			{
				return v.GetFreeTransports() > 0 && (Game::ExistsNormalObjectWithFlagSet(OF_FLOTSAM) || Game::ExistsDrowningPerson());
			}
			else if (v.GetVehicleType() == VT_THW_FGRR_RL)
			{
				return !v.IsCarryingAnything() && Game::ExistsNormalObjectWithFlagSet(OF_CARRYABLE_BY_BULLDOZER);
			}
		}
		if (Caller->GetType() == ACTOR_PERSON)
		{
			Person p(Caller);
			if (p.GetArrestedID() != -1)
				return false;
		}
		if (Caller->HasCommand("Dummy1Cone") || Caller->HasCommand("Dummy2Cones"))
			return true;
		else if (Caller->HasCommand("Dummy1Flare") || Caller->HasCommand("Dummy2Flares"))
			return true;
		else if (Caller->IsCarryingAnything())
			return false;
		else if (Caller->HasCommand("PcmdTrafficConeGet") || Caller->HasCommand("PcmdFlareGet"))
			return true;
		else if (Caller->HasCommand("PcmdWye") || Caller->HasCommand("PcmdExtendhose"))
			return true;
		else if (Caller->HasCommand("DriveAwayPerson"))
			return Game::ExistsInstalledJumppad() || Game::ExistsPickableAnimal();
		return false;
	}

 

Make sure that you have the last tidbit in there (the two lines above "return false;"), and ensure that all of the peds that you have which you want to collect the jumppad have the command "DriveAwayPerson". Without this, the script cannot initialize unless you fulfill one of the other variables. Hope this helps!

  • Upvote 1
Link to comment
Share on other sites

9 hours ago, Axxif said:

So, I've compared a couple PickUp scripts I've got, and I think I might have found your possible problem. If I may direct your attention to this segment:


	bool CheckPossible(GameObject *Caller)
	{
		if (!Caller->IsValid())
			return false;
		if (Caller->GetType() == ACTOR_VEHICLE)
		{
			Vehicle v(Caller);
			if (v.GetVehicleType() == VT_FIREFIGHTERS_FMB)
			{
				return v.GetFreeTransports() > 0 && (Game::ExistsNormalObjectWithFlagSet(OF_FLOTSAM) || Game::ExistsDrowningPerson());
			}
			else if (v.GetVehicleType() == VT_THW_FGRR_RL)
			{
				return !v.IsCarryingAnything() && Game::ExistsNormalObjectWithFlagSet(OF_CARRYABLE_BY_BULLDOZER);
			}
		}
		if (Caller->GetType() == ACTOR_PERSON)
		{
			Person p(Caller);
			if (p.GetArrestedID() != -1)
				return false;
		}
		if (Caller->HasCommand("Dummy1Cone") || Caller->HasCommand("Dummy2Cones"))
			return true;
		else if (Caller->HasCommand("Dummy1Flare") || Caller->HasCommand("Dummy2Flares"))
			return true;
		else if (Caller->IsCarryingAnything())
			return false;
		else if (Caller->HasCommand("PcmdTrafficConeGet") || Caller->HasCommand("PcmdFlareGet"))
			return true;
		else if (Caller->HasCommand("PcmdWye") || Caller->HasCommand("PcmdExtendhose"))
			return true;
		else if (Caller->HasCommand("DriveAwayPerson"))
			return Game::ExistsInstalledJumppad() || Game::ExistsPickableAnimal();
		return false;
	}

 

Make sure that you have the last tidbit in there (the two lines above "return false;"), and ensure that all of the peds that you have which you want to collect the jumppad have the command "DriveAwayPerson". Without this, the script cannot initialize unless you fulfill one of the other variables. Hope this helps!

Thank you so much!

Edit: this is PickUp.script, right?

Link to comment
Share on other sites

8 hours ago, Axxif said:

Have you checked to make sure that your firefighters actually have all the commands necessary to function properly? Could you load your script folder to a rar or zip file and send it to me?

sure, i will do it, because when the ff take the fire extinguisher, fire axe, saw,.. ithey can put it down (remove them) expect the Jump pad :))

Scripts.rar

Link to comment
Share on other sites

I am trying to set up the script for a mod of mine and i have managed to get to the pumps, water tanks, connections and supply lines working but for some reason when i go to connect the hose to the engine to start putting out a fire i loose the Cool and Extinguish commands from the fire fighters. The same thing also happens with the DLK, i connect the DLK to a hydrant then as soon as i put the firefighter in the basket and he has gone through the animation of the ladder extending the firefighter loses the command again.

  • Upvote 1
Link to comment
Share on other sites

I'm trying to change the hydrants in freeplay of my private mod.

I have changed them to how they appear in the attached images. Without a hose attached they appear with just the yellow sign and yellow plate of the floor. Once a hose is attached to the hydrant the grey 'standpipe' appears and the hose connects to it. Once you disconnect the hose, the grey 'standpipe' disappears again. I used the scripts from the Bieberfelde Mod. The hydrant object is named "water". When a hose is attached to the hydrant a firefighter can extinguish a fire directly from the hydrant.

I want to incorporate the limited water script. I can attached the hose from this hydrant to the fire engine, but it does not replenish the tank.

What needs to be done to be able to get this to work?

Thanks in advance

Em4 2017-01-07 23-12-38-38.bmp

Em4 2017-01-07 23-13-51-42.bmp

Link to comment
Share on other sites

You'd need to figure out what their hydrant is. Is it a vehicle substitute or an actual hydrant?

Em4's hydrants are hardcoded to only have one connection each. Im curious how they got two to work using the default system, unless they modified LWS so that the fake hydrant object has unlimited water in it.

Link to comment
Share on other sites

45 minutes ago, itchboy said:

Yeap, that confirms it. Its a custom vehicle disguised as a fire hydrant. You would need to modify the LWS code so that the fake vehicle has either:

An unlimited water supply, or that the water taken from it does not drain the tank.

Any idea how I would do that?

Link to comment
Share on other sites

Lean and understand how to modify code in Em4, then go into LWS and make/change/add values to accomodate the new hydrant.

Option B is to observe the code from Bieberfelde and see what they did. Dont copy it directly into your mod though unless you have their permisison.

Link to comment
Share on other sites

Figure out what they modified in Bieb to get the thing working and then take the same path without copying the content they did 1/1.

I dont have much else to say besides that, seeing as how I dont play the Bieb mod or have exp with their code. All I am doing is guesswork as to how they might have done it.

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