Jump to content

Recommended Posts

Posted (edited)
What if I just wanted it to be a flat texture that can be put on top of the terrain?

 

I don't see how. You can add static unit on the map (I imagine that you can create a very flat 3d model), with the texture you want.

If you don't add units to the map, you have to change the texture for the given season at the right location. Just for one mission ?

 

Good luck :)

Edited by galevsky06
Posted

As a substitute I used the white containers in ME...does not look bad at all...

 

Please share your training mission if you guys are finished with it...I think a combination of everybody's missions could result in one hell of a training mission.

 

I am still far from finished because of some more script issues, I would like to have it indicated in chat who dropped the bomb, and at the completion of bombing all targets give a visual score for that pilot...

 

If I just was was not so lua impaired...aw well!

Midnite Signature.jpg

Posted

I have so little scripting experience my mission would be pretty tame compared to yours. I took a look at yours and its pretty impressive.

 

Mine is basically a plane on the tarmac, the target zone with Red smoke, a T-72 under that smoke, and some waypoints to mark approaches to it.

 

For me thats all I need anyway, except for that ground painted target that apparently takes a quest to accomplish. I have used white containers too, but they're hardly perfect. Its also time consuming to try and place a lot of them.

Warning: Nothing I say is automatically correct, even if I think it is.

Posted (edited)
You're welcome. :smilewink:

 

Hope I'm still welcome...:cry:

 

My script is now in total chaos...:helpsmilie:

 

targetrange = {'target1', 'target2', 'target3', 'target4'} -- targetzone name

function activateTarget(id)
   if (activeTarget == nil) then
       activeTarget = "target"..id
       timer.scheduleFunction(SignalTarget, nil, timer.getTime() + 1)
   else
        activateTarget = "target"..id
   end
end

function SignalTarget()
       local Rangetarget = Unit.getByName(ActiveTarget)
       if RangeTarget then -- <<<<<<< flare only if ActiveTarget is not nil
           Aimpointpos  = Rangetarget:getPosition().p
           Aimpointposx = Aimpointpos.x
           Aimpointposz = Aimpointpos.z
           Aimpointposy = land.getHeight({x = Aimpointposx, y = Aimpointposz})
           Aimpt3 = {x=Aimpointposx, y=Aimpointposy, z=Aimpointposz}
           trigger.action.signalFlare({x=Aimpointposx, y=Aimpointposy, z=Aimpointposz}, trigger.flareColor.Green, 0)
       end
   return timer.getTime() + 5
end
timer.scheduleFunction(SignalTarget, nil, timer.getTime() + 1)

