Author Topic: Update a vehicles datablock values through script  (Read 1641 times)

Since you can change a vehicles thrust and pitchforce values through console, can you do the same through code? Like if I pressed space for instance, could I change the vehicles default pitchforce to something much higher? How can I do this?

I already tried doing %obj.F22AvehicleDB.pitchforce = 49700; and %obj.setDatablock(F22AVehicle).pitchforce = 49700; but neither work. I dont know what I'm doing and I need help.

« Last Edit: June 01, 2017, 11:15:29 PM by kez »

the console is pretty much the same as putting a script in a file and executing it
whatever you can do in the console you can do with a script

as for the second part, what is %obj?

You should be doing vehicleData.value not %Obj.vehicledata.value

You need to use %obj.getDatablock() not %obj.dataName

as for the second part, what is %obj?
I'm just piecing together bits of code trying to see if they work. I have absolutely zero experience with torquescript (or coding in general lol)


You should be doing vehicleData.value not %Obj.vehicledata.value
You need to use %obj.getDatablock() not %obj.dataName
Like this?

%obj.getDatablock(F22AvehicleData).pitchforce = 299500;



NVM, I got it to work :P. Thanks for the help guys!
« Last Edit: June 01, 2017, 04:39:49 PM by kez »

object.getDatablock() only. this basically returns whatever datablock the object is using, if any.

if you want to modify a datablock you need to do
datablockName.yourvalue = yourvaluehere;

based on what you are doing here, I highly do not recommend this as it will update every vehicle's 'pitchforce' on the server since they are using that same datablock
« Last Edit: June 01, 2017, 04:40:10 PM by Kyuande »

based on what you are doing here, I highly do not recommend this as it will update every vehicle's 'pitchforce' on the server since they are using that same datablock
wait, so there isnt a workaround for this at all?

For changing pitchforce, I do not remember what that does

For changing pitchforce, I do not remember what that does
pitchforce is for planes.

what I'm trying to do is edit strato's F-18 and make it more maneuverable when using the afterburner



edit, i saw that ninja :P
« Last Edit: June 02, 2017, 06:45:49 AM by kez »

wait, so there isnt a workaround for this at all?
No, because the datablock is just one thing. The vehicles themselves can be multiple, but all refer back to that single datablock.

No
or you're just not creative enough with your workarounds

possible options I see:
A. one datablock per vehicle intended to be used, ie if there are 5 planes in the map, make 5 different datablocks, one for each
B. swap the vehicle to a different datablock that has the altered values, then swap back to the normal one when done

A. one datablock per vehicle intended to be used, ie if there are 5 planes in the map, make 5 different datablocks, one for each
This would be a pretty poor method, as you can't reliably create datablocks as you need them, and cannot remove them. You would have to assume 20 and script it to use 20.
B. swap the vehicle to a different datablock that has the altered values, then swap back to the normal one when done
On the other hand, this is a good option so long as there's few adjustments that have to be made. If it's just two different values, then it's only two different datablocks. Which would be great, so long as that assumption is true. Even if not, even if it needs 40 different combinations of values, it's still better than the other one because you don't forget with the prediction by constantly transmitting datablock data.