LUA Changing properties of a vessel with LUA

abr35

Member
Joined
Sep 5, 2011
Messages
44
Reaction score
7
Points
23
Might be a very basic question. I'm learning/experimenting with lua. Is it possible to change values for orbiter vessels in lua? Suppose I wanted to remove power from a system (let's call it HUDSystem) and make the HUDSystem.Voltage() equal to 0 with a lua script? Can it be done? How?

Thanks!
 

4throck

Enthusiast !
Joined
Jun 19, 2008
Messages
3,502
Reaction score
1,008
Points
153
Location
Lisbon
Website
orbiterspaceport.blogspot.com
Step back a bit.

You can access or set vessel parameters listed on Orbiter's API documentation.
Orbiter simulates the "engine system" and for that yes, you can set fuel to 0. The same goes for radios, for example.

But there's no support for user defined systems, such as your HUDsystem.
You would have to program such a system, and handle it's integration with Orbiter, save and load states from scenarios, etc.

I's not impossible, but depends on what you want to do.


On the previous versions of Orbiter LUA disregarded keyboard events, so it's not really that useful for interaction. Perhaps that bug has been solved, I don't know.
 
Last edited:

BEEP

Addon Developer
Addon Developer
Joined
Apr 5, 2008
Messages
153
Reaction score
15
Points
18
HI! How is New Jersey snow?

You may check

Code:
function victimize(vctmvi)
.
.
.
end

at the end of any of the loads for Bombsight Script MFD such as Mk_82.cfg


There, in order to turn a vessel into a smoking pit I changed almost every parameter in the vessel. It may not work for all vessels but works for the simple ones ( my Makeshift targets included.)

Rgds

Beep
 
Last edited:
Top