Jump to content

[Suggestion] refuel&repair in dialogbox


Recommended Posts

you could also or instead have the refuel and repear go up in 10% or something instead of 1% in the chat that would reduce the spam from it. so you would get a message notifing u at 40% 50% instead of 41% 42% 43% etc.

Link to comment
Share on other sites

Instead of a dialog box with lots of chat, we could have a progress bar with a title above it saying "repairing", the bar goes from 0% to 100%, then the text that said "repairing" change to "refueling" and the same progress bar goes from 0% to 100% again (maybe using them different colors for both).

Link to comment
Share on other sites

Instead of a dialog box with lots of chat, we could have a progress bar with a title above it saying "repairing", the bar goes from 0% to 100%, then the text that said "repairing" change to "refueling" and the same progress bar goes from 0% to 100% again (maybe using them different colors for both).

I think it was something like that kamaradski meant. :-)

Link to comment
Share on other sites

I think it was something like that kamaradski meant. :-)

 

I've been playing a little with this idea, already have something working, but I still have to adjust the position on the screen and make it look pretty :P. I will post an update here once I finished it.

Link to comment
Share on other sites

I just finished this (full size):

 

AhUO8Ph.jpg

 

This is the code: http://www.sendspace.com/file/19o4e3

 

First I wanted to use a slider but I coulnd't find a way to hide the arrows so I just used a simple background and change its size. I downloaded the latest master branch from bitbucket and worked with that code. Added two files: progressBar.hpp and progressBar.sqf, also edited description.ext (to add the .hpp include) and rearmVehicle.sqf where all the progress bar implementation is. The progress bar is independent from the rearmVehicle code, the text and progress is set by calling a function, so this same progress bar code could be used for any other thing besides the vehicles rearm.

 

I found two issues. First, opening the dialog (progress bar) blocks all the user controls input, this added to the engine turning off can cause the vehicle to keep rolling out the area if it arrives to the pad at some speed, a possible workaround woud be using sanbags or concrete barries in an U shape or just at the end of the pad, so the vehicle will stop there and the driver will know he shouldn't approach too fast.

 

The player can regain control of the vehicle by pressing the ESC key, (here's the second issue) this also causes the progress bar to close, the player can drive away and the vehicle will keep getting repaired/refueled. If the player goes with the vehicle to the pad again (while the previous repair process is still running), a new repair/refuel process starts, this cause two "codes" updating the progress bar % at the same time. A possible workaround could be to add something like a boolean var, set it to true while the vehicle is repairing, and to false when it's done, if the var is true then just exit, if false then start a new repair. The bar can still be closed by ESC and the player can drive away while his vehicle repairs and refuels, but at least we can be sure that only one repair/refuel process will run at one time. I think the ESC key thing can be "blocked" in some way but haven't looked into it.

Link to comment
Share on other sites

as for the remaining vehicle speed: it might not look pretty but maybe there is a way to stop the vehicle using script? 

 

I looked into that but coulnd't find any way to do it, I though applying the car brakes would be possible from scripts but I couldn't find anything about it. The main problem with the remaining speed is that since you have no control over the vehicle/player while the dialog is up, it may cause some unintentionally accident, like crashing into other vehicles/helis/players. I will keep searching tonight and post an update here if I find any related info.

 

EDIT: I guess i forgot to use the keyword "velocity" when searching yesterday :Phttp://community.bistudio.com/wiki/setVelocity

 

I tested adding:

_veh setVelocity [0, 0, 0];

in rearmVehicle.sqf, right after turning the engine off, it works well, the car stops to 0 speed. Maybe it would be better to make it stop decelerating in a few meters, because it looks a little weird stopping so hard. But I really haven't looked into how the paremeters work. The wiki has an example for "relative acceleration", maybe with that code but using - instead of + would work.

Link to comment
Share on other sites

How about getting the X,Z,Y vehicle speed upon entering the pad with:

 Array = velocity vehicleName

Then use a while loop on the setVelocity to decrease this speed by lets say 10% every 0.1 sec. Then the vehicle will stop in 1 second.

 
As i never coded for ARMA i don't know how to comeup with a better example, however this is how i would probably do it in any other language.
 
 
[EDIT]
Or another possibility i see is:

Array = getPos vehicle & Array = getPos repairpad

Take the delta between the arrays and decrease the vehicle quick enough to stop in the middle of the pad ?

Link to comment
Share on other sites

The wiki relative acceleration code using - instead of + does work, but depending on the vehicle speed it takes more or less time and distance to stop. I tried doing the while loop and decreasing a % of velocity, but I was using the velocity on the while condition and it wasn't working well, it seems that using the speed works better. I asked on BIS forums and someone posted this (i tweaked it a little):

_speed = speed _veh;
_diff = 0.005 * (_speed / 80);
while{ (_speed > 1) } do
{
    _vel = velocity _veh;
    _dir = getDir _veh;
    _veh setVelocity [(_vel select 0)-(sin _dir*_diff),(_vel select 1)-(cos _dir*_diff),(_vel select 2)];
    _speed = speed _veh;
};

That code stops the car in the same way regardless of the vehicle speed, It may still need some further tweaking (mainly on the _diff var value).

Link to comment
Share on other sites

Fantastic work, wok. My suggestion for the vehicle speed would be to require that the vehicle is stationary before activating the script (you'll always get some people who want to just drive through and they'll get annoyed if they're suddenly stopped for repairs).

 

Just a check on speed _veh would suffice.

 

When I get back (currently not around due to moving out (for the first time!)), I wanna grab you and go through what I have in mind for dialogs in I&A. 

Link to comment
Share on other sites

Fantastic work, wok. My suggestion for the vehicle speed would be to require that the vehicle is stationary before activating the script (you'll always get some people who want to just drive through and they'll get annoyed if they're suddenly stopped for repairs).

 

Just a check on speed _veh would suffice.

 

When I get back (currently not around due to moving out (for the first time!)), I wanna grab you and go through what I have in mind for dialogs in I&A. 

 

I don't know why I didn't though about that :P That would be the best solution, since the player will never lose control of the vehicle if it's moving, any accident will be the driver's fault. Just need to make sure the are visual cues or that the pad is big enough so the driver wont have to try multiple times until he stops to 0kmh exactly on the pad.

 

As I said in another thread, hit me up anytime if you want me to do dialogs stuff. You guys surely know more than I do about arma script hehe, but I love programming and I enjoy helping with the mission, so I'll do my best.

Link to comment
Share on other sites

Wok, would you be opposed to me integrating this script with the new repair script that I've been working on? This and some extra additions to increase immersion and the whole script will be awesome.

Link to comment
Share on other sites

Wok, would you be opposed to me integrating this script with the new repair script that I've been working on? This and some extra additions to increase immersion and the whole script will be awesome.

 

Not at all, if I post any code on the forums feel free to use it for anything you want.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Forum Statistics

    11.1k
    Total Topics
    66.4k
    Total Posts
×
×
  • Create New...