DummybombHandler = {}                                                
function DummybombHandler:onEvent(event)
   if event.id == world.event.S_EVENT_SHOT 
   then
       BombInit = event.initiator                                    
       BombInitGroup = BombInit:getGroup()    
       _alpha = mist.getHeading(BombInit)


           _ordnance = event.weapon                                    
           _ordnanceName = _ordnance:getTypeName()
           if (_ordnanceName == "weapons.bombs.BDU_50HD" or _ordnanceName == "weapons.bombs.BDU_50LD") 
           then
               function TrackBombDummy()
               local BombDummyPos = _ordnance:getPoint()
               local _time = timer.getTime();
                   if BombDummyPos.y < land.getHeight({x = BombDummyPos.x, y = BombDummyPos.z}) + 10
                   then
                       
                       local xOffset = BombDummyPos.x - Aimpointposx
                       local zOffset = BombDummyPos.z - Aimpointposz
                       local BombOffset = math.sqrt(xOffset * xOffset + zOffset * zOffset)
                       local BombOffsetInt = math.floor(BombOffset)
                       
                       local _beta = math.atan2(zOffset,xOffset)

                       local _gamma = _alpha - _beta
                       local xOffsetRel = BombOffset * math.sin(_gamma*(-1))
                       local zOffsetRel = BombOffset * math.cos(_gamma)
                       local xOffsetRelAbs = math.floor(math.abs(xOffsetRel))
                       local zOffsetRelAbs = math.floor(math.abs(zOffsetRel))
                       
                           if (xOffsetRel > 0 and zOffsetRel > 0)
                           then
                               trigger.action.outText("Distance off: "..string.format(BombOffsetInt) .. "m / Off right "..string.format(xOffsetRelAbs) .. "m / Too long by "..string.format(zOffsetRelAbs).."m", 10)
                           elseif (xOffsetRel > 0 and zOffsetRel < 0)
                           then
                               trigger.action.outText("Distance off: "..string.format(BombOffsetInt) .. "m / Off right "..string.format(xOffsetRelAbs) .. "m / Too short by "..string.format(zOffsetRelAbs).."m", 10)
                           elseif (xOffsetRel < 0 and zOffsetRel > 0)
                           then
                               trigger.action.outText("Distance off: "..string.format(BombOffsetInt) .. "m / Off left "..string.format(xOffsetRelAbs) .. "m / Too long by "..string.format(zOffsetRelAbs).."m", 10)
                           elseif (xOffsetRel < 0 and zOffsetRel < 0)
                           then
                               trigger.action.outText("Distance off: "..string.format(BombOffsetInt) .. "m / Off left "..string.format(xOffsetRelAbs) .. "m / Too short by "..string.format(zOffsetRelAbs).."m", 10)
                           end    

                       return
                   end
                   return timer.getTime() + 0.01                    
               end
               timer.scheduleFunction(TrackBombDummy, nil, timer.getTime() + 1)
           end
       --end
   end
end
world.addEventHandler(DummybombHandler)

I also get errors now--"error in error handling"

Added the mission if you would like to have a look at it my incompetence.

 

(please do not download this mission-it's chaos)

Edited by Midnight

Midnite Signature.jpg

Posted

I will have a deeper look, but for now:

 

local Rangetarget = Unit.getByName(ActiveTarget)
if RangeTarget <<<< variables are case-sensitive, Range[u]T[/u]arget is not Range[u]t[/u]arget

Posted

Is it possible to convert the reported "miss" calls from meters to feet?

 

When I look at the bit that talks about calling this it shows:

 

if (xOffsetRel > 0 and zOffsetRel > 0)

then

trigger.action.outText("Distance off: "..string.format(BombOffsetInt) .. "m / Off right "..string.format(xOffsetRelAbs) .. "m / Too long by "..string.format(zOffsetRelAbs).."m", 10)

elseif (xOffsetRel > 0 and zOffsetRel < 0)

then

trigger.action.outText("Distance off: "..string.format(BombOffsetInt) .. "m / Off right "..string.format(xOffsetRelAbs) .. "m / Too short by "..string.format(zOffsetRelAbs).."m", 10)

elseif (xOffsetRel < 0 and zOffsetRel > 0)

then

trigger.action.outText("Distance off: "..string.format(BombOffsetInt) .. "m / Off left "..string.format(xOffsetRelAbs) .. "m / Too long by "..string.format(zOffsetRelAbs).."m", 10)

elseif (xOffsetRel < 0 and zOffsetRel < 0)

then

trigger.action.outText("Distance off: "..string.format(BombOffsetInt) .. "m / Off left "..string.format(xOffsetRelAbs) .. "m / Too short by "..string.format(zOffsetRelAbs).."m", 10)

end

 

 

So it seems "m" represents meters. Is it really so simple as to put "f" and get feet, or is it more complicated than that?

Warning: Nothing I say is automatically correct, even if I think it is.

Posted

These are string messages.. Feel free to put an 'f', but don't forget to change the values (1.8 factor) because xxxOffSetxxx variables contain distances in meters.

Posted

Yea I have no idea where to input changes then. I understand what some of these lines relate to, but there's a lot happening in here I don't understand.

 

Which value(s) am I changing, and what does "1.8 factor" mean?

 

Did I ever tell you how bad I am at math? :P

Warning: Nothing I say is automatically correct, even if I think it is.

Posted

I see you fellows are applying the script, due to real life I have little time available for scripting at the moment, but I guess you get along... ;)

 

