Rescue Helo-Carrier Formation 24/7 - Page 6 - ED Forums
 


Notices

Reply
 
Thread Tools Display Modes
Old 11-20-2018, 10:46 PM   #51
Shadow.D.
Member
 
Join Date: Dec 2007
Location: United Kingdom
Posts: 322
Default

Quote:
That sounds very much like a DCS bug.
Figured as much, hmmm time to check all my other MOOSE spawned units.

Oh if only you could develop these scripts on a working base...
Shadow.D. is offline   Reply With Quote
Old 12-12-2018, 07:59 AM   #52
BlackLibrary
Member
 
BlackLibrary's Avatar
 
Join Date: May 2017
Location: Nbg, Franken (Ger)
Posts: 268
Default

i try to load the script twice.

copy script anr rename it to Helo Carrier_Formation77 and Helo Carrier_Formation74

change units name to CVN-77 & CVN-74 also Planeguard77 & Planeguard77

only the 77 script works.
is it posible to load it twice?
__________________

aka WarLord
DCS-FlighPanel-Profiles
DCS-BIOS
DCSFlightpanels
BlackLibrary is offline   Reply With Quote
Old 01-22-2019, 07:06 AM   #53
BoneDust
Member
 
BoneDust's Avatar
 
Join Date: Nov 2007
Location: NB, Canada
Posts: 847
Default

Have not been able to get this to work; mind you I'm new to this using scripts.

I've renamed the carrier and helo names in the script to what I have in ME. Is there something special that needs done in ME to the units? I have triggers Mission Start>>>Load MOOSE and MISSION Start Load Rescue Helo. Added a helo and set it to late activation; which is how I was told to do it.

The only thing that needs changed in the script is the carrier and helo names to match ME so what am I missing?
__________________


Spoiler:
Windows® 10 Home Premium | 64bit, Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz (Cores 6) (Logical/Core 2) | NVIDIA GeForce GTX 1080 Ti 11GB | 1 X 1TB SSD | 1 X 275GB SSD | Sound Blaster X-Fi Xtreme Audio sound card | 16GB Dual Channel DDR3 SDRAM at 1333MHz | Oculus Rift

Last edited by BoneDust; 01-22-2019 at 01:44 PM.
BoneDust is offline   Reply With Quote
Old 01-22-2019, 12:41 PM   #54
Hardcard
Member
 
Hardcard's Avatar
 
Join Date: May 2013
Posts: 316
Default

Quote:
Originally Posted by BoneDust View Post
what am I missing?
Post your mission and dcs.log, so people can take a look
Hardcard is offline   Reply With Quote
Old 01-22-2019, 02:08 PM   #55
BoneDust
Member
 
BoneDust's Avatar
 
Join Date: Nov 2007
Location: NB, Canada
Posts: 847
Default

I'll load mission later, but it is a simple test mission with the carrier and one helo.

I see this error in the log.

SCRIPTING: *** MOOSE INCLUDE END ***
2019-01-22 13:50:56.724 INFO SCRIPTING: Loading MOOSE Rescue Helo-Carrier Formation Script v1.1 by FF
2019-01-22 13:50:56.724 INFO SCRIPTING: Carrier Unit Name = the USS John C Stennis
2019-01-22 13:50:56.724 INFO SCRIPTING: Helo Group Name = SAR_Helo
2019-01-22 13:50:56.724 INFO SCRIPTING: Offset X (front) = 300.0 m
2019-01-22 13:50:56.724 INFO SCRIPTING: Offset Z (port) = 200.0 m
2019-01-22 13:50:56.724 INFO SCRIPTING: Offset Y (alt) = 80.0 m
2019-01-22 13:50:56.724 INFO SCRIPTING: Spawn in air = nil
2019-01-22 13:50:56.724 INFO SCRIPTING: Random Route = false
2019-01-22 13:50:56.724 ERROR DCS: Mission script error: : [string "C:\Users\dwigh\AppData\Local\Temp\DCS.openbeta\/~mis000018A4.lua"]:61: attempt to index local 'Mother' (a nil value)
stack traceback:
[C]: ?
[string "C:\Users\dwigh\AppData\Local\Temp\DCS.openbeta\/~mis000018A4.lua"]:61: in main chunk


EDIT:

I found the problem. Dumb error on my part. I had the ships name in the Group window rather than the unit window. Works great. No more late night mission building for me haha.

Cheers
__________________


Spoiler:
Windows® 10 Home Premium | 64bit, Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz (Cores 6) (Logical/Core 2) | NVIDIA GeForce GTX 1080 Ti 11GB | 1 X 1TB SSD | 1 X 275GB SSD | Sound Blaster X-Fi Xtreme Audio sound card | 16GB Dual Channel DDR3 SDRAM at 1333MHz | Oculus Rift

