Jump to content

PravusJSB

ED Closed Beta Testers Team
  • Posts

    324
  • Joined

  • Last visited

Everything posted by PravusJSB

  1. Try a continuous repetitive trigger, should fix it I think.
  2. Perhaps the task is failing because you're on the ground when you ask them to escort? Try when you're in a hold over the airfield or get them to start-up and take-off and hold pattern as a default mode so tasking them via F10 is faster / easier.
  3. Tables are easy and fundamental to Lua, there are 2 types and 1 modifier (metatables): Array, Unordered Map (key, value). Key things to note are; 'pairs' will iterate over a key, value table or an array using the index as a key instead of a string, and pairs does not guarantee any order of return. 'ipairs' will do the same as above but cannot be used on a key, value table (i think) or at least it will break on a string key (again i think), pairs does not hold a ref to the current position of the place in the loop whereas 'ipairs' does. arrays are sets of objects with indexing as a reference and each element is contiguous, and will break if the index's are not so or any position in the array is 'nil', likewise you cannot remove an element in an array by '= nil' whilst looping over it like you can with a key, value table and shouldn't as a rule at all, always remove with 'table.remove' outside of a loop. Key, value tables are very fast, and arrays are orders of magnitude faster. (performance) Both have their strengths and limitations and both are powerful, and then there are metatables, which make Lua as powerful as it is used in the correct way.
  4. Yea sure, read up on the tasking scripting API, and there's also a big aerobatics task set. Then to implement into F10 you'd need to think about how to structure for control and then insert commands that execute tasks and push them to given AI (missionCommands is the module to use to add F10/Other menu's and commands).
  5. I just traced the dialogs/lua modules/global functions & classes in mission state, had a look at the constructors and setters, to get an idea if there's an answer to your question.... It seems like its a legacy feature long since forgotten with no functionality aside from pre-setting goals and win conditions and then there are some spinners for checking the score and actioning any pre-defined actions against said goal/trigger, and some integration into de-briefing etc. I'd suggest making your own implementation if you see value in the feature. EDIT: There is a possible hook onScoreUpdate, not sure if this relates to a change in 'player' score or in your case 'mission_score'. Theres also a place in the mission that might potentially hold runtime values (env.mission.result) maybe they're mutable?
  6. I could prob put together a binary that can support this if there's value in it for people.
  7. On your client side instance it will depend on your FPS, on a dedicated server its a fixed time, 0.0154 the last time i checked.
  8. It's a good idea too. I did find some issues getting certain frames set as clients to accept that dynamically though so testing across all use cases is a good idea.
  9. Hello there! Yes this is possible, i'll lay out the steps and research on Hoggit wiki for the methods and how to use them but, have the S2A sites disabled on start (use AI off and green ROE), then set up a trigger/monitor for your player and watch for violation of your rules, either tie into existing event triggers, custom ones or make a specific loop to watch client aircraft, any S2A sites in range that can prosecute your penalty have the AI now turned on, use knowTarget methods or similar then use the tasking system to clear tasks and to specifically set the S2A site to target and fire upon the perp. using the attackUnit methods, then when the task is done, disable the site again until you need it again.
  10. Can you post a representative log file and a bit more info please?
  11. Just a thought for you to consider on allowing the os library access but keeping security the way I do it. -- localise all risky functions so no code but inside this scope can access local null_fun = function() _log("Security alerts can go here") return end local os_execute = os.execute os.execute = null_fun local os_remove = os.remove os.remove = null_fun local os_open_uri = os.open_uri os.open_uri = null_fun local os_run_process = os.run_process os.run_process = null_fun -- -- Provide global API of my naming, so only I would know... as an array (no keys) so only I would know the index of which func. API_FUNCS = { os_execute, -- call like this API_FUNCS[1](...) } -- -- module security here... remove the library if you want to aswell os.getenv = nil os.difftime = nil os.run_process = nil os.remove = nil os.execute = nil os.open_uri = nil os.rename = nil os.getpid = nil console = nil -- I wrote that for you its not a copy/paste so hopefully get the jist, it should work but there may be typos or errors... I will be providing a 24/7 support line if you need it, please deposit your bank details in my DMs
  12. You could also add a doscript IF/Trigger by pasting the following code, I think you can set to continuous to have it fire true although I'm not 100% sure on the ME implementation or how you would set it up but the code is pretty simple; if math.random() > 0.95 then -- return a random value between 0 and 1 and evaluate on % chance, here this is a 5% chance to fire -- do something or enable an action end -- you can also supply 1 single argument and that will be the max time, or specifically min & max time in seconds by giving it 2 args local your_min_time, your_max_time = 1, 10 if timer.getTime() > your_min_time and (timer.getTime() > your_max_time or (timer.getTime() < your_max_time and math.random() > 0.95 )) then -- do things end -- again I don't know how the ME lets you chain this together or when you want to evaluate but maybe this to makle it more flexible; local function time_delay(chance, your_min_time, your_max_time) local time_now = timer.getTime() -- call this when you want to return a random delay and you can do it in a number of ways, all args are optional -- add this function one time in a seperate bit of doscript on mission start then you can use like below... return (time_now > (your_min_time or 0)) and ((your_max_time and time_now > your_max_time) or (time_now < (your_max_time or 86890) and (math.random() > (chance or 0.001)))) -- returns true or false based on args supplied end -- call like this... if time_delay(0.5, 10, 100) then -- or time_delay(0.5) if you only want chance, or time_delay(0.5, 50) for 50% chance after 50 secs... or less than 50 secs.. time_delay(0.5, nil, 50) -- do stuff end .... I got carried away there I wrote that off the cuff so there may be typo errors, but im sure youll find them.
  13. the getCallsign method works on the unit object but I dont know of a way to get the radios info in Lua without storing yourself on creation. If you write a small spawn class as a wrapper it should make life easy for you.
  14. Here's an implementation for random seed, enjoy. (There are 3 bonus table library methods included too); -- UTILS -- random local MBIG = 2147483647 local MSEED = 161803398 local MZ = 0 local FAC = (1.0/MBIG) local inext = 0 local inextp = 31 local ma = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} local function math_randomseed(idum) local mj = MSEED - math.abs(idum) mj = mj % MBIG ma[55] = mj local mk = 1 for i = 1,54 do local ii = (21*i)%55 ma[ii] = mk mk = mj - mk if mk < MZ then mk = mk + MBIG end mj = ma[ii] end for k = 1,4 do for i = 1,55 do ma[i] = ma[i] - ma[1+(i+30)%55] if ma[i] < MZ then ma[i] = ma[i] + MBIG end end end inext = 0 inextp = 31 end local function math_random(...) local arg, tmp = {...}, 0 local mini = (not arg[2] and arg[1]) and arg[1] or (arg[1] and arg[2]) and arg[1] or 0 local maxi = (not arg[2] and arg[1]) and 1 or (arg[21] and arg[2]) and arg[2] or 0 if (mini > maxi) then tmp, maxi, mini = maxi, mini, tmp end inext = inext == 56 and 1 or inext+1 inextp = inextp == 56 and 1 or inextp+1 local mj = ma[inext] - ma[inextp] if mj < MZ then mj = mj + MBIG end ma[inext] = mj local f = mj * FAC; local range = 1+maxi-mini; return math.floor((f * range) + mini); end -- table.keys = function(t) local keys = {} local fmt = string.format for k in pairs (t or {}) do keys[#keys+1] = fmt("%s : (%s)\n",k,type(t[k])) end return table.concat(keys) end table.empty = function(t) local keys = 0 for k in pairs (t or {}) do if keys > 0 then break end keys = keys + 1 end return keys == 0 end table.count = function(t) local keys = 0 for k in pairs (t or {}) do keys = keys + 1 end return keys end -- I would prime the random function after seeding it and use as follows; math_randomseed() math_randomseed(os.time()) for j = 1,100 do math_random(3,20000) end for i = 1,2500 do math_random() end
  15. Well sir, this is a community and I have the privilege to do so and indeed have done. Put your feet up.
  16. Confirmed that this is something that needs to be looked into, I'll post it in the beta forums for you @Elphaba
  17. All items still for sale, willing to split up.
  18. -- I thought there was an event.place object (Airbase) if not you could... local c_pos = event and event.initiator and event.initiator:getPlayerName() and event.initiator:getPosition() or nil local n_base = c_pos and c_pos.p and Airbase.getNearset(c_pos.p) or nil local b_name = n_base and n_base:getName() or nil
  19. This is possible with scripting fairly easily. Drop me a DM if you need some pointers.
  20. 'gui' should be lower-case, but it's incorrect that this is the lua_State for Hooks, it's not, but I bet you can't guess
×
×
  • Create New...