For an output in feet, you can simplifiy this by using:

 

trigger.action.outText("Distance off: "..string.format(BombOffsetInt) .. "ft / Off left "..string.format(xOffsetRelAbs) .. "ft / Too short by "..string.format(zOffsetRelAbs).."ft", 10)

 

and

 

local xOffset = (BombDummyPos.x - Aimpointposx)*3.28084
local zOffset = (BombDummyPos.z - Aimpointposz)*3.28084

 

But I think there is also a MIST Function which converts feet to meter or otherwise.

 

Don´t know what the "1.8" mentioned above is supposed to do though?

[sIGPIC][/sIGPIC]

 

Unsere Facebook-Seite

Posted (edited)

Thanks a pantload guys, you're real chums.

 

Will get back to you on how that all works out for me.

 

EDIT. Works beautifully.

Edited by P*Funk

Warning: Nothing I say is automatically correct, even if I think it is.

Posted (edited)

Alright, new puzzle.

 

How do I tweak this script for better use with multi-bomb delivery? That is to say, how can I get it to better represent hits for 2 or more bomb ripples, or paired deliveries that bracket the target?

 

I've only noticed a single hit call when I drop two bombs. It'll tell me I'm off by say 50 feet or something or a dozen or two meters, but when I review the Tacview of the run it clearly shows that the first bomb in the ripple hits the bulleye, while the one that landed short is the one that gets reported by the string message. In multi bomb deliveries the reticle centre at pickle represents where the centre of the bomb stick or bracket should go, so knowing where that ended up is as useful as knowing where one bomb did on its own.

 

I'd be content with just seeing every bomb's hit reported as a separate hit and then estimating the difference, though I dont know if this is beyond the function being used in this script.

Edited by P*Funk

Warning: Nothing I say is automatically correct, even if I think it is.

Posted

It will only acount the last bomb dropped if you drop 2 bombes separatly, because it will overwrite the shot-event.

 

You could try to add a kind of counter to the event-function and asign seperate track functions to each bomb/ counter, but the message would overlap, so you would than need other functions to delay the messages and so on... You can calculate an average of bombs dropped during a certain period, or get the one closest to the mark, but than you have to define the period time to consider...

 

Well, don´t know if that is all worth the effort..

[sIGPIC][/sIGPIC]

 

Unsere Facebook-Seite

Posted

Well it sounds awfully complicated, but exactly like the kind of problem solving exercise that would serve to teach me a lot about writing these scripts, so I might take it on if only as a learning exercise.

 

If I wanted to have multiple counters for every bomb, there's no way to have it just display multiple messages without overwriting the last?

 

Also, I haven't tested it, but if you dropped them in pairs, meaning simultaneous release, how does it count the bombs?

Warning: Nothing I say is automatically correct, even if I think it is.

Posted (edited)
Well it sounds awfully complicated, but exactly like the kind of problem solving exercise that would serve to teach me a lot about writing these scripts, so I might take it on if only as a learning exercise.

 

If I wanted to have multiple counters for every bomb, there's no way to have it just display multiple messages without overwriting the last?

 

Also, I haven't tested it, but if you dropped them in pairs, meaning simultaneous release, how does it count the bombs?

The idea is:

 

