Andrew-76 Posted August 11, 2016 Posted August 11, 2016 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!
kontiuka Posted August 11, 2016 Posted August 11, 2016 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.
Kartoffel Posted August 11, 2016 Posted August 11, 2016 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:
Andrew-76 Posted August 11, 2016 Author Posted August 11, 2016 (edited) 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 August 11, 2016 by Andrew-76
kontiuka Posted August 11, 2016 Posted August 11, 2016 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.
Pikey Posted August 11, 2016 Posted August 11, 2016 Mist has the function map object dead. mist.getDeadMapObjsInZones table mist.getDeadMapObjsInZones(table zone_names) ___________________________________________________________________________ SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *
Andrew-76 Posted August 11, 2016 Author Posted August 11, 2016 Can you tell me which bridge you're trying to destroy? Map coordinates would help. See attachments.
kontiuka Posted August 12, 2016 Posted August 12, 2016 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. kondead bridge example.miz 1
Andrew-76 Posted August 12, 2016 Author Posted August 12, 2016 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!
Rakuzard Posted August 12, 2016 Posted August 12, 2016 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. 1 - Deutsche Tutorials und DCS Gameplay: youtube.com/Rakuzard | raku.yt/discord -
Andrew-76 Posted August 12, 2016 Author Posted August 12, 2016 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)!
Rakuzard Posted August 12, 2016 Posted August 12, 2016 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 -
kontiuka Posted August 12, 2016 Posted August 12, 2016 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.
Andrew-76 Posted August 12, 2016 Author Posted August 12, 2016 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. 1
kontiuka Posted August 12, 2016 Posted August 12, 2016 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) endFrom 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.
Andrew-76 Posted August 12, 2016 Author Posted August 12, 2016 Well, thank you all. I guess I have some new interesting knowledge to do some cool stuff :) 1
Recommended Posts