FlightControl-Master / MOOSE

Mission Object Oriented Scripting Environment (MOOSE) for lua mission scripting design in DCS World
http://flightcontrol-master.github.io/MOOSE/
GNU General Public License v3.0
291 stars 96 forks source link

CAZ-101.lua doesn´t working #1472

Closed acothebraco closed 3 years ago

acothebraco commented 3 years ago

HI,

I have a problem with the CAZ Capture Zone scripts. I copied everything after this video https://www.youtube.com/watch?v=R_2dkz57IAU&t=694s but the script still doesn't work. Can you please help me here because I haven't found anything up-to-date on this topic on github?

I will send you the .lua and .miz files that I created as an attachment.

I'm looking forward to your answer.

CAZ.zip

Applevangelist commented 3 years ago

In Moose and LUA you need to use : before a function call, not dots "." Half the time you are doing it correct, half the time not.

Applevangelist commented 3 years ago

I suggest you consult the beginner's guide.

acothebraco commented 3 years ago

Thank you for answer. I do it like in the video tutorial. I give me another try.

Applevangelist commented 3 years ago

The videos are very old and we don't own the account

acothebraco commented 3 years ago

Oh ok, I don't know that. I try a little later your Tipp withe the :

acothebraco commented 3 years ago

So i changed the the failure points in the script. But there is no capturing of that Zone. here are my LOGs