Last edited by BoneDust; 01-22-2019 at 10:19 PM.
BoneDust is offline   Reply With Quote
Old 01-22-2019, 07:09 PM   #56
BoneDust
Member
 
BoneDust's Avatar
 
Join Date: Nov 2007
Location: NB, Canada
Posts: 847
Default

It still does not respawn...still working on it. Here's the script. Eveything works well but the helo flies along the water partially submerged rather than land.

Any thoughts?

Code:
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
trigger.action.outText('Loading SAR_Helo_Respawn Script v1.0 by FF', 10)
-- Script is loading.
env.info("Loading MOOSE Rescue Helo-Carrier Formation Script v1.1 by FF")

-- v1.1: Made AI_FORMATION object global variable since garbage collector removed it.
--       Used new RespawnAtAirbase() function. Requires MOOSE version >= 2.4
--       Download Moose.lua at https://github.com/FlightControl-Master/MOOSE/releases

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Set parameters.

-- Carrier UNIT name as set in the ME. 
local CarrierUnitName="the USS John C Stennis"

-- Helo GROUP name as set in the ME.
local HeloGroupName="SAR_Helo"

-- Offset [meters] in the direction of travelling. Positive values are in front of Mother.
local OffsetX=270
-- Offset [meters] perpendicular to travelling. Positive = Starboard (right of Mother), negative = Port (left of Mother).
local OffsetZ=200
-- Offset altitude. Should (obviously) always be positve.
local OffsetY=80

-- If true, Carrier will randomly select waypoints from the ones defined in the ME.
local RandomRoute=false

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Scripting Part - no need to change anything below unless you know what you are doing.

-- Report mission time every 30 sec.
local ReportTime=false

-- Report fuel of helo group every 60 sec.
local ReportFuel=false

-- Display mission time.
if ReportTime then
  local Scheduler_Mission_Time = SCHEDULER:New(nil, UTILS.DisplayMissionTime, {}, 0, 30)
end

-- Debug info.
env.info(string.format("Carrier Unit Name = %s", CarrierUnitName))
env.info(string.format("Helo Group Name   = %s", HeloGroupName))
env.info(string.format("Offset X (front)  = %.1f m", OffsetX))
env.info(string.format("Offset Z (port)   = %.1f m", OffsetZ))
env.info(string.format("Offset Y (alt)    = %.1f m", OffsetY))
env.info(string.format("Spawn in air      = %s", tostring(SpawnInAir)))
env.info(string.format("Random Route      = %s", tostring(RandomRoute)))

-- Set takeoff type.
local Takeoff=SPAWN.Takeoff.Hot  -- Adjust this to SPAWN.Takeoff.Cold for a cold start, i.e. with engines off. 

-- Carrier "USS Stennis" = Mother. "USS Stennis" is the name of the unit of the carrier given to the carrier in the ME. 
local Mother=UNIT:FindByName(CarrierUnitName)

-- Carrier group will patrol the defined waypoints indefinetly.
if RandomRoute then
  Mother:PatrolRouteRandom(20)
else
  Mother:PatrolRoute()
end

-- Spawn helo.
local SpawnHelo=SPAWN:New(HeloGroupName)
local HeloSpawn=SpawnHelo:SpawnAtAirbase(AIRBASE:FindByName(CarrierUnitName), Takeoff, OffsetY)

-- Set of group(s) to follow Mother.
local FollowGroupSet = SET_GROUP:New()
FollowGroupSet:AddGroupsByName(HeloSpawn:GetName())

-- Define AI Formation object.
CarrierFormation = AI_FORMATION:New(Mother, FollowGroupSet, "Helo Formation with Carrier", "Follow Carrier at given parameters.")

-- Formation parameters.
CarrierFormation:FormationCenterWing(-OffsetX, 50, math.abs(OffsetY), 50, OffsetZ, 50)

-- Start formation FSM.
CarrierFormation:__Start(2)

-- Subscribe helo group set to the event land.
FollowGroupSet:HandleEvent(EVENTS.Land)

-- Respawn helo group once it landed because it was out of fuel.
function FollowGroupSet:OnEventLand(EventData)
  local group=EventData.IniGroup --Wrapper.Group#GROUP
  if group and group:GetName():match(HeloGroupName) then
    env.info(string.format("CarrierFormation: Respawning group %s.", group:GetName()))
    group:RespawnAtCurrentAirbase(nil, Takeoff)  -- MOOSE v2.4.X
  end
end

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

