Bahger Posted June 14, 2011 Posted June 14, 2011 Most static objects do not contain the "Start time" field, therefore you cannot get them to spawn via delaying the start time and using "Group activate". I'm trying to get a Red Command Center to spawn via trigger; is there any way around this limitation using .lua coding? Many thanks. 1
Speed Posted June 14, 2011 Posted June 14, 2011 (edited) Most static objects do not contain the "Start time" field, therefore you cannot get them to spawn via delaying the start time and using "Group activate". I'm trying to get a Red Command Center to spawn via trigger; is there any way around this limitation using .lua coding? Many thanks. I don't think so. You can't even spawn unit groups via lua, there is no "group activate" function or equivalent, last I checked. Keep in mind, last I checked, unless there were significant changes in 1.1.0.8 (I haven't checked yet), there are only a few limited ways to use lua to modify the game world: Set or clear flags Assign tasks/commands/options/formations to groups Lua is capable of a few other things, but they don't really modify the current, running, game world: Add/remove F10 radio menu items (I think) Generate radio messages (can only pick from existing radio messages I think) Close the program or load a mission Set time compression (I think) Set your camera view object (I think) That's not a complete list of things lua can modify, but you get the point: It ain't much :( Anyway, last I checked, those were a complete list of our options. I haven't done a _G dump in 1.1.0.8 yet to find out if there were any changes, however. I'm doing that tonight, I need a new one for work on my scripting guide, which is growing nicely now... still donno when it will be done though. Certainly not tonight, but possibly by or sometime this weekend. Gonna guess it will be somewhere around 20-30 pages and 4000-6000 words. Edited June 14, 2011 by Speed Intelligent discourse can only begin with the honest admission of your own fallibility. Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/ Lua scripts and mods: MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616 Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979 Now includes remote server administration tools for kicking, banning, loading missions, etc.
Bahger Posted June 14, 2011 Author Posted June 14, 2011 Thanks, Speed. Your scripting guide will be like holy writ to me.
Speed Posted June 14, 2011 Posted June 14, 2011 (edited) Thanks, Speed. Your scripting guide will be like holy writ to me. I wouldn't pin so many hopes on it... it's not like it's going to tell you how to write lua script, that would be a whole book that I am most certainly not qualified to write. Instead, it's going to tell someone how to use lua script within DCS, and what the DCS- specific lua functions are and how they work. You need to use the online sources such as the lua 5.1 manual if you want to learn how to write lua script itself. For example, I won't include how to use io.read or io.write functions because that's standard lua function library stuff. I may include appendices where various scripts I have written exist, but then I'd be holding my scripts up like some kind of gold standard people should copy- and they are far from it. Anyway lua, overall, is far too vast of a subject, and sources for learning it already exist: http://www.amazon.com/Programming-Lua-Roberto-Ierusalimschy/dp/8590379817 Actually, I should buy that book myself, since I still don't understand what a metatable is. Edited June 14, 2011 by Speed Intelligent discourse can only begin with the honest admission of your own fallibility. Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/ Lua scripts and mods: MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616 Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979 Now includes remote server administration tools for kicking, banning, loading missions, etc.
Panzertard Posted June 14, 2011 Posted June 14, 2011 Most static objects do not contain the "Start time" field, therefore you cannot get them to spawn via delaying the start time and using "Group activate". I'm trying to get a Red Command Center to spawn via trigger; is there any way around this limitation using .lua coding? Many thanks. Can't be done - yet. Such a feature has been requested, but right now you either put the statics there (or a similar AI unit) or not. If you're not looking for a Farp, Structure - but a vehicle, then you have the option of: - Making a group, set starttime for later - Use a trigger and set the group to 'Group Disable AI'. But it only work for emulating 'static' vehicles - you can't emulate 'static' structures, helipad or other units like that. The mind is like a parachute. It only works when it's open | The important thing is not to stop questioning
Speed Posted June 16, 2011 Posted June 16, 2011 (edited) I was hoping at one point yesterday I was going to have to eat my words. I attempted to do a _G dump (it outputs all the lua global variables and functions to a text file) and the game froze. After some modifications to the dump _G script, I was finally able to get it to spit out a text file that contains _G. It's 7MB and about 200,000 lines long! Previously, _G was only like 12,000 lines long. The increased length has to do with the new in-flight debriefing system, I believe. Anyway, I think we now may have direct access through memory to events such as weapons fired and what they hit, but I need to do some explorations of this. If we DO have access to this though, I might be able to make "friendly fire" and "destroyed map object" scripts WITHOUT having to create and run a batch file that copies your debrief.log! Anyway, perhaps somewhere in these 200,000 lines now lies the secret of creating custom waypoints on the fly, but I doubt it. Thanks to notepad++'s search abilities, it won't take all that long to go through there, and last night, I viewed all the functions by searching for the word "function". There are certainly some new lua functions in there, some of which could be useful, but none of which, that I saw, would allow modifications to the game world other than the already mentioned trigger.setUserFlag and Controller functions. All the new lua I saw would just allow more data harvest. More experimentation is certainly required though! Edited June 16, 2011 by Speed Intelligent discourse can only begin with the honest admission of your own fallibility. Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/ Lua scripts and mods: MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616 Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979 Now includes remote server administration tools for kicking, banning, loading missions, etc.
Speed Posted June 16, 2011 Posted June 16, 2011 Just curious Bahger, why do you need static objects to spawn? Are you doing some kind of randomized mission where in some play throughs, you want certain static objects to just not exist? Intelligent discourse can only begin with the honest admission of your own fallibility. Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/ Lua scripts and mods: MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616 Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979 Now includes remote server administration tools for kicking, banning, loading missions, etc.
Bahger Posted June 16, 2011 Author Posted June 16, 2011 I'm using randomisation to generate any possible combination of two out of six targets every time the mission starts. Vehicles can be made to appear, or not appear, this way because you have to set the start time to 23 hours ahead of mission start; as you know, this enables them to spawn via trigger. However, I want the target not to be a vehicle but a large static object (a FARP Commend Center). I cannot do it because static objects have no start time field. In other words, the conceptual logic is that there are two CCs that need to be killed but they appear in different locations (out of six) according to the roll of the dice.
Ripcord Posted June 17, 2011 Posted June 17, 2011 Bahger, you could perhaps just blow up the 4 FARPS you don't want to be there -- randomly of course. Use the explosion action in the trigger menu, which would be set to a specific zone over each FARP. All of it would happen right at the start of the mission, while your player is still on the deck, so he woudn't see it actually happen. He might see the black smoke and wreckage though. Heck it might even make for a little bit of extra eye candy and lend something extra to the storyline, I dunno. Might also look hokey as hell, but it is a thought. Ripcord [sIGPIC][/sIGPIC]
Bahger Posted June 17, 2011 Author Posted June 17, 2011 Interesting suggestion, Ripcord. I have dealt with this by placing all 5 FARPs, because I can't generate only two using randomisation, but I can generate orders tasking the player on two of them, chosen by randomisation. To cover the existence of the remaining FARPs, I'm briefing the player that all five sites exist but only two are going to be in use/defended. And I can at least place the defenders by randomisation, synchronised with the orders. Not perfect, and a bit of a fudge, but ok.
Ripcord Posted June 17, 2011 Posted June 17, 2011 Makes perfect sense to me. Maybe place a little additional activity at the FARPs you are tasking, say some ground troops, trucks, etc., to further illustrate the activity/defense associated with those FARPs in use. [sIGPIC][/sIGPIC]
Recommended Posts