2021-03-07 14:17:24.947 INFO SCRIPTING: Init: Scripts Loaded v1.1 2021-03-07 14:17:24.951 INFO SCRIPTING: 13875( 13117)/I: DATABASE00003._RegisterGroupsAndUnits(Register Group: Red Tanks) 2021-03-07 14:17:24.951 INFO SCRIPTING: 13885( 13117)/I: DATABASE00003._RegisterGroupsAndUnits(Register Unit: Red Tanks) 2021-03-07 14:17:24.951 INFO SCRIPTING: 13885( 13117)/I: DATABASE00003._RegisterGroupsAndUnits(Register Unit: Red Tanks-1) 2021-03-07 14:17:24.951 INFO SCRIPTING: 13885( 13117)/I: DATABASE00003._RegisterGroupsAndUnits(Register Unit: Red Tanks-2) 2021-03-07 14:17:24.952 INFO SCRIPTING: 13875( 13117)/I: DATABASE00003._RegisterGroupsAndUnits(Register Group: REDHQ-2) 2021-03-07 14:17:24.952 INFO SCRIPTING: 13885( 13117)/I: DATABASE00003._RegisterGroupsAndUnits(Register Unit: REDHQ-2-1) 2021-03-07 14:17:24.952 INFO SCRIPTING: 13885( 13117)/I: DATABASE00003._RegisterGroupsAndUnits(Register Unit: REDHQ-2-2) 2021-03-07 14:17:24.953 INFO SCRIPTING: 13875( 13117)/I: DATABASE00003._RegisterGroupsAndUnits(Register Group: REDHQ) 2021-03-07 14:17:24.953 INFO SCRIPTING: 13885( 13117)/I: DATABASE00003._RegisterGroupsAndUnits(Register Unit: REDHQ) 2021-03-07 14:17:24.953 INFO SCRIPTING: 13875( 13117)/I: DATABASE00003._RegisterGroupsAndUnits(Register Group: Red Helicopters) 2021-03-07 14:17:24.954 INFO SCRIPTING: 13885( 13117)/I: DATABASE00003._RegisterGroupsAndUnits(Register Unit: Red Helicopters) 2021-03-07 14:17:24.954 INFO SCRIPTING: 13875( 13117)/I: DATABASE00003._RegisterGroupsAndUnits(Register Group: Blue Tanks) 2021-03-07 14:17:24.954 INFO SCRIPTING: 13885( 13117)/I: DATABASE00003._RegisterGroupsAndUnits(Register Unit: Blue Tanks-1) 2021-03-07 14:17:24.955 INFO SCRIPTING: 13885( 13117)/I: DATABASE00003._RegisterGroupsAndUnits(Register Unit: Blue Tanks-2) 2021-03-07 14:17:24.955 INFO SCRIPTING: 13885( 13117)/I: DATABASE00003._RegisterGroupsAndUnits(Register Unit: Blue Tanks-3) 2021-03-07 14:17:24.955 INFO SCRIPTING: 13875( 13117)/I: DATABASE00003._RegisterGroupsAndUnits(Register Group: REDHQ-1) 2021-03-07 14:17:24.955 INFO SCRIPTING: 13885( 13117)/I: DATABASE00003._RegisterGroupsAndUnits(Register Unit: REDHQ-1-1) 2021-03-07 14:17:24.956 INFO SCRIPTING: 13875( 13117)/I: DATABASE00003._RegisterGroupsAndUnits(Register Group: Blue Helicopters) 2021-03-07 14:17:24.956 INFO SCRIPTING: 13885( 13117)/I: DATABASE00003._RegisterGroupsAndUnits(Register Unit: Blue Helicopters-1) 2021-03-07 14:17:24.972 INFO SCRIPTING: 13961( 13120)/I: DATABASE00003._RegisterAirbases(Register Airdrome: Anapa-Vityazevo (ID=12 UID=12), parking=94 [244=0 68=52 40=0 216=0 176=0 104=40 16=2 72=0 ]) 2021-03-07 14:17:24.983 INFO SCRIPTING: 13961( 13120)/I: DATABASE00003._RegisterAirbases(Register Airdrome: Krasnodar-Center (ID=13 UID=13), parking=58 [244=0 68=33 40=0 216=0 176=0 104=23 16=2 72=0 ]) 2021-03-07 14:17:24.990 INFO SCRIPTING: 13961( 13120)/I: DATABASE00003._RegisterAirbases(Register Airdrome: Novorossiysk (ID=14 UID=14), parking=40 [244=0 68=22 40=0 216=0 176=0 104=16 16=2 72=0 ]) 2021-03-07 14:17:25.001 INFO SCRIPTING: 13961( 13120)/I: DATABASE00003._RegisterAirbases(Register Airdrome: Krymsk (ID=15 UID=15), parking=59 [244=0 68=27 40=0 216=0 176=0 104=30 16=2 72=0 ]) 2021-03-07 14:17:25.014 INFO SCRIPTING: 13961( 13120)/I: DATABASE00003._RegisterAirbases(Register Airdrome: Maykop-Khanskaya (ID=16 UID=16), parking=59 [244=0 68=0 40=0 216=0 176=0 104=57 16=2 72=0 ]) 2021-03-07 14:17:25.017 INFO SCRIPTING: 13961( 13120)/I: DATABASE00003._RegisterAirbases(Register Airdrome: Gelendzhik (ID=17 UID=17), parking=15 [244=0 68=0 40=0 216=0 176=0 104=13 16=2 72=0 ]) 2021-03-07 14:17:25.027 INFO SCRIPTING: 13961( 13120)/I: DATABASE00003._RegisterAirbases(Register Airdrome: Sochi-Adler (ID=18 UID=18), parking=70 [244=0 68=27 40=0 216=0 176=0 104=41 16=2 72=0 ]) 2021-03-07 14:17:25.031 INFO SCRIPTING: 13961( 13120)/I: DATABASE00003._RegisterAirbases(Register Airdrome: Krasnodar-Pashkovsky (ID=19 UID=19), parking=21 [244=0 68=0 40=0 216=0 176=0 104=19 16=2 72=0 ]) 2021-03-07 14:17:25.035 INFO SCRIPTING: 13961( 13120)/I: DATABASE00003._RegisterAirbases(Register Airdrome: Sukhumi-Babushara (ID=20 UID=20), parking=25 [244=0 68=0 40=0 216=0 176=0 104=23 16=2 72=0 ]) 2021-03-07 14:17:25.040 INFO SCRIPTING: 13961( 13120)/I: DATABASE00003._RegisterAirbases(Register Airdrome: Gudauta (ID=21 UID=21), parking=33 [244=0 68=21 40=0 216=0 176=0 104=10 16=2 72=0 ]) 2021-03-07 14:17:25.042 INFO SCRIPTING: 13961( 13120)/I: DATABASE00003._RegisterAirbases(Register Airdrome: Batumi (ID=22 UID=22), parking=12 [244=0 68=0 40=0 216=0 176=0 104=10 16=2 72=0 ]) 2021-03-07 14:17:25.052 INFO SCRIPTING: 13961( 13120)/I: DATABASE00003._RegisterAirbases(Register Airdrome: Senaki-Kolkhi (ID=23 UID=23), parking=70 [244=0 68=52 40=0 216=0 176=0 104=16 16=2 72=0 ]) 2021-03-07 14:17:25.059 INFO SCRIPTING: 13961( 13120)/I: DATABASE00003._RegisterAirbases(Register Airdrome: Kobuleti (ID=24 UID=24), parking=44 [244=0 68=16 40=0 216=0 176=0 104=26 16=2 72=0 ]) 2021-03-07 14:17:25.068 INFO SCRIPTING: 13961( 13120)/I: DATABASE00003._RegisterAirbases(Register Airdrome: Kutaisi (ID=25 UID=25), parking=60 [244=0 68=33 40=0 216=0 176=0 104=25 16=2 72=0 ]) 2021-03-07 14:17:25.073 INFO SCRIPTING: 13961( 13120)/I: DATABASE00003._RegisterAirbases(Register Airdrome: Mineralnye Vody (ID=26 UID=26), parking=30 [244=0 68=0 40=0 216=0 176=0 104=28 16=2 72=0 ]) 2021-03-07 14:17:25.076 INFO SCRIPTING: 13961( 13120)/I: DATABASE00003._RegisterAirbases(Register Airdrome: Nalchik (ID=27 UID=27), parking=17 [244=0 68=0 40=0 216=0 176=0 104=15 16=2 72=0 ]) 2021-03-07 14:17:25.082 INFO SCRIPTING: 13961( 13120)/I: DATABASE00003._RegisterAirbases(Register Airdrome: Mozdok (ID=28 UID=28), parking=41 [244=0 68=0 40=0 216=0 176=0 104=39 16=2 72=0 ]) 2021-03-07 14:17:25.093 INFO SCRIPTING: 13961( 13120)/I: DATABASE00003._RegisterAirbases(Register Airdrome: Tbilisi-Lochini (ID=29 UID=29), parking=76 [244=0 68=0 40=4 216=0 176=0 104=40 16=2 72=30 ]) 2021-03-07 14:17:25.095 INFO SCRIPTING: 13961( 13120)/I: DATABASE00003._RegisterAirbases(Register Airdrome: Soganlug (ID=30 UID=30), parking=7 [244=0 68=0 40=0 216=0 176=0 104=5 16=2 72=0 ]) 2021-03-07 14:17:25.108 INFO SCRIPTING: 13961( 13120)/I: DATABASE00003._RegisterAirbases(Register Airdrome: Vaziani (ID=31 UID=31), parking=94 [244=0 68=57 40=0 216=0 176=0 104=19 16=2 72=16 ]) 2021-03-07 14:17:25.111 INFO SCRIPTING: 13961( 13120)/I: DATABASE00003._RegisterAirbases(Register Airdrome: Beslan (ID=32 UID=32), parking=17 [244=0 68=0 40=0 216=0 176=0 104=15 16=2 72=0 ]) 2021-03-07 14:17:25.112 INFO SCRIPTING: 13285(152709)/I: DATABASE00003.?({[1]=Register ZONE:,[Name]=AttackZone,}) 2021-03-07 14:17:25.113 INFO SCRIPTING: 5814(152711)/I: BASE00000.?(Tracing in MOOSE is OFF) 2021-03-07 14:17:25.113 INFO SCRIPTING: MOOSE INCLUDE END

