How would i go about knowing if a door window as broken or if a door is open? I could check if node is broken, but the nodesID are different for each car :\
The game has no knowledge of whether a node is part of a door or not. The nodes and beams come together in a completely arbitrary way that we interpret as being a vehicle. So really, you cant.
this wouldn't be very useful, until it actually becomes a proper game and you can open and close doors, a door that is smashed open would probably not have the sensor working anyway
I actually want it so when the door is open or the windows break the music in the car play louder. But guess ill scratch that.
You could check the state of the breakGroups. Every car has a "vehiclename_doorlatch_FR/FL" breakgroup, as well as a "vehiclename_doorglass_FR/FL" breakgroup for the glass.
Hey i found the break group, but how do i get the state? Code: for k, b in pairs(v.data.beams) do if b.breakGroup ~= nil and b.breakGroup ~= "" then print(b.breakGroup`.hatch_doorglass_L) end end It all prints out NIL, so i must be doing the wrong thing
This might help? From beamstate.lua Code: -- breakgroup handling if beam.breakGroup and beam.breakGroup ~= "" then -- find all beams with that breakgroup if beam.breakGroupType == 0 or beam.breakGroupType == nil then -- break all beams in that group for k, b in pairs(v.data.beams) do if b.breakGroup == beam.breakGroup then --log('D', "beamstate.beamBroken"," breakgroups: also breaking beam "..k.. " as in breakgroup ".. b.breakGroup) obj:breakBeam(k) luaBreakBeam(k) end end
All that does is find the beam and break, which can't rally tell me if its broken, but yes i already went over that code and the most i can get out of it the screen below, its all the values for was seems to be the hatch window beams. Even have access to the CollTris but it only tells me the number of the colltris. nothing else in that seems to tell me any clue on if the glass broke. Im balls deep 6 for and if loops to get there, and i fear i just hit the bottom. theres a few tables in there, ill check them all and see if they tell me something. Good thing is that made me discover how to get nodes id out of vehicle part names so i can dynamicly control where the sound from the radio comes from, which the best is the front bumper so it feels as if its inside the car when you turn your head.
Just came across this thread now. This should be what you're looking for. Code: obj:beamIsBroken(beam.cid)
Im so dumb holycrap, the function's name speaks for itself. Thanks dummies, you're the man of the hour
I was about to code a complex function that would check the G meters and try to predict if the door is broken by that. You just saved me a lot of work.