if ReportFuel then
  --- Report fuel function of following group.
  local function ReportFuel()
    for _,myhelo in pairs(FollowGroupSet:GetSet()) do
      if myhelo and myhelo:IsAlive() then
        local fuel=myhelo:GetFuel()
        local text=string.format("%s: fuel = %.2f %%", myhelo:GetName(), fuel*100)
        MESSAGE:New(text, 5):ToAll()
      end
    end
  end
  
  -- Report fuel state of helo every 10 seconds.
  local Scheduler_Helo_Fuel = SCHEDULER:New(nil, ReportFuel, {}, 60, 60)
end

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
__________________


Spoiler:
Windows® 10 Home Premium | 64bit, Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz (Cores 6) (Logical/Core 2) | NVIDIA GeForce GTX 1080 Ti 11GB | 1 X 1TB SSD | 1 X 275GB SSD | Sound Blaster X-Fi Xtreme Audio sound card | 16GB Dual Channel DDR3 SDRAM at 1333MHz | Oculus Rift

Last edited by BoneDust; 01-22-2019 at 07:14 PM.
BoneDust is offline   Reply With Quote
Old 01-23-2019, 07:35 AM   #57
BoneDust
Member
 
BoneDust's Avatar
 
Join Date: Nov 2007
Location: NB, Canada
Posts: 847
Default

What the helo appears to be doing is trying to land at the same spot it departed the ship from, but the ship of course is moving so it lands in the water where the ship was when it departed and flies along partially submerged; hence no respawning.

Any thoughts?
__________________


Spoiler:
Windows® 10 Home Premium | 64bit, Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz (Cores 6) (Logical/Core 2) | NVIDIA GeForce GTX 1080 Ti 11GB | 1 X 1TB SSD | 1 X 275GB SSD | Sound Blaster X-Fi Xtreme Audio sound card | 16GB Dual Channel DDR3 SDRAM at 1333MHz | Oculus Rift

Last edited by BoneDust; 01-23-2019 at 04:30 PM.
BoneDust is offline   Reply With Quote
Old 01-23-2019, 10:14 PM   #58
funkyfranky
Senior Member
 
funkyfranky's Avatar
 
Join Date: Sep 2015
Location: Asgård
Posts: 1,958
Default

Hi guys, and sorry for the late reply but I have not been lazy

The code has been enhanced with new features and added as an own Moose class. The scripting part on your side is, however, significantly reduced and you have convenient user API function available for customization.

Please revisit the first post for further info, new code and and an example mission featuring two rescue helos at different carriers
__________________
Of all the things I've lost, I miss my mind the most. --- Mark Twain
i7-8700K | Asus GTX 1080 Ti Strix OC| 32 GB Ram 3200 MHz DDR-4| Win 10 64-bit | Asus Maximus Hero X | Samung EVO 960 Pro SSD | VKB Gunfighter Pro | MFG Crosswind | CV1
funkyfranky is offline   Reply With Quote
Old 01-23-2019, 10:17 PM   #59
BoneDust
Member
 
BoneDust's Avatar
 
Join Date: Nov 2007
Location: NB, Canada
Posts: 847
Default

Quote:
Originally Posted by funkyfranky View Post
Hi guys, and sorry for the late reply but I have not been lazy

The code has been enhanced with new features and added as an own Moose class. The scripting part on your side is, however, significantly reduced and you have convenient user API function available for customization.

Please revisit the first post for further info, new code and and an example mission featuring two rescue helos at different carriers
That's awesome man
__________________


Spoiler:
Windows® 10 Home Premium | 64bit, Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz (Cores 6) (Logical/Core 2) | NVIDIA GeForce GTX 1080 Ti 11GB | 1 X 1TB SSD | 1 X 275GB SSD | Sound Blaster X-Fi Xtreme Audio sound card | 16GB Dual Channel DDR3 SDRAM at 1333MHz | Oculus Rift
BoneDust is offline   Reply With Quote
Old 01-24-2019, 06:18 AM   #60
BoneDust
Member
 
BoneDust's Avatar
 
Join Date: Nov 2007
Location: NB, Canada
Posts: 847
Default

I'm using the new code and it works great until it has to land. The helo still lands in the water and just flies along partially submerged under water, so it doesn't respawn.
__________________


Spoiler:
Windows® 10 Home Premium | 64bit, Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz (Cores 6) (Logical/Core 2) | NVIDIA GeForce GTX 1080 Ti 11GB | 1 X 1TB SSD | 1 X 275GB SSD | Sound Blaster X-Fi Xtreme Audio sound card | 16GB Dual Channel DDR3 SDRAM at 1333MHz | Oculus Rift
BoneDust is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 01:26 AM. vBulletin Skin by ForumMonkeys. Powered by vBulletin®.
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.