Jump to content
Sign in to follow this  
{USI}_Zombie

Possible solution to stalled supply trucks

Recommended Posts

I was thinking about why ai controlled supply trucks and salvage trucks stop running....it isn't because they are lost, it's because they are out of fuel!  Perhaps building either an empty fuel truck at the main or an ai squad member fuel truck, the ai supply trucks will continue to run...I hope they are smart enough to refuel off of a refuel truck!

 Can anyone confirm this?  I will try it out tonight...we have noticed on very long missions a lot of ai controlled vehicles just stop.  The current solution is to go around the map murdering them, but that hurts your score, and eventually your rating, go down, and "friendly" troops will attack you.

 I am hoping that they will be smart enough to use either a static truck, or call for a manned truck, since they are not bright enough to refuel from static fuel stations.

 If they WON'T use the trucks on their own volition, I think some sort of script could "help" them, but I realize there is still no "getfuel" function.

Share this post


Link to post
Share on other sites

I'm not good enough at scripting, but in fact there is an option to "setfuel" which means if you know the supply truck names, you can just set their fuel back to 100% every 10 minutes or such on a timer.

Share this post


Link to post
Share on other sites
I'm not good enough at scripting, but in fact there is an option to "setfuel" which means if you know the supply truck names, you can just set their fuel back to 100% every 10 minutes or such on a timer.

true, but since the supply trucks are ai controlled, and I assume generated as needed, I don't think they HAVE names.

I guess typevehicle setfuel could do it as well, once I work out the proper syntax, but hopefully they will use a fuel truck on their own instead of adding another script.

Share this post


Link to post
Share on other sites

Very plausible theory Zombie, I didn't know AI had fuel. I guess if we can find the supply truck respawn script that the unlimited fuel code can get integrated into it.

Unfortunately the only fuel code that I know of is in the init box of a trigger:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

this setfuel 1

Share this post


Link to post
Share on other sites

Zombie, since the AI supply trucks get orders from scripts (drive to depot, return to base...) I would have thought they will have names assigned to them upon creation. Obviously something in the Warfare Engine is keeping track of them.

Otherwise, I think Supply Truck is a specific vehicle, so yeah it should be possible to just setfuel=1 for all vehicles of this class, every 15 minutes or so.

Share this post


Link to post
Share on other sites
Otherwise, I think Supply Truck is a specific vehicle, so yeah it should be possible to just setfuel=1 for all vehicles of this class, every 15 minutes or so.

I'm new to scripting myself. What would to code look like to do that? And how would I kick it off and have it run every 15 minutes?

Share this post


Link to post
Share on other sites

Great catch!

_AITrucks = Call Compile Format["%1AISupplyTrucks",_sideText];

I think I'm just going to setFuel 1 each time it does #updatesupplytrucks.

Share this post


Link to post
Share on other sites

I do remember this being brought up quite some time ago, so this isn't any new discovery. Steps weren't taken to fix it though.

Share this post


Link to post
Share on other sites
I do remember this being brought up quite some time ago, so this isn't any new discovery. Steps weren't taken to fix it though.

When people are reminded of an old problem, one could understand that it is being REDISCOVERED.

gasp.

wow_o.gif

Most WARFARE versions I have played have the same supply truck failures, and this will only improve the gameplay for all if it is corrected.

thanks, Zombie wink_o.gif

Share this post


Link to post
Share on other sites

so you need something like this looping script ?

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

private ["_allvehicles"];

_allvehicles = [];

while {true} do

{

while {true} do

{

_allvehicles = vehicles;

{

if ( (_x iskindof "Truck") OR (_x iskindof "Ural") )then

{

if ( (fuel _x) < 0.1) then

{

_x setfuel 1.0;

};

};

} foreach _allvehicles;

sleep 300;

};

sleep 60;

};

p.s. ofcourse you need adjust the vehicle types for refuel

Share this post


Link to post
Share on other sites

I did confirm this last night also. I built a fuel truck and went to the stalled supply trucks I saw on the map. They DID refuel and start running again, but never did notice if they would "stop by" a truck on their own.

Now, hopefully when someone makes an update, they will remember to add the script to keep them fueled, but in the meantime, where/how to use Dwarden's script?

Share this post


Link to post
Share on other sites
I did confirm this last night also.  I built a fuel truck and went to the stalled supply trucks I saw on the map.  They DID refuel and start running again, but never did notice if they would "stop by" a truck on their own.

 Now, hopefully when someone makes an update, they will remember to add the script to keep them fueled, but in the meantime, where/how to use Dwarden's script?

What did you mean by "never notice if they would by a truck on their own"?

So you successfully refuled a stalled truck by driving by in a refuel truck (operated by you). Does this also function if you sent an AI fuel truck to a stalled truck? If I am remembering correctly it is the truck requesting fuel that initiate the refueling/rearming process - not the one giving support.

If this works, probably the best is to implement the following:

1) Routine that checks the fuel state below a threshold i.e.

  15%

