Jump to content

Bridge destruction objective


Andrew-76

Recommended Posts

Hello.

I have two problems:

 

1) How to force AI to attack bridge (or another world structure)?

2) How to make bridge (or another world structure) and objective (to check alive/destroyed)?

 

Second problem is more important to me. I tried to create trigger zone and use Bomb in zone condition but there are only bombs. I need trigger to check Kh25 missile :(

 

I found only this topic from 2008 suggesting to use mod. But it is for DCS version 1.2. I guess it's not up to date anymore.

 

Any ideas? Thank you kindly!

Link to comment
Share on other sites

Every map object including bridges has its own ID. If you're willing to use lua scripting, you can check for the bridge ID whenever there is a "dead" event. I can help if you want. It's something I have to do for a project I'm working on anyways.

 

Alternately, you can cheat and just put some infantry on the bridge and check if they're dead. You'll see this in a lot of missions.

Link to comment
Share on other sites

Every map object including bridges has its own ID. If you're willing to use lua scripting, you can check for the bridge ID whenever there is a "dead" event. I can help if you want. It's something I have to do for a project I'm working on anyways.

 

Alternately, you can cheat and just put some infantry on the bridge and check if they're dead. You'll see this in a lot of missions.

 

Oh so that is why there are infantry on the bridges in the A10C campaign! :lol:

War is easy and is just like riding a bike. Except the bike is on fire and the ground is on fire and you are on fire and you realise you are in hell :joystick:

Link to comment
Share on other sites

Alternately, you can cheat and just put some infantry on the bridge and check if they're dead. You'll see this in a lot of missions.

 

I can't. It is a bridge over river :D

 

If you're willing to use lua scripting, you can check for the bridge ID whenever there is a "dead" event. I can help if you want.

 

I would appreciate your help. I could use some vid/txt guide or introduction to scripting. Never tried this stuff out yet.

 

Oh so that is why there are infantry on the bridges in the A10C campaign! :lol:

 

Now you can destroy bridge with cannon in that campaing ;)


Edited by Andrew-76
Link to comment
Share on other sites

I would appreciate your help. I could use some vid/txt guide or introduction to scripting. Never tried this stuff out yet.
I'll try to write up a small script tonight and you can look at it to see what I did. Can you tell me which bridge you're trying to destroy? Map coordinates would help.
Link to comment
Share on other sites

Here's a sample mission. I didn't use MIST as suggested just because I'm too lazy to figure it out but the gist of the mission is:

 

1. at mission start, an event handler is initialized.

2. if there is a death event, the lua script checks if it is one of the 6 bridge spans.

3. if so, flag 1 is set by the script

4. if flag 1 is set, I just display a message but you can do whatever you want.

 

Take a look at the trigger rules in the mission to get a better idea. Let me know if you have any questions.

 

kon

dead bridge example.miz

  • Thanks 1
Link to comment
Share on other sites

Let me know if you have any questions.

 

Your mission works well. But I'm propably stupid and can't find points 2 and 3 in ME. I'm afraid you will need to explain it to me more in basics...

 

I see points 1 and 4 in triggers. Trigger "Check bridge" is clear. Let's move to trigger "init handler". I have game in different language and I'm translating already translated stuff back to English - I'm sorry about possible inaccurracy (Is there a possibility to change in game language without reinstalling the game?).

 

"Create script file" - I guess we are creating temporary file with script. It is called "DeadBridgeEventHandler.lua". Ok now we have empty script file.

 

"Make a script" - Here I'm lost. I see there only inicialization command "handler.init()" and no connection to DeadBridgeEventHandler.lua nor checking 6 bridge spans or setting the flag.

 

Thanks for your patience!

Link to comment
Share on other sites

But I'm propably stupid and can't find points 2 and 3 in ME. I'm afraid you will need to explain it to me more in basics...

 

You're not stupid. You simply can't find these points in the ME. ;)

The .miz-file is nothing but a renamed ZIP-file. Open the .miz with any ZIP-program. There's a folder "I10N" and a subfolder "DEFAULT". There you will find the Lua-script.

 

With the "Create script file" you mentioned you don't create a script, but you include a script in your mission from somewhere on your harddrive.

  • Thanks 1
- Deutsche Tutorials und DCS Gameplay: youtube.com/Rakuzard | raku.yt/discord -
Link to comment
Share on other sites

The .miz-file is nothing but a renamed ZIP-file. Open the .miz with any ZIP-program. There's a folder "I10N" and a subfolder "DEFAULT". There you will find the Lua-script.

 

Now I see what I need :) You guys are awesome! I just wish to know two more things to be completly happy:

 

1. Is there somewhere list of available DCS related classes and functions (like trigger.action.setUserFlag(x,y))?

 

2. How can I find id of map object?

 

Thanks a lot (again)!

Link to comment
Share on other sites

1. Is there somewhere list of available DCS related classes and functions (like trigger.action.setUserFlag(x,y))?

 

You can take a look at the ED wiki (specifically here and here) or the wiki from the guys at Hoggit.

And I strongly suggest you take a look at MIST, if you want to dive into Lua scripting in DCS.

 

Regarding your second question, I will leave the answer to someone more knowledgeable. I remember reading something about a function in Mist... but I can't recall or look that up right now.

- Deutsche Tutorials und DCS Gameplay: youtube.com/Rakuzard | raku.yt/discord -
Link to comment
Share on other sites

2. How can I find id of map object?
I cheated. :)

 

Before I wrote that script, I used a similar script to display what the bridge id is when it was destroyed.

 

In hindsight, it would probably be better to use the Mist function Pikey referred to for a couple of reasons. First, you don't have to try to figure out the building id and second, your mission is more robust because if ED ever changes the building ids, your mission breaks.

 

But I just wanted to give you something quick and dirty.

Link to comment
Share on other sites

Mist has the function map object dead. mist.getDeadMapObjsInZones

table mist.getDeadMapObjsInZones(table zone_names)

 

I used a similar script to display what the bridge id is when it was destroyed.

 

Maybe I found even better solution in MIST. No ID needed:

 

handler = {}
world.addEventHandler(handler)

handler.onEvent = function (self,event)
local vars = {}
vars.zones = { 'BridgeZone' }
vars.flag = 1
mist.flagFunc.mapobjs_dead_zones(vars)
end

From documentation:

Once this function is run, it will start a continuously evaluated process that will set flag flag true if map objects (such as bridges, buildings in town, etc.) die (or have died) in a mission editor zone (or set of zones). This will only happen once; once the flag flag is set true, the process ends.
  • Thanks 1
Link to comment
Share on other sites

Maybe I found even better solution in MIST. No ID needed:

 

handler = {}
world.addEventHandler(handler)

handler.onEvent = function (self,event)
   local vars = {}
   vars.zones = { 'BridgeZone' }
   vars.flag = 1
   mist.flagFunc.mapobjs_dead_zones(vars)
end

From documentation:

 

Yup, that's what I was referring to ...

 

In hindsight, it would probably be better to use the Mist function Pikey referred to for a couple of reasons. First, you don't have to try to figure out the building id and second, your mission is more robust because if ED ever changes the building ids, your mission breaks.
Link to comment
Share on other sites

  • Recently Browsing   0 members

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