Jump to content

Runway Damage


Recommended Posts

I'm sorry, but you are wrong. I did the test by hitting only the runway and worked. And when I hit only a base object the flag does not activate. Do the test by yourself and you are gonna see the same results.

 

This print that I did was to show that the unguided bombs are captured by HIT and trying to understand what @Hardcard was trying to say when he said “bomb don't generate HIT events” and if we are understand each other.

 

I'm attaching a mission as an example where I only hit the runway and the code works. Press "F-10" in the mission and choose if you wanna hit only the runway or the base object and see by yourself the results.

 

Tks again

You are not saying anything different than what I have said. I did not said it was not working but merely stating that I don't know if category 4 (BASE) is seen as runway only or anything within the circle defining the airfield.

[sIGPIC]OK[/sIGPIC]

Link to comment
Share on other sites

You are not saying anything different than what I have said. I did not said it was not working but merely stating that I don't know if category 4 (BASE) is seen as runway only or anything within the circle defining the airfield.

 

Ok, now I understood what you are trying to say. I did the test, the category 4 is runway. I hit and killed the “BLOCK_WALL” object and other objects close to the runway and the flag was not activated.

 

The mission that I’ve sent shows that, and I use it to hit other parts close to the runway.

 

Sorry for the miss understood.

 

 

I've changed the code with no successes.

 

 

local Event_Handler = {}

function Event_Handler:onEvent(Event)

if Event.id == 2 and Event.target ~= nil then -- If it's a DEAD Event and the initiator is reachable

local TargetObject = Event.target
local TargetName = TargetObject:getName() 
local TargetCategory = TargetObject:getCategory() 

if TargetName == "Batumi" and TargetCategory == 4 then -- If the name and type of the object that has been destroyed match those of the specified runway 

trigger.action.setUserFlag("1", 1) -- sets the desired flag to a value of 1 

end
end
end

world.addEventHandler(Event_Handler)

Link to comment
Share on other sites

Try to print on the screen or in the log the target name. That will tell you if you use the right one.

 

Tks for the tip. I followed your advise and printed on the screen the "event.target". When I hit anything on the map it shows the name and id, but when I hit the runway it does not show, confirming that it does not generate an event.

Link to comment
Share on other sites

Guys, I'm trying things out right now.

 

So far I've discovered that bomb impacts on the runway simply don't generate any HIT events.

HIT events are only generated when the bombs hit lights and other objects located on the runway.

 