2) In case of being below threshold, truck is searching for the next refuel truck available and drives to it to get fuel - at the same the refuel truck is orderd to stop or even go the the rendevous point

Apart from this, I am generally wondering why players are not able to buy supply and salvage trucks (and refuel trucks) and then be able to hand them over to the auto-supply routine so that this sort of micro-managment is done by AI and not the player. That would give another aspect to strategy.

Share this post


Link to post
Share on other sites

It seems that when I drove a fuel truck near a stalled supply truck, they would "notice" it and initiate refueling. I didn't try sending an ai controlled fuel truck, but I did put an empty fuel truck near the hq, but didn't see them stop at it...I may not have looked long enough. I was also seeing in the side chat that the ai combat teams would order their vehicles to refuel at my truck, but since they were out, I had to go to them before they would initiate refueling.

I am going to dig in the scripts and see which one is controlling the supply trucks and see if I can add a refuel routine. Will keep you informed.

Share this post


Link to post
Share on other sites

In Arma there must be a player or maybe A.i in the empty fuel vehicle, but cool find anyways. smile_o.gif

Share this post


Link to post
Share on other sites

The mod on the XR Server [RBT] has;

1) A respawn Supply Truck button for the Commander, so if a lot of trucks seem stuck/stalled, they all can be "reset" to respawn back at the HQ.

2) Benny has mentioned that a script is being put in to ensure Supply Trucks will refuel when their fuel is running low.

Share this post


Link to post
Share on other sites
Precisely, now where to put it?

Just put

_vehicle setFuel 1;

in the #update section of \server\AI\AI_Supply truck.sqs. (after the "Quit" checks)

That should refill its fuel every 10 seconds.

Share this post


Link to post
Share on other sites
Precisely, now where to put it?

Just put

_vehicle setFuel 1;

in the #update section of \server\AI\AI_Supply truck.sqs. (after the "Quit" checks)

That should refill its fuel every 10 seconds.

Seems to be solved smile_o.gif

I'd like to do so like that:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (!CanMove _vehicle || !Alive _vehicle) then {Goto "Quit"} else {_vehicle setFuel 1};

Share this post


Link to post
Share on other sites

I used a variation of the scripts posted here to check if the fuel was <.3 then to setfuel 1.0. Thanks to oktane for the script to edit! I also added it to the salvage trucks

Share this post


Link to post
Share on other sites

Is this a good position for the fuel script line?

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#Quit

if (IsNull _vehicle) then {Goto "CleanUp"};

Call Compile Format["%1AISupplyTrucks = %1AISupplyTrucks - [_vehicle]",Str _side]

Call Compile Format["total%1AISupplyTrucks = Count %1AISupplyTrucks;PublicVariable ""%1AISupplyTrucks""",Str _side]

if (!CanMove _vehicle || !Alive _vehicle) then {Goto "Quit"} else {_vehicle setFuel 1};

#CleanUp

DeleteGroup _team

Share this post


Link to post
Share on other sites

should be OK Commando84...I did mine like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#Update

~10

_base = Call Compile Format["%1Base",Str _side]

if (IsNull _vehicle) then {Goto "Quit"};

if (IsNull Driver _vehicle) then {Goto "Quit"};

if (!Alive Driver _vehicle) then {Goto "Quit"};

if (!CanMove _vehicle || GetDammage _vehicle >= 1) then {Goto "Quit"};

if (IsNull _destination) then {Goto "GetDestination"};

;;added by {USI} Studios to refuel supply trucks,thanks to oktane from the BI forums

if (fuel _vehicle < 0.3) then (_vehicle setFuel 1);

That script is in the server/ai/ai_supplytruck.sqs for the people who don't know tounge2.gif

Share this post


Link to post
Share on other sites

I tried this a while back, but it doesn't seem to be sufficient. AI supply trucks still get stuck, often trying to drive through buildings, like camps. In WACO I solved this by destroying (setDamage 1) supply trucks that haven't moved more than 10 meters in 5 minutes. The AI can then create a new supply truck at the base. It's not ideal, but it works out fine in practice.

Doomguy

Share this post


Link to post
Share on other sites
I tried this a while back, but it doesn't seem to be sufficient. AI supply trucks still get stuck, often trying to drive through buildings, like camps. In WACO I solved this by destroying (setDamage 1) supply trucks that haven't moved more than 10 meters in 5 minutes. The AI can then create a new supply truck at the base. It's not ideal, but it works out fine in practice.

Doomguy

hey what file or files does contain your edit? And does the A.I do it on their own? smile_o.gif

Share this post


Link to post
Share on other sites

Yes they do. At first I did it for them, but it became tiresome wink_o.gif

The edit is in Server\AI\AI_SUpplyTruck.sqs

Doomguy

Share this post


Link to post
Share on other sites

Why you guys need this trucks? For what??? This is WARfare. Not a TRUCKfare. mad_o.gif

I angry bacause too many game session stucked with this trucks. Last screenshots in WACO topic.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×