Jump to content

need Lua Skript (total Noob)


BlackLibrary

Recommended Posts

Hi there

 

if need a lua script for my missions.

i have 2 zones which should activate the script. (canbe done via ME Trigger, no problem)

 

script should do: get fuelstate of the plane in the zone.

 

if fuel is under 3000 pfd.

 

flag should removed and a message and soundfile should show up.

 

i found some functions:

 

Fuelstate:

number Unit.getFuel(Class Self )

 

Message:

function trigger.action.outTextForGroup(number groupId, string text, number displayTime , boolean clearview)

("plane number of plane in zone", your signal is bingo)

 

Soundfile:

function trigger.action.outSoundForGroup(number groupId, string soundfile )

 

Flag:

functon trigger.action.setUserFlag(string flagNum/FlagName, boolean/number userFlagValue )

(every plane has an own flag number)

 

now i don't know how to put this together to a working script and must i do a script for every plane or is it possible one for all.

 

maybe there is some good tutorial or a script to modify it.

thanks for every help

Link to comment
Share on other sites

I've attached a MOOSE demo mission and the script it runs on.

It contains 4 client aircraft and 2 zones. If any of these clients is at <= 25% of their internal fuel capacity when inside any of the 2 zones, a text message will be sent to them once (which will include their individual callsign).

I've added a couple of commented lines in the script, which are meant for sound messages (just introduce the name of your sound file in the bracket and uncomment the lines, it should work).

As for plane flags, I haven't used any (not sure why you would need them). If you explained the purpose of those plane flags, though, we could find other ways of achieving the same goals (or not :D )

 

Although this is a MOOSE script, the concept can probably be implemented using DCS scripting engine functions instead.

 

PS. Note that the DCS scripting engine doesn't return fuel quantities based on weight, but on percentage of total fuel capacity for each plane (expressed in decimal form).

Since planes have different fuel capacities, the fuel percentage equivalence in weight will vary from plane to plane.

 

For instance:

F15C @25% internal fuel = 1526Kg (~3364Lbs)

A10A @25% internal fuel = 1257Kg (~2771Lbs)

Su25T @25% internal fuel = 948Kg (~2090Lbs)

Su25 @25% internal fuel = 709Kg (~1563Lbs)

 

Bottom line, working with fuel weight rather than percentage isn't ideal when scripting in DCS.

Zone fuel check + message demo.miz

Fuel Check in Zone demo.lua


Edited by Hardcard
Link to comment
Share on other sites

hey

nice i try it tomorrow.

 

i need the flags for the LSO.

if flag is true - you can land with LSO instructions.

if flag is false - waveOff, bolter or with the fuel to low -> bingo (to tanker or bingo field)

 

callsign is Chevy 1 1 ? is it possible to use the plane number instad like 105 ?

Link to comment
Share on other sites

i need the flags for the LSO.

if flag is true - you can land with LSO instructions.

if flag is false - waveOff, bolter or with the fuel to low -> bingo (to tanker or bingo field)

 

callsign is Chevy 1 1 ? is it possible to use the plane number instad like 105 ?

 

 

Could you please upload your mission here? It would be much easier if I could just take a peek to see what's going on.

 

As for getting the plane number (you mean the "tail#"?) instead of the callsign, I've found no way of doing this in MOOSE.

You can get the name of the unit, its callsign, even the unit number within the group (ie. 1,2,3 or 4), but not the "tail#".

 

NOTE: Keep in mind that the "Red coalition default" aircraft use numeric values for callsigns instead.

 

Also, the DCS scripting engine doesn't offer "message to unit" functionality, you can only go as far as group level if you want to send messages.

 

Now, if each client is placed in a separate group, that's fine, but if you have several clients in the same group, then all of them will receive the same message (since it'll be a group message), which is a problem.

 

I think that your best bet is to put each client in its own separate group and work at group level, using those ME callsigns. :cry:

(It's either that or playing around with unit names, but then you might have trouble working with sets, depending on what you want to accomplish).


Edited by Hardcard
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...