CAZ-101.txt

Applevangelist commented 3 years ago

Mate, I did have a look at your .miz. You urgently need to learn how to read the logs and debug your stuff, especially before you raise an issue at GitHub for something to be "broken" and waisting everyones time. Please use the Discord if you need support. Your BLUEHQ is undefined in the script, as is "ZoneName" which you did write as "Zonename" further above. Here's a working version of your stuff.

BASE:TraceOn(true)
BASE:TraceClass("ZONE_CAPTURE_COALITION")

do -- Setup the Command Centers

RU_CC = COMMANDCENTER:New( GROUP:FindByName( "REDHQ" ), "Russia HQ" )
US_CC = COMMANDCENTER:New( GROUP:FindByName( "BLUEHQ" ), "USA HQ")

end

AttackZone = ZONE:New( "AttackZone")

ZoneCaptureCoalition = ZONE_CAPTURE_COALITION:New( AttackZone, coalition.side.RED )
ZoneCaptureCoalition:SetMarkZone(true)

HeliBlueSpawn = SPAWN:New( "Blue Helicopters" )
TankBlueSpawn = SPAWN:New( "Blue Tanks" )

HeliRedSpawn = SPAWN:New( "Red Helicopters" )
TankRedSpawn = SPAWN:New( "Red Tanks" )

