American Eagles Modding Forums


Hi! You are currently viewing forum as a guest. For more features please login or register!

Member Login



Lost your password?

Forum Stats

Latest Member


Not a member yet? Sign Up!



*



October 17, 2019, 09:18:23 AM

Author Topic: Lua scripting HP_Wheels.Lua  (Read 948 times)

0 Members and 1 Guest are viewing this topic.

Offline AlbertL (OP)

Lua scripting HP_Wheels.Lua
« on: December 13, 2015, 01:05:39 PM »
Ok, here is my deal that I am completely out of my element, and need some serous help here to get these working correctly with the hardpointextention mod system.

First is the HP_Wheels.lua for optional wheels. Example,

This lua will be for the adjustment of your wheel width in your xml wheel string witch is read by the Tyre Tracks lua.
The xml would be set for the first wheel listed in your Hardpoint objects section, coded as
Code: [Select]
"requireObject="true"" , and already attached on purchase,
Code: [Select]
<attachOnLoad locationId="1" objectId="1" />
So, when I go and replace the standard wheels with  row-crop, or wide flotation tires. I need way to over ride the radius and width currently above in my vehicle xml by having a lua ignore these in that xml and look instead at my HP_Wheel.xml. IE:

Quote
<locations type="wheels" workshopImageFile="locationWheels.dds" requireObject="true" >
         <location index="0>0" />
         <location index="0>1" />
         <location index="1>0" />
         <location index="1>1" />
      </locations>

    <object type="wheels" price="1000" file="hardpoint_Wheels_standard/wheels.i3d" xmlFilename="hardpoint_Wheels_standard/wheelsStandard.xml">
         <workshop name="standard" imageFile="hardpoint_Wheels_standard/wheelsStandard.dds" />
      </object>
      <object type="wheels" price="1600" file="hardpoint_Wheels_rowcrop/wheels.i3d" xmlFilename="hardpoint_Wheels_rowcrop/wheelsrowcrop.xml">
         <workshop name="rowcrop" imageFile="hardpoint_Wheels_rowcrop/wheelsrowcrop.dds" />
      </object>   

HP_Wheel xml in red above,

Code: [Select]
<Wheels autoRotateBackSpeed="2" >
<wheel wheel="1" radius="1.1" width="0.45" hasTyreTracks="true" tyreTrackNode="0>0" tyreTrackAtlasIndex="0" />
<wheel wheel="2" radius="1.1" width="0.45" hasTyreTracks="true" tyreTrackNode="0>1" tyreTrackAtlasIndex="0" />
<wheel wheel="3" radius="1.1" width="0.45" hasTyreTracks="true" tyreTrackNode="0>2" tyreTrackAtlasIndex="0" />
<wheel wheel="4" radius="1.1" width="0.45" hasTyreTracks="true" tyreTrackNode="0>3" tyreTrackAtlasIndex="0" />
</Wheels>


My butchered attempt at a lua to do this.


--
-- HardpointWheels
-- Specialization for Hardpoint optional Wheels
--
-- free for noncommerical-usage
--
HP_Wheels = {};

function HP_Wheels.prerequisitesPresent(specializations)
    return true;
end;

function HP_Wheels:load(xmlFile)

      wheel.wheelIndex = HardPointslocationIndex;
      wheel.node = Utils.indexToHardPointsObject(self.components, getXMLString(xmlFile, wheelnamei .. "#node"));

        if wheel.hasTyreTracks and g_currentMission.tyreTrackSystem ~= nil then
            wheel.tyreTrackNode = Utils.indexToHardPointsObject(self.components, getXMLString(xmlFile, wheelnamei.."#tyreTrackNode"));
            wheel.radius = Utils.getNoNil(getXMLFloat(xmlFile, wheelnamei.."#radius"), 0.5);
            local wheelWidth = Utils.getNoNil(getXMLFloat(xmlFile, wheelnamei .. "#width"), 0.5);
            local tyreTrackAtlasIndex = Utils.getNoNil(getXMLInt(xmlFile, wheelnamei .. "#tyreTrackAtlasIndex"), 0);
            wheel.tyreTrackIndex = g_currentMission.tyreTrackSystem:createTrack(wheelWidth, tyreTrackAtlasIndex);
        end
   end;
end;


The second Lua would do exactly the same thing, only this one would work for duels as well as triples.

Currently I am using the Buy able dual scripts/system I used on the upload Case combine. Surprisingly, it works well with the Hardpoint whee option set up.





BTW, before anyone asked. No i have not tried to set up a Tera-track option in HP yet, but plan to try.... lol






"I asked Jesus, "How much do you love me?" Jesus replied, "This much" and stretch






 

 

Related Topics

  Subject / Started by Replies Last post
8 Replies
1689 Views
Last post April 21, 2013, 10:16:34 PM
by 1972chevy
3 Replies
1193 Views
Last post January 19, 2015, 06:25:04 PM
by jrd84
5 Replies
1417 Views
Last post February 21, 2015, 01:34:13 PM
by farmerboy69
7 Replies
1886 Views
Last post April 06, 2015, 01:37:03 AM
by ozgamer
1 Replies
777 Views
Last post June 18, 2015, 08:29:09 PM
by farmerboy69

Powered by EzPortal