Jump to content

Hardcard

Members
  • Posts

    1080
  • Joined

  • Last visited

Everything posted by Hardcard

  1. @Everyone Hi there people! Looks like I'll need volunteers to make SWAPR work with the Stennis, right now I can only test helicopters on it (since I don't own the tomcat, harrier or hornet modules). Tomcat, harrier and hornet module owners interested in getting SWAPR to work with the Stennis, please contact me via PM :thumbup:
  2. Just click on my nickname and you'll see the option to send PM (second one)
  3. Well, I took that directly from a mission file, if it doesn't work, perhaps there's some kind of conflict going on (or missing data). Can you post the exact code you're using in your tests?
  4. This is a more complete table for 'ActivateBeacon': local Activate_TACAN = { ["id"] = "ActivateBeacon", ["params"] = { ["type"] = 4, ["AA"] = true, [color="blue"]-- No idea of what it does, probably not required[/color] ["callsign"] = "TKR", ["modeChannel"] = "X", [color="blue"] -- Maybe this is what you're looking for?[/color] ["channel"] = 1, [color="blue"] -- Maybe you're looking for this as well?[/color] ["system"] = 4, ["unitId"] = 1, [color="Blue"]-- Probably not required?[/color] ["bearing"] = true, ["frequency"] = 1088000000, } }
  5. @hancerPL I'm glad the script runs fine. As for making it work with 3 randomly selected bomber groups, it's quite simple to set up. Just need to copy-paste the Bomber_Spawn declaration a couple of times, change the bomber group names and declare the number of planes in each of them. Then create a table containing the 3 bomber group declarations / variables and use a randomizer to select them for spawning when the clients give the command. Like this (required values marked in red): local Bomber_1_Spawn = SPAWN:New("[color="Red"]Name of the first bomber group in ME[/color]") :InitLimit([color="red"]number of planes in the first group[/color] , 100) :OnSpawnGroup( function(BomberGroup) BomberGroup:HandleEvent(EVENTS.Dead) function BomberGroup:OnEventDead(EventData) if BomberGroup:IsAlive() == nil then local ClientSET_Ded = SET_CLIENT:New():FilterActive(Active):FilterOnce() for i , Client in pairs( ClientSET_Ded:GetSetObjects() ) do local TypeName_Ded = Client:GetTypeName() local Coalition_Ded = Client:GetCoalition() local Group_Ded = Client:GetGroup() if TypeName_Ded == "F-14B" or TypeName_Ded == "FA-18C_hornet" or TypeName_Ded == "M-2000C" then if Coalition_Ded == coalition.side.BLUE then MESSAGE:New("Bombers have been destroyed, stand down",10):ToGroup(Group_Ded) end end end end end BomberGroup:HandleEvent(EVENTS.EngineShutdown) function BomberGroup:OnEventEngineShutdown(EventData) local InitiatorUnit = EventData.IniUnit local InitiatorGroup = EventData.IniGroup local InitiatorVelocity = InitiatorUnit:GetVelocityKMH() if InitiatorGroup == BomberGroup and InitiatorVelocity == 0 then InitiatorUnit:Destroy(true) end end end ) local Bomber_2_Spawn = SPAWN:New("[color="red"]Name of the second bomber group in ME[/color]") :InitLimit([color="red"]number of planes in the second group[/color] , 100) :OnSpawnGroup( function(BomberGroup) BomberGroup:HandleEvent(EVENTS.Dead) function BomberGroup:OnEventDead(EventData) if BomberGroup:IsAlive() == nil then local ClientSET_Ded = SET_CLIENT:New():FilterActive(Active):FilterOnce() for i , Client in pairs( ClientSET_Ded:GetSetObjects() ) do local TypeName_Ded = Client:GetTypeName() local Coalition_Ded = Client:GetCoalition() local Group_Ded = Client:GetGroup() if TypeName_Ded == "F-14B" or TypeName_Ded == "FA-18C_hornet" or TypeName_Ded == "M-2000C" then if Coalition_Ded == coalition.side.BLUE then MESSAGE:New("Bombers have been destroyed, stand down",10):ToGroup(Group_Ded) end end end end end BomberGroup:HandleEvent(EVENTS.EngineShutdown) function BomberGroup:OnEventEngineShutdown(EventData) local InitiatorUnit = EventData.IniUnit local InitiatorGroup = EventData.IniGroup local InitiatorVelocity = InitiatorUnit:GetVelocityKMH() if InitiatorGroup == BomberGroup and InitiatorVelocity == 0 then InitiatorUnit:Destroy(true) end end end ) local Bomber_3_Spawn = SPAWN:New("[color="red"]Name of the third bomber group in ME[/color]") :InitLimit([color="red"]number of planes in the third group[/color] , 100) :OnSpawnGroup( function(BomberGroup) BomberGroup:HandleEvent(EVENTS.Dead) function BomberGroup:OnEventDead(EventData) if BomberGroup:IsAlive() == nil then local ClientSET_Ded = SET_CLIENT:New():FilterActive(Active):FilterOnce() for i , Client in pairs( ClientSET_Ded:GetSetObjects() ) do local TypeName_Ded = Client:GetTypeName() local Coalition_Ded = Client:GetCoalition() local Group_Ded = Client:GetGroup() if TypeName_Ded == "F-14B" or TypeName_Ded == "FA-18C_hornet" or TypeName_Ded == "M-2000C" then if Coalition_Ded == coalition.side.BLUE then MESSAGE:New("Bombers have been destroyed, stand down",10):ToGroup(Group_Ded) end end end end end BomberGroup:HandleEvent(EVENTS.EngineShutdown) function BomberGroup:OnEventEngineShutdown(EventData) local InitiatorUnit = EventData.IniUnit local InitiatorGroup = EventData.IniGroup local InitiatorVelocity = InitiatorUnit:GetVelocityKMH() if InitiatorGroup == BomberGroup and InitiatorVelocity == 0 then InitiatorUnit:Destroy(true) end end end ) local Bomber_Spawn_Table = { Bomber_1_Spawn , Bomber_2_Spawn , Bomber_3_Spawn } [color="blue"]-- This table contains the three bomber group declarations / variables that we've written above[/color] local function InterceptionStart(Group) Interception = "Accepted" Bomber_Spawn_Table[math.random(1,3)]:Spawn() [color="Blue"]-- This will randomly select one of the bomber group variables from the table above and spawn the defined bomber group within it[/color] BomberStrike_Root:Remove() end local function BomberStrikeRemove() if Interception ~= "Accepted" then BomberStrike_Root:Remove() end end SCHEDULER:New( nil, function() local ClientSET = SET_CLIENT:New():FilterActive(Active):FilterOnce() for i , Client in pairs( ClientSET:GetSetObjects() ) do local TypeName = Client:GetTypeName() local Altitude = Client:GetAltitude() local Coalition = Client:GetCoalition() local Group = Client:GetGroup() if TypeName == "F-14B" or TypeName == "FA-18C_hornet" or TypeName == "M-2000C" then if Altitude > 1500 and Coalition == coalition.side.BLUE then -- if MenuTop_2_Status == "Disabled" and JTAC_1_Status == "Disabled" and JTAC_2_Status == "Disabled" and JTAC_3_Status == "Disabled" and JTAC_4_Status == "Disabled" then MESSAGE:New("WARNING !!!\nHostile bombers flying towards our airport\n\n***Bomber Interception menu created***",10):ToGroup(Group) BomberStrike_Root = MENU_GROUP:New( Group, "Bomber Interception" ) BomberStrike_Accept = MENU_GROUP_COMMAND:New( Group, "Confirm!", BomberStrike_Root, InterceptionStart, Group) timer.scheduleFunction(BomberStrikeRemove, nil , timer.getTime() + 300) end end end end, {}, 1, math.random(1800, 14400) )
  6. @Paco I wouldn't set carrier speed above 15 knots if I were you, DCS doesn't like it when carriers speed up... carrier-based units start falling off the deck when that happens.
  7. @Snapper Execution delay is probably causing the replacement unit to not be removed in time, so your client immediately collides with it and blows up on spawn. The current plug & play version won't solve that issue, since it doesn't apply offsets to planes in airbases. Lucky for you, I think I've just discovered a way to dispense with all offsets and avoid such spawn collisions for good... I'll be releasing a new version soon. Also, the upcoming SWAPR version will probably support carrier-based replacements for the Kuznetsov and the Vinson (Stennis is a bit of a nightmare, but I might pull it off yet :thumbup:... Tarawa is a no go)
  8. I guess you could set up a trigger at Fence in and another at Fence out, using DO SCRIPT or DO SCRIPT FILE action to run the script each time (the latter option requires that you save the script as a .lua file, ofc). You must replace the field marked in red with the EXACT pilot name the aircraft is using in Mission Editor. In other words, the two values must be identical (I recommend the ctrl + c / ctrl + v method for this)
  9. Awesome :thumbup: Yes, that's the real downside of SWAPR... you would experience pretty much the same performance hit if the plane replacements were statics instead of uncontrolled AI. The good news is that you're now able to replace sheltered clients as well (with their loadouts and all, which is pretty sick ;) ) Oopsie, that was an oversight on my part, let me fix it real quick ;) EDIT: The issue should be corrected now (new SWAPR script uploaded), keep in mind that it'll only work for replacement planes located in airbases. Helicopter and plane replacements outside airbases won't be hidden. I mean... I guess I could get rid of static replacements altogether and use uncontrolled AI replacements exclusively (so they would also "inherit" loadouts and settings like "hidden")... might end up doing that in the future, we'll see.
  10. I'd be surprised to see that issue resurface with the plug & play version... but, please, keep me posted! Reference tables are automatically generated and accessed now, no dumps on dcs.log required... so it should work fine? (fingers crossed) As for your parking spot block suggestion, I'll need to discuss it with the scripting gurus, see if we can pull it off. Like I said, I'll keep improving this script until it does pretty much everything a user would want. :thumbup:
  11. The old version required quite a bit of work to set up (dump + edit reference tables, etc.), didn't support sheltered clients, it caused problems when switching between FARP clients and didn't allow users to customize offsets (in bulk) This new version still has some limitations, like not supporting multiple-client groups...but I'm working on it! Trust me, you'll be happier with this one!
  12. @Everyone New SWAPR(Plug&Play) version + tutorial video released (main post updated), you'll love it! :thumbup:
  13. Sounds like an execution delay problem then... those statics are likely being removed a tad too late, so your clients are being damaged (the helo statics are still being removed in MP, right?) If you run the demo mission on a dedicated server, I guess I could connect and try it out, see if I can reproduce the issue ;)
  14. @wolf5 This is pretty weird, I performed tests on Mineralnye Vody this morning and everything worked fine I've tested the mission you attached, it also works without issues in SP If you test it in SP, do you still experience those problems? Also, are you entering spectators before joining a coalition? It's a requirement for the script to work... if you spawn directly after joining, the birth event won't trigger, so the statics won't be cleared when you spawn
  15. Bamse is referring to Senaki and Kutaisi parking spots, many of them are sheltered (even though this can't be appreciated in the F10 / ME map). Aside from SWAPR, I'm also working on a little parallel project... basically, I'm creating reference parking spot data for all airbases in the game (I'm almost finished with all Caucasus airbases). The problematic parking spots Bamse is referring to can be seen in the following pics (all the TERM_TYPE 68 spots are sheltered, so the current version of SWAPR will ignore them) : Yes, it'll be pretty cool, but I need to get it working first :thumbup:
  16. @Florence201 Here's the script I mentioned, it should do the trick (the only required field is marked in red, don't remove the quotation marks): local function GetFuelWeight(Pilot_Name) if Unit.getByName(Pilot_Name) then local DCS_Unit = Unit.getByName(Pilot_Name) local Aircraft_Type = DCS_Unit:getDesc().typeName local Aircraft_Max_Internal_Fuel = DCS_Unit:getDesc().fuelMassMax local Fuel_Multiplier = DCS_Unit:getFuel() local Fuel_Kg = math.floor( Aircraft_Max_Internal_Fuel * Fuel_Multiplier + 0.5) local Fuel_Lbs = math.floor( Fuel_Kg * 2.2046 + 0.5) return Pilot_Name, Aircraft_Type, Fuel_Kg, Fuel_Lbs elseif Unit.getByName(Pilot_Name) == nil then trigger.action.outText(Pilot_Name.." couldn't be found!",10) end end local Pilot_Name, Aircraft_Type, Fuel_Kg , Fuel_Lbs = GetFuelWeight("[color="Red"]PILOT name of the aircraft in ME[/color]") [color="Blue"]-- This variable contains 4 different values from the referenced aircraft: Pilot_Name, Aircraft_Type, Fuel_Kg and Fuel_Lbs. Use them at your discretion[/color] trigger.action.outText("*** "..Pilot_Name.." - "..Aircraft_Type.." ***".."\nRemaining Fuel (Kg) = "..Fuel_Kg.."\nRemaining Fuel (lbs) = "..Fuel_Lbs, 10) It should work with all aircraft in DCS (flyable or not) :thumbup: Keep in mind that you'll need to include the variable in a scheduler if you need to get updated fuel readings periodically. For instance, you could add this at the end of the script: Loop = 1 local function Scheduler(Loop , time) local Pilot_Name, Aircraft_Type, Fuel_Kg , Fuel_Lbs = GetFuelWeight("[color="Red"]PILOT name of the aircraft in ME[/color]") trigger.action.outText("*** "..Pilot_Name.." - "..Aircraft_Type.." ***".."\nRemaining Fuel (Kg) = "..Fuel_Kg.."\nRemaining Fuel (lbs) = "..Fuel_Lbs, 10) if Loop == 1 then return time + 1 end end timer.scheduleFunction(Scheduler, Loop , timer.getTime() + 1)
  17. @Florence201 I'll post a script I wrote a few days ago, it basically does the same as johnv2pt0's snippet...but for all flyable aircraft currently available in DCS (it provides the values in both lbs an kg and rounds them up as well) :thumbup: johnv2pt0 You don't need to use MIST or MOOSE in order to round up values. In this particular case, since we're only interested in integer values, we can simply use the following: math.floor( [i][color="Red"]number you want to round up [/color][/i]+ 0.5 )
  18. Like I said, if you do this... trigger.action.setUserFlag( "2", true ) flag 2 isn't set to true, but to 1 So, if you then check it using... if trigger.misc.getUserFlag( "2" ) == true then I wouldn't expect that condition to be met... however, the following should work if trigger.misc.getUserFlag( "2" ) == 1 then
  19. Yup, looks like the flag parameter also accepts numbers... this is weird, I seem to recall it didn't accept numbers before, only strings. Anyway, the conclusion is the same: true = 1 false = 0
  20. @wolf5 Interesting... are the helos falling from an altitude or do they simply spawn broken? Also, I'll need you to specify the map, the airbase and the parking spot number(s) (I'm assuming this doesn't happen with helos placed on other airbases, right?) Btw, you can just PM me the mission file (as long as it's not based on the Normandy map)
  21. Set the AttackMapObject trigger in ME as you would normally do, then save the mission. After that, open the generated .miz file with winRAR/WinZip/7zip, etc. Inside you'll see a file called "mission" (with no format), you need to extract that file and give it a .lua format. Then you'll be able to open it using notepad++, for instance. That file contains all the information regarding templates and triggers in the mission, so find the AttackMapObject task id inside it and you'll see how the task table is really structured. You can use this method to figure out how ALL task and unit / group / static template tables in ME are structured, so remember it
  22. I just felt like sharing my findings, that's all, it wasn't a personal attack to anybody ;) But yes, that's essentially what I wanted to say, don't think in terms of true or false, think in terms of 1 and 0 As for your snippet, it looks fine, except for the flag number in the second line: trigger.action.setUserFlag("1", 1); trigger.action.setUserFlag([color="Red"]2[/color], true); trigger.action.setUserFlag("3", true); trigger.action.setUserFlag('4', 1); I sincerely doubt flag 2 is being set to 1 by that particular trigger in line 2, since the flag parameter needs to be a string, not a number. You don't have to take my word for it, just check the Hoggit Wiki: https://wiki.hoggitworld.com/view/DCS_func_setUserFlag As it's written in the snippet, the second trigger shouldn't be working... Test it again, are you sure that flag 2 isn't being set to 1 by some other trigger in ME? As for the rest of triggers in the snippet, they all set their respective flags to 1, so they shouldn't cause problems.
  23. @Anyone interested Just letting you know that I think I've found a way to skip the Reference_Table builder step altogether. If things go as expected I'll be uploading a new version of SWAPR, which won't require users to generate the Reference_Table and dump it in dcs.log (it won't require switching clients to AI either) Also I think I can make it work with shelter-based clients as well (no more spawning on shelter roofs). What's even cooler, I'll try the new method with carrier-based aircraft as well, with a bit of luck, I might pull it off :thumbup: Thanks to Funkyfranky and Nolove for their guidance and tips :thumbup:
  24. When you do... trigger.action.setUserFlag( '100', true ) what's actually happening is that flag 100 is set to 1, so the following condition won't be met: if trigger.misc.getUserFlag( '100' ) == true then When you do... trigger.action.setUserFlag( '100', false ) what's actually happening is that flag 100 is set to 0, so the following condition won't be met: if trigger.misc.getUserFlag( '100' ) == false then Looks like boolean just sets the flag to either 1 or 0, it does have a function (albeit, not the one people would assume)
  25. What zone? There aren't any zones in the script above :huh:
×
×
  • Create New...