ZoneName = "Attack Zone"

--- @param Functional.ZoneCaptureCoalition#ZONE_CAPTURE_COALITION self
function ZoneCaptureCoalition:OnEnterGuarded()

  local Coalition = self:GetCoalition()
  local ZoneName = self:GetZoneName()

  if Coalition == coalition.side.BLUE then
    --RU_CC:MessageTypeToCoalition( string.format( "The vicinity %s is still guarded, enforcements are underway to capture the zone!", ZoneName ), MESSAGE.Type.Information )
    local m = MESSAGE:New(string.format( "The vicinity %s is still guarded, enforcements are underway to capture the zone!", ZoneName),15,"Red"):ToAll()
    local AttackCoord = AttackZone:GetRandomCoordinate()
    local HeliRedGroup = HeliRedSpawn:Spawn()
    local HeliRedCoord = HeliRedGroup:GetCoordinate()

    local CurrentWayPoint = HeliRedCoord:WaypointAirTurningPoint( COORDINATE.WaypointAltType.RADIO, 150 )
    local ToWaypoint = AttackCoord:WaypointAirTurningPoint( COORDINATE.WaypointAltType.RADIO, 150 )
    HeliRedGroup:Route( {CurrentWaypoint, ToWaypoint }, 1 )
    HeliRedGroup:OptionROEWeaponFree()

    local TankRedGroup = TankRedSpawn:Spawn()
    TankRedGroup:RouteGroundTo(AttackCoord, math.random( 60, 80 ), "Vee", 1 )
  else
    --US_CC:MessageTypeToCoalition( string.format( "The vicinity %s is still guarded, enforcements are underway to capture the zone!", ZoneName ), MESSAGE.Type.Information )
    local m = MESSAGE:New(string.format( "The vicinity %s is still guarded, enforcements are underway to capture the zone!", ZoneName),15,"Blue"):ToAll()
    local AttackCoord = AttackZone:GetRandomCoordinate()
    local HeliBlueGroup = HeliBlueSpawn:Spawn()
    local HeliBlueCoord = HeliBlueGroup:GetCoordinate()

    local CurrentWayPoint = HeliBlueCoord:WaypointAirTurningPoint( COORDINATE.WaypointAltType.RADIO, 150 )
    local ToWaypoint = AttackCoord:WaypointAirTurningPoint( COORDINATE.WaypointAltType.RADIO, 150 )
    HeliBlueGroup:Route( {CurrentWaypoint, ToWaypoint }, 1 )
    HeliBlueGroup:OptionROEWeaponFree()

    local TankBlueGroup = TankBlueSpawn:Spawn()
    TankBlueGroup:RouteGroundTo(AttackCoord, math.random( 60, 80 ), "Vee", 1 )
  end

end

--- @param Functional.ZoneCaptureCoalition#ZONE_CAPTURE_COALITION self
function ZoneCaptureCoalition:OnEnterEmpty()
  self:Flare( FLARECOLOR.White )
  local m = MESSAGE:New("The capture zone is empty!",15,"Info"):ToAll()
end 

ZoneCaptureCoalition:MonitorDestroyedUnits()
ZoneCaptureCoalition:Start(10,30)
ZoneCaptureCoalition:__Guard( 2 )
Delta-99 commented 3 years ago

I think the thing to do here is first ask people to show any errors in the log. This can be closed right? Its not really a bug I wouldn't think.

acothebraco commented 3 years ago

Thanky you and sorry that I waste you time. I´m only needed help on this issue.

Best

Alex