Fill-in messages queue (time => [message]) instead of immediate printing, Then, create a separate scheduled function that will print all messages in queue (if any) thanks to that post, and remove printed items from queue. The issue is how to manage concurrent access to messages queue. And this is where design pattern-based code solves us. But not in lua as far as my personnal skills are concerned :(

Edited by galevsky06
Posted

Interesting.

 

I don´t think it is too complicated for someone familar with programming and LUA, well, 2 things I am not.

[sIGPIC][/sIGPIC]

 

Unsere Facebook-Seite

Posted

So it should be possible to store up a record of every bomb dropped then have some trigger to display the collected data on every bomb that was dropped in the arbitrary period?

 

Could this be triggered somehow with a hotkey or are we limited to passive criteria for triggers? If I understand correctly, it should be possible to trigger based on entering/exiting a zone, but there are so many variables for bomb delivery that its hard to know what threshold makes sense for that zone. Altitude based threshold for trigger seems a poor choice as delivery from a high altitude could lead to release and pulling up well above the base altitude of a lower bomb delivery. One solution I guess is that you have a pre-planned bombing leg pattern that guarantees you exit beyond a determined distance from the target area and when you exit you get the collected information displayed.

 

Thats assuming I understand whats possible. Its also a far cry from what I have any capacity to actually write myself. At least I think I'm starting to understand how this stuff functions.

Warning: Nothing I say is automatically correct, even if I think it is.

Posted
So it should be possible to store up a record of every bomb dropped then have some trigger to display the collected data on every bomb that was dropped in the arbitrary period?

 

Could this be triggered somehow with a hotkey or are we limited to passive criteria for triggers? If I understand correctly, it should be possible to trigger based on entering/exiting a zone, but there are so many variables for bomb delivery that its hard to know what threshold makes sense for that zone. Altitude based threshold for trigger seems a poor choice as delivery from a high altitude could lead to release and pulling up well above the base altitude of a lower bomb delivery. One solution I guess is that you have a pre-planned bombing leg pattern that guarantees you exit beyond a determined distance from the target area and when you exit you get the collected information displayed.

 

Thats assuming I understand whats possible. Its also a far cry from what I have any capacity to actually write myself. At least I think I'm starting to understand how this stuff functions.

 

You can also use custom radio menu F10 to ask for last messages... but pilot has to know that his bomb hit the ground...

Posted (edited)

Maybe this is what you are after? I modified the message system I use in my DCS Battlefield mission into a simpler version. It will show multiple messages and each message for individually specified time on screen. In the original version you can specify if the message is for all, red, blue, or for a group (you give it the group name) but it's a bit more complicated to use and it takes lot more time to figure out how the actual message system works. I haven't tested these functions but they are based on tested and working functions so there shouldn't be big problems. To use you just do the script file and then call addMessage(string message, number duration) to show messages.

 

 

messages = {};
refreshrate = 1; --in seconds

function addMessage(msg, duration)
   table.insert(messages, msg);
   mist.scheduleFunction(RemoveMessage, {msg }, timer.getTime() + duration);
end;

function RemoveMessage(msg2)
   for i, tablemsg in ipairs(messages) do
       if tablemsg == msg2 then
           table.remove(messages, i);
           break;                
       end;
   end;    
end;

function ShowMessages()
   local messages = mist.utils.deepCopy(messages)
   local output = "";
   
   for i, val in ipairs(messages) do
       if i == 1 then
           output = val;
       else
           output = output .. "\n" .. val;
       end;
   end;
   
   trigger.action.outText(output, refreshrate);
   mist.scheduleFunction(ShowMessages, {}, timer.getTime() + refreshrate);
end;

ShowMessages();

 

 

Feel free to edit or use it in any way you want.

SimpleMessageSystem.lua

Edited by Bushmanni
added eula

DCS Finland: Suomalainen DCS yhteisö -- Finnish DCS community

--------------------------------------------------

SF Squadron

Posted

Hum... it looks that you can face dis-synchronized issue: you can remove some text before copying messages to local var. depending on time execution duration (you don't manage concurrent access to messages)

Posted
Hum... it looks that you can face dis-synchronized issue: you can remove some text before copying messages to local var. depending on time execution duration (you don't manage concurrent access to messages)

 

I have been thinking about that but don't know how to do it or even how the scheduling works in detail. Could you PM me a general idea how to do it so I can search about the details of the implementation on my own.

DCS Finland: Suomalainen DCS yhteisö -- Finnish DCS community

--------------------------------------------------

SF Squadron

  • Recently Browsing   0 members

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