DEAD events, however, are triggered every time the runway is hit after being "destroyed" (that's my best guess anyway).

You'll see none of this in the briefing log, you need to get the event data real time in order to see it.

 

I'll get back to it now.

 

EDIT: Ok, so, since HIT events ignore runway impacts, and since there's no way (that I know of) to get a real time "damage/life reading" directly from the runway or to track bomb coordinates, I think a compromise is needed.

 

For instance, you could place small static objects (like tiny flags) along the desired runway, then use them to raise HIT events as bombs hit them. That way you could trigger the ME flag before the runway is "destroyed".


Edited by Hardcard
Link to comment
Share on other sites

Guys, I'm trying things out right now.

 

So far I've discovered that bomb impacts on the runway simply don't generate any HIT events.

HIT events are only generated when the bombs hit lights and other objects located on the runway.

 

DEAD events, however, are triggered every time the runway is hit after being "destroyed" (that's my best guess anyway).

You'll see none of this in the briefing log, you need to get the event data real time in order to see it.

 

I'll get back to it now.

 

Same results that I had. What I know is that when you hit the runway it stops work for a period of time (at least for the AI). So there is a command to AI saying that the runway is not working. If we can discover this command we can solve the problem.


Edited by Bruce_D
  • Like 1
Link to comment
Share on other sites

EDIT: Ok, so, since HIT events ignore runway impacts, and since there's no way (that I know of) to get a "damage/life reading" directly from the runway or to track bomb coordinates, I think a compromise is needed..

 

 

The function getDesc() generates a Table and this function is accept for airbases. One of the outputs of this table is the life of an object. Question: How can I isolate one of this contents from a table to show as a text on a log? I'm trying to isolate the life from the table.

Link to comment
Share on other sites

Same results that I had. What I know is that when you hit the runway it stops work for a period of time (at least for the AI). So there is a command to AI saying that the runway is not working. If we can discover this command we can solve the problem.

 

If its not exposed through EVENTS you won't be able to discover it. Lots of stuff like this is internal to the DCS engine only.

Link to comment
Share on other sites

The function getDesc() generates a Table and this function is accept for airbases. One of the outputs of this table is the life of an object

 

As I said, there's no way to get a real-time "life reading" from runways.

That only works with units, statics and some scenery.

 

When you run :getDesc() you're simply accessing a fixed table of attributes.

If you do :getDesc().life, you're only getting the theoretical max life of the runway "on paper", so to speak.

It's not the real-time life value, which is why I told you it can't be done (as far as I know).

 

It's looking more and more like your best bet is to either stick with the script as is or to place tiny static objects on the runway, so HIT events can be generated.


Edited by Hardcard
Link to comment
Share on other sites

It worked!!!!! I discovered that Batumi has a life of 3600 before I hit it with a missile and a life of 2 when it is dead!!!!

 

The "life 2" value is what I get from the runway description table, it's not a real-time "life reading".

I think you got the life value from the description table of another object (your plane maybe), when it initiated a different event (a SHOOT event, for instance). That might be where the 3600 came from.

 

:getLife() is the method we'd use to get the real-time "life reading" of objects, but it only works for units, statics and some scenery... afaik, it doesn't work for airbases/runways.

 

EDIT: Ok, I stand corrected, the following line does return a value of 3600:

local BatumiLife = Airbase.getByName("Batumi"):getDesc().life

But again, I don't think this is a real-time "life reading", I believe it's still reading from a fixed table.


Edited by Hardcard
Link to comment
Share on other sites

Sorry, I was working.

 

If you use this code before you hit the Runway you will get 3600 as a result:

 

function repetir(repete)

local teste = Airbase.getDescByName("Batumi").life

trigger.action.outText(teste, 50)

end

 

But if you use the same code after you hit the Runway you will get 2 as a result.

 

The problem is once you use it, the mission will generate a table and every time that you use it for the select airbase it will use the data from the table instead of generate a new table.


Edited by Bruce_D
Link to comment
Share on other sites

Yeap, the :getLife() would be perfect! Tks for your help.

 

I'm gonna use your code for destruction and the

function repetir(repete)
       local teste = Airbase.getDescByName("Batumi").life
trigger.action.outText(teste, 50)
end 

 

For a reconnaissance mission for after the attack.

 

Anyway, it was fun to play with this script, hope that ED change the :getLife()

 

I will travel for at least a month, but as soon as I'm back, I'm gonna post the code

 

Tks


Edited by Bruce_D
Link to comment
Share on other sites

  • 4 months later...

Hi guys,

 

I came back to this tread because I managed to create a function that checks when the runway is damage and you can use it during the entire mission.

 

Function CheckBase:

 

 

function CheckBase(Check) -- Damage runway

local base = Airbase.getByName(Check):getLife() -- Check the airbase's life

if base ~= 3600 then

	trigger.action.setUserFlag("28", 1) -- sets the desired flag to a value of 1		
		
end

end

 

 

 

And here is an example on how to use it on a script:

 

 

local Event_Handler = {}

function Event_Handler:onEvent(Event)
if Event.id == 1 and Event.initiator ~= nil then -- If it's a Shot Event and the initiator is reachable

	local PlaneShoot = Event.initiator:getName()
	local WeaponShoot = Event.weapon:getName()		
	
	if PlaneShoot == "Player 1" or PlaneShoot == "Player 2" or PlaneShoot == "RA-1" or PlaneShoot == "RA-2" then  
		
		if string.find(WeaponShoot, 167) == nil then -- first 3 numbers for A2A Missiles, LUU-2B, GBUs (except GBU-24) and ADM-141A for the F-14 and F/A-18
			
			if string.find(WeaponShoot, 168) == nil then -- first 3 numbers for A2A Missiles, LUU-2B, GBUs (except GBU-24) and ADM-141A for the F-14 and F/A-18
			
				CheckBase('Bandar-e-Jask airfield')
			
			end
		end		
	end
end
	
end

world.addEventHandler(Event_Handler)

function CheckBase(Check) -- Damage runway

local base = Airbase.getByName(Check):getLife() -- Check the airbase's life

if base ~= 3600 then

	trigger.action.setUserFlag("28", 1) -- sets the desired flag to a value of 1		
		
end
end

 

 

 

I’ve attached a mission for the Persian Gulf as an example.

Runway attack test.miz

Link to comment
Share on other sites

  • 1 year later...

Hi @Chump,

 

Good question. I've only tried for the runway. But I'm creating a dynamic campaign and I'll try for other objects on the airbase. But one bomb may destroy other areas of the airbase.

 

Hi @brontolo,

 

yes! Teste2 is the lua file for the mission. Open the misson with winrar and you will find the teste2.lua file.

 

Best regards 

Link to comment
Share on other sites

1 hour ago, Bruce_D said:

Hi @brontolo,

 

yes! Teste2 is the lua file for the mission. Open the misson with winrar and you will find the teste2.lua file.

 

Best regards 

Hi Bruce, thanks,

I did it, I've find the file but I'm a beginner, I don't know which flag (27, 29, 31, 28) becomes true if the runway is damaged (I would use it to give a message like "Good hit!")

Thanks a lot again

Brontolo


Edited by brontolo

Brontolo VIAF

Link to comment
Share on other sites

On 9/9/2019 at 7:24 PM, Bruce_D said:

Hi guys,

 

I came back to this tread because I managed to create a function that checks when the runway is damage and you can use it during the entire mission.

 

Function CheckBase:

 

 

  Reveal hidden contents

 



function CheckBase(Check) -- Damage runway

local base = Airbase.getByName(Check):getLife() -- Check the airbase's life

if base ~= 3600 then

	trigger.action.setUserFlag("28", 1) -- sets the desired flag to a value of 1		
		
end

end
 

 

 

 

 

And here is an example on how to use it on a script:

 

 

  Reveal hidden contents

 



local Event_Handler = {}

function Event_Handler:onEvent(Event)
if Event.id == 1 and Event.initiator ~= nil then -- If it's a Shot Event and the initiator is reachable

	local PlaneShoot = Event.initiator:getName()
	local WeaponShoot = Event.weapon:getName()		
	
	if PlaneShoot == "Player 1" or PlaneShoot == "Player 2" or PlaneShoot == "RA-1" or PlaneShoot == "RA-2" then  
		
		if string.find(WeaponShoot, 167) == nil then -- first 3 numbers for A2A Missiles, LUU-2B, GBUs (except GBU-24) and ADM-141A for the F-14 and F/A-18
			
			if string.find(WeaponShoot, 168) == nil then -- first 3 numbers for A2A Missiles, LUU-2B, GBUs (except GBU-24) and ADM-141A for the F-14 and F/A-18
			
				CheckBase('Bandar-e-Jask airfield')
			
			end
		end		
	end
end
	
end

world.addEventHandler(Event_Handler)

function CheckBase(Check) -- Damage runway

local base = Airbase.getByName(Check):getLife() -- Check the airbase's life

if base ~= 3600 then

	trigger.action.setUserFlag("28", 1) -- sets the desired flag to a value of 1		
		
end
end
 

 

 

 

 

I’ve attached a mission for the Persian Gulf as an example.

Runway attack test.miz 10.37 kB · 93 downloads

thank you so much for the @Bruce_D !!! this was so much needed! 

The Fraternity: Georgia Reign Multiplayer Server
Dynamic Multiplayer PVE Server - 24/7

Georgia Reign Server: 69.30.198.74:10308 ★ SRS: SRS: 69.30.198.74:5002
FOR LIVE INTERACTIVE MAP & LIVE STATS: https://thefraternitysim.com/

Link to comment
Share on other sites

6 minutes ago, Bruce_D said:

Pleasure. If you want I can post a new function that it is more useful. 

yes PLEASE! 🙂 I am currently working on my next multiplayer server development now and this would be a great addition! Thank you for your hard work sir! 

The Fraternity: Georgia Reign Multiplayer Server
Dynamic Multiplayer PVE Server - 24/7

Georgia Reign Server: 69.30.198.74:10308 ★ SRS: SRS: 69.30.198.74:5002
FOR LIVE INTERACTIVE MAP & LIVE STATS: https://thefraternitysim.com/

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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