Jump to content

OneFatBird

Members
  • Posts

    73
  • Joined

  • Last visited

Everything posted by OneFatBird

  1. Been a while since I looked at DCS at all, but read rumors somewhere on some random browsing about the Apache module becoming available. If Jane's Longbow did not bring any skills, DI's 1986 Tomahawk on the Spectrum (the first simulator I ever played) will bring even less! I am going to have to rekindle my interest in DCS just to try this one out for old time's / nostalgia's sake. Thanks for the motivating impressions.
  2. Not that I think I'll have the time to participate (much as I'd like to), but a quick question, just the same, in case... What, if any, are the limitations on using scripts? As much custom made ones by the designer, or those made by others and in the library on the forum?
  3. All solved now, thanks. No, it wasn't that. I'd learned that lesson in a previous experience on the site, but thank you just the same! :)
  4. Excellent. Thank you, that was exactly what I needed to know. :thumbup: PS: And, with mixed results. Yes, the guy started moving. No, he did not go where he was supposed to, but turned a clear 90º to the right of the intended advance and ran forever. I don't know, this path business is one of the hardest aspects of the scripting to get to grips with. It makes no sense. I'll keep playing with it...
  5. Sorry, once again, I'm not finding anything helpful regarding making custom group paths in DCS scripting. I'm getting very unexpected results from my experiments trying to fathom it out, so I am throwing in the towel with taxing myself, and hoping someone can please shed some light on this... Here's an example of what I mean... SOLDIER_GROUP = { ["visible"] = false, ["route"] = { ["spans"] = { [1] = { [1] = { ["y"] = 40000, ["x"] = 40010, }, [2] = { ["y"] = 40010, ["x"] = 40020, }, }, }, ["points"] = { [1] = { ["alt"] = 0, ["type"] = "Turning Point", ["ETA"] = 0, ["alt_type"] = "BARO", ["formation_template"] = "", ["y"] = 40000, ["x"] = 40010, ["name"] = "DictKey_WptName_7", ["ETA_locked"] = false, ["speed"] = 5, ["action"] = "Off Road", ["task"] = { ["id"] = "ComboTask", ["params"] = { ["tasks"] = { }, }, }, ["speed_locked"] = true, }, [2] = { ["alt"] = 0, ["type"] = "Turning Point", ["ETA"] = 0, ["alt_type"] = "BARO", ["formation_template"] = "", ["y"] = 40010, ["x"] = 40020, ["name"] = "DictKey_WptName_8", ["ETA_locked"] = false, ["speed"] = 5, ["action"] = "Off Road", ["task"] = { ["id"] = "ComboTask", ["params"] = { ["tasks"] = { }, }, }, ["speed_locked"] = true, }, }, }, ["groupId"] = 102, ["name"] = "Soldier Group 102", ["tasks"] = {}, ["hidden"] = false, ["units"] = { [1] = { ["x"] = 40000, ["y"] = 40000, ["type"] = "Soldier M4", ["name"] = "Soldier_101", ["unitId"] = 101, ["heading"] = 0, ["playerCanDrive"] = false, ["skill"] = "Excellent", }, }, ["task"] = "Ground Nothing", } Now, as the method is someone else's brainchild, I must ask. 1. What are SPANS, and their purpose? 2. What are POINTS, and their purpose? Knowing at least that might help me figure the rest out. I kind pof imagine that POINTS are the locations where you want to send the group, in map coordinates from origin, but SPANS has me defeated. Why two parameters? Also, what's this? "DictKey_WptName_7" ...and where can I find out more about it? Thanks in advance!
  6. :) Regarding skill, yes; I do want those RPG guys to actually hit something before they get mowed down by some coax. Thank you. I was beginning to get that idea, but you've put it better words than I would have done, for sure.
  7. That was it, thank you so much! For some reason I thought ONCE would only do the script once for the whole game (ie, only ever deploy one soldier in the entire game), and didn't think of trying it. It now deploys one soldier every time I land the Huey, and I have learned the final key to getting the event handler to work.
  8. Hello. As usual, apologies if this has been covered before somewhere else; search didn't give any clues... This picture... ...is the result of using this event_handler script on one landing... local Event_Handler = {} function Event_Handler:onEvent(Event) if Event.id == world.event.S_EVENT_LAND then if Event.initiator then local Init_Name = Event.initiator:getName() if Init_Name == "BHGP-01" then if Event.place == nil then local helo_pos = Event.initiator:getPosition().p RPG_MAN_SPAWN = { ["visible"] = false, ["groupId"] = math.random(999), ["name"] = string.format("RPG_" .. math.random(10, 10000)), ["hidden"] = false, ["units"] = { [1] = { ["type"] = "Soldier RPG", ["name"] = string.format("RPG_U_" .. math.random(10,10000)), ["unitId"] = math.random(10,10000), ["heading"] = 0, ["playerCanDrive"] = false, ["skill"] = "Excellent", ["x"] = helo_pos.x + (math.random(40) - 20), ["y"] = helo_pos.z + (math.random(40) - 20), }, }, } end coalition.addGroup(country.id.USA, Group.Category.GROUND, RPG_MAN_SPAWN) end else trigger.action.outText(_Name .. " landed at " .. Event.place:getName(), 10) end end end world.addEventHandler(Event_Handler) Basically, a single landing is generating a number of landing events for this UH-1, and spawning an RPG man for each of them. Now, there is a work around if I use flags for the spawning action, but the questions remain... 1. Is this right? Why are there multiple landing events registered? Is it normal? 2. What is the correct way to go about preventing this issue? Thanks in advance! PS: For info, I am triggering this off a Continuous Action, because I do not seem to get it to work off a Switched Action condition. However, I am wondering if I am not on the right track in considering the way it is invoked.
  9. Noticed it just now, so just reminding it is still present. Same thing on the SU-25A. Confusing, thought I was suffering from Gerstmann's syndrome for a moment.
  10. Huh! What happens while a back is turned, LOL! I'm sorry that I - or the content of the thread - was misinterpreted. Makes me feel guilty for starting a contratom. Indeed, questions have been answered to a level of satisfaction; my thanks for that. Known to be the best way to expand your knowledge; start teaching as soon as you have a functional grasp on a subject, provided you have the benefit of time to research and then reply. I know that from experience in another field. In any case, I am now well away with beginning to write my own scripts; the "click" has finally manifested itself, alas. I'll just bother you generous people - to whom I'm grateful - when I get really, really, REALLY stuck with something, as from now.
  11. I must clarify, first, what is wrong with my reasoning, and I recognize it is wrong. I'm trying to force a new language (for me) to do things that I am familiar with from another language. I should know better, having been a reasonably talented C/C++ coder on the verge of a decade ago. Here's a link to what I was referring to. See how you can use either the equality or the assignment operators for true false evaluation? The advantage was, if it proved true, it also retained the value obtained from the operation (or API procedure, whatever the case was) for use in the rest of the if statement. Lua does not do it, it seems, so I find a walk around, and that turns out to be the correct way for Lua. By that I mean, yes, I have solved my issue. Here's a snippet; _apc_names = {"APC_U_1", "APC_U_2", "APC_U_3" ...and so on... } for _i, _gp in pairs(_apc_names) do _apc = Unit.getByName(_gp) if _apc ~= nil then _apcPos = _apc:getPosition().p -- handling code, and such... end end Works great now. Yeah, well. Symptom of the times. We can't even buy a phone now with a half decent instruction manual included, as it appears modern human kind learns by osmosis, or something, LOL! Just have to get used to that. :P These are true words of wisdom. Thanks. Again, sorry I'm slow nowadays.
  12. Yes, I do know that. It is the same in C. Sorry you're not understanding what I am really asking. And yes, I am constantly referring to the Lua, MiST and DCS Scripting Documentation (the last of these which is very, very hard to digest, I will add). In any case, I do not learn as well as I used to because I'm old now. Apologies for that too, sir, though there's not much I can do about it. I won't bug you anymore. I was just doing it as a hobby, but I can clearly see I'm irking you all. Respects. All the best!
  13. I don't know. This language defeats me again and again. It looks like a hybrid of BASIC and C, but behaves like neither. From my days of C++, you could evaluate an "if" TRUE or FALSE statement implicitly by an expression, roughly like this, for example... if (apc.getByName(_grp)) // if it got something, it was true, otherwise false. I'm trying to do that, but nothing works. Here... _apc_names = {"APC_U_1", "APC_U_2", "APC_U_3", "APC_U_4", "APC_U_5", "APC_U_6", "APC_U_7", "APC_U_8", } -- These are units I have made in the ME. Some might already be dead during runtime. I want dead ones to evaluate false, live ones true. for _i, _gp in pairs(_apc_names) do if _apc = Unit.getByName(_gp) then -- if (_apc = Unit.getByName(_gp)) then _apcPos = _apc:getPosition().p -- etcetera end No matter what I do, it throws errors at that evaluation of the expression point. How's it done, please?
  14. Ah, OK, I see. Bit like the Lua version of the this pointer in C++. Here was I thinking it was a specific "hook point" of the DCS scripting engine. Sorry.
  15. OK, everything good. There is however one thing that is really bugging me. What is the SELF class? There is no description of it that I can find in the documentation I'm looking at, and there are a ton of useful commands and functions that are hindered only by the fact that SELF is the argument. Is it the player? Is it the unit that you have "got" by whatever means? Can it be either, or both? I cannot get it to work... Sorry for so much bother with this.
  16. NP. Now, a very simple thing (for those who know, that is). How do I reference, inside a script function, a flag that I have created in ME? Let's say I have "FLAG 35", and I want a script code that sorts through flags and finds that particualr flag. I'll do this as pseudo-code (I am assuming FLAGS are global here - I'm not getting much from the documentation, yet again); function _sort_through_flags() local i for i = 0 to 100 step 1 if flags[i].id == 35 break end if end if i == 100 return else flags[i + 1].value = flags[i + 1].value - 1 end if return end You see what I'm doing? I want to "find" flag 35, then decrease the value of flag 36 by 1. Of course, this is just an example of what I might want to do. the crux of the matter is how I locate (index) flags. I've seen some funny things inside the ME mission file, and tried to use that format, but it does not seem to work.
  17. Ah! So the vectors matrix's z is the map coords y axis. Awesome, I was missing that completely, thanks. I'm on a double front battle here, converting to Lua from C/C++ and getting to grips with the DCS script engine's syntax. You don't know how much all your comments and help are appreciated... :thumbup: ...or how joyful I was when this little posse came into existence...
  18. I cannot get the simplest thing to work. Sorry. I am trying to do this from scratch, because I am not getting anything from looking at example scripts, and the documentation is not exactly clear on a lot of things... local apc = Group.getByName('apc'):getUnit(1) coalition.addGroup(country.id.USA, Group.Category.GROUND, { ["visible"] = false, ["hidden"] = false, ["units"] = { [1] = { ["type"] = "Infantry M4", ["name"] = "New UNIT", ["unitId"] = 1, ["heading"] = 0, ["playerCanDrive"] = false, ["skill"] = "Excellent", ["x"] = apc:getPosition().x, ["y"] = apc:getPosition().y } } } ) Can someone please say why this does not work to spawn an infantry unit at the position of the apc when I use the radio item?
  19. Okay, as simple as possible. What is going on here? Is this right? I am following what the manual suggests. Not working... -- dynadd example local apc = Group.getByName('apc'):getUnit(1) mist.dynAdd ( { vars.units= { [1]= { ['x'] = apc:getPosition().x, ['y'] = apc:getPosition().y, ['type'] = 'Infantry M4' } } ['country'] = 'USA', ['category'] = 'INFANTRY' } ) Thanks in advance... EDIT: Nope, it is pretty obvious to me now what I am missing. Before even touching MIST I need to get some hands on with the basic DCS Lua script engine. It is what you said earlier, Ian, thanks for the reference. Finding my way, seen the light!
  20. Nice! That all worked a treat and opens up my understanding of implementing Lua in DCS considerably. Eric here also covers some questions of mine that were going to appear regarding these DBs and Tables (though not related to witch-craft). I have a bit of time tomorrow to try and expand a bit more. I'll try on my own and only bug people if I get really stuck. Thanks!
  21. Sorry, before anything else, for possible redundancy in asking for this help. I have a funny way of learning and am short of the commodity of time to plough through dozens of threads hoping to find specific answers to my requirements. Please be patient. I need some assistance in getting started with scripting for DCS, and to that end, want to ask for some help with some basic stuff. I am conversant with programming languages (eg; C++), but need to get some hands on with interfacing LUA and MIST with DCS. Objective 1: Spawning units near another unit. For example, I would like to spawn RPG troops near an APC using the radio menu command. I understand that units can be spawned without them having been precreated in the ME, but how? And, once that's solved, how do I go about forcing them to spawn near a particular unit? I know I have more questions, but they will have ample opportunity to be addressed further along, and may even be solved in the process of resolving the above query, so I will not clog up this post anymore with text, save to say thanks in advance to anyone kind enough to assist.
  22. Worked great! For a while, then there was an update, and it won't work anymore, even with this fix. What's happening, please?
×
×
  • Create New...