stevensalvaro Posted March 25, 2016 Share Posted March 25, 2016 Hello, How to make , when the vehicle damage <50% then set the vehicle speed 50% of the vehicle speed. and if the vehicle damage < 20% then set the vehicle speed 20% of the speed , What function i need to make this script ? Link to comment
Addlibs Posted March 26, 2016 Share Posted March 26, 2016 You will need some sort of a regular check, probably though setTimer. Other functions you will need is getElementHealth, getVehicleHandling and setVehicleHandling Link to comment
EstrategiaGTA Posted March 26, 2016 Share Posted March 26, 2016 You will need some sort of a regular check, probably though setTimer. Other functions you will need is getElementHealth, getVehicleHandling and setVehicleHandling He could always use onVehicleDamage and/or onClientVehicleDamage and check if the vehicle health is < 50%. Link to comment
Addlibs Posted March 26, 2016 Share Posted March 26, 2016 Oh, right. There's also onVehicleDamage Link to comment
stevensalvaro Posted March 26, 2016 Author Share Posted March 26, 2016 whether I Had to make One by One every model ? Link to comment
Simple0x47 Posted March 26, 2016 Share Posted March 26, 2016 whether I Had to make One by One every model ? You could make it shorter using tables. Link to comment
Moderators Citizen Posted March 27, 2016 Moderators Share Posted March 27, 2016 whether I Had to make One by One every model ? Hmmm no, with getVehicleHandling you can get the maxVelocity of the vehicle (which is the source of the onVehicleDamage event) then calculate the new maxVelocity reduced by the percentage you want to apply according to its health and then set it back using the setVehicleHandling function. There is no difference between vehicle models you need to care of. Link to comment
stevensalvaro Posted March 27, 2016 Author Share Posted March 27, 2016 hmm how about if i make function to set maxVelocity of the vehicle , And then using getElementHealth vehicle if <500 then trigger maxVelocity event ? it's work ? Link to comment
Moderators Citizen Posted March 27, 2016 Moderators Share Posted March 27, 2016 then trigger maxVelocity event ? Just stick with plain functions, why would you complicate it with the use of an event ? Other than that, then yeah it will work. Create a setMaxVelocity function if you want which takes 2 params: vehicle and maxVelocity. That function will call setVehicleHandling( vehicle, "maxVelocity", maxVelocity). Or create an updateMaxVelocity function which will only take 1 param: vehicle That function will take its health, calculate the new velocity and then apply it to the vehicle. You will call that updateMaxVelocity when the onVehicleDamage event is triggered Link to comment
stevensalvaro Posted March 27, 2016 Author Share Posted March 27, 2016 okay thank you so much all for your respond Link to comment
Einheit-101 Posted March 27, 2016 Share Posted March 27, 2016 maxVelocity handling setting doesnt work for the reverse gear, so beware. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now