Jump to content

MOOSE beginner issues


DenTroge

Recommended Posts

Hi y'all :)

 

I am following flightcontrol's tutorials on youtube, and experimenting with spawning, and I think I might have misunderstood something fundamental.

 

I am trying to spawn groups a, b and c when group d reaches a waypoint.

I've got my Moose.lua setup and initialized at startup in the ME.

My mission.lua is also initialized on startup and reads:

 

a = SPAWN:New( "a" )

b = SPAWN:New( "b" )

c = SPAWN:New( "c" )

 

In the ME group d reaches a waypoint that runs a script (in the ME) that reads:

 

a:Spawn()

b:Spawn()

c:Spawn()

 

And nothing happens.

 

Funny thing is though, that if i remove mission.lua from the list of triggers and replace it with a DO SCRIPT (instead of a DO SCRIPT FILE) and write the same thing into the ME directly it works.

 

Anyone know what, if anything, I'm doing wrong here?

Link to comment
Share on other sites

Hi y'all :)

 

 

 

I am following flightcontrol's tutorials on youtube, and experimenting with spawning, and I think I might have misunderstood something fundamental.

 

 

 

I am trying to spawn groups a, b and c when group d reaches a waypoint.

 

I've got my Moose.lua setup and initialized at startup in the ME.

 

My mission.lua is also initialized on startup and reads:

 

 

 

a = SPAWN:New( "a" )

 

b = SPAWN:New( "b" )

 

c = SPAWN:New( "c" )

 

 

 

In the ME group d reaches a waypoint that runs a script (in the ME) that reads:

 

 

 

a:Spawn()

 

b:Spawn()

 

c:Spawn()

 

 

 

And nothing happens.

 

 

 

Funny thing is though, that if i remove mission.lua from the list of triggers and replace it with a DO SCRIPT (instead of a DO SCRIPT FILE) and write the same thing into the ME directly it works.

 

 

 

Anyone know what, if anything, I'm doing wrong here?

 

 

 

Take a look at you dcs.log file and see if there are any errors related to your mission.lua file.

 

 

Sent from my iPhone using Tapatalk

Link to comment
Share on other sites

According to the log:

 

2018-05-05 10:57:39.945 INFO SCRIPTING: 10095( 10652)/E: DATABASE00003._RegisterGroupTemplate({[1]=Group,[2]=a,[3]=Coalition,[4]=1,[5]=Category,[6]=2,[7]=Country,[8]=0,[9]=Units,[10]=a,})

 

 

 

2018-05-05 10:57:49.921 ERROR DCS: Mission script error: : [string "a:Spawn()..."]:1: attempt to index global 'a' (a nil value)

[string "a:Spawn()..."]:1: in main chunk

Link to comment
Share on other sites

Also I found this in the log:

 

2018-05-05 10:57:39.952 ERROR DCS: Mission script error: : [string "C:\Users\DenTroge\AppData\Local\Temp\DCS\/~mis0000361E"]:19690: SPAWN:New: There is no group declared in the mission editor with SpawnTemplatePrefix = 'E'

 

Now E is a group name that i used earlier while testing, but have since deleted, and it is no longer in the mission.lua and I do not have a E:Spawn() script in the editor and the grout itself is deleted.

 

I have seen this before; the ME still tries to look for groups that i have deleted from both the mission.lua and from the editor.

 

I just cant get my head around this :)

Link to comment
Share on other sites

Also I found this in the log:

 

2018-05-05 10:57:39.952 ERROR DCS: Mission script error: : [string "C:UsersDenTrogeAppDataLocalTempDCS/~mis0000361E"]:19690: SPAWN:New: There is no group declared in the mission editor with SpawnTemplatePrefix = 'E'

 

Now E is a group name that i used earlier while testing, but have since deleted, and it is no longer in the mission.lua and I do not have a E:Spawn() script in the editor and the grout itself is deleted.

 

I have seen this before; the ME still tries to look for groups that i have deleted from both the mission.lua and from the editor.

 

I just cant get my head around this :)

 

I haven't play with Moose for quite some time, take your time coming to grips with it DenTroge, lots to learn:smartass:.

 

Use the supplied templates for examples first and go through the video's, some a few times;), let it all sink in. I need to get back and have play myself, not much time right now tho.

 

 

https://www.youtube.com/channel/UCjrA9j5LQoWsG4SpS8i79Qg

 

https://flightcontrol-master.github.io/MOOSE_DOCS/

 

https://flightcontrol-master.github.io/MOOSE_DOCS/Documentation/index.html

 

-

i7-7700K OC @ 5Ghz | ASUS IX Hero MB | ASUS GTX 1080 Ti STRIX | 32GB Corsair 3000Mhz | Corsair H100i V2 Radiator | Samsung 960 EVO M.2 NVMe 500G SSD | Samsung 850 EVO 500G SSD | Corsair HX850i Platinum 850W | Oculus Rift | ASUS PG278Q 27-inch, 2560 x 1440, G-SYNC, 144Hz, 1ms | VKB Gunfighter Pro

Chuck's DCS Tutorial Library

Download PDF Tutorial guides to help get up to speed with aircraft quickly and also great for taking a good look at the aircraft available for DCS before purchasing. Link

Link to comment
Share on other sites

So, the issue is that the ME part of this script doesn't see the script you ran separately. I've had this before. There's nothing wrong with the code as such, just that there now seems to be a division with what a script can see and the ME can see of each other, a bit like the way we have a server environment running with restricted commands and a mission environment.

 

I recently had issues with LUA predicates after they were fixed, I need to look more into this and why, because I was understanding globally declared variables in the ME were shared across the environment and could be called apart and see each other. Seems no longer the case.

 

The thing you need to do is move solely to one script to stop this happening. There's a more complex ability to run scripts as groups meet waypoints, but apart from seeing it work, I can't recall how it's done.

 

You could/should, as a much more inefficient workaround, put a SCHEDULER in a ZONE to test if the group is present for the logic to spawn them, it's not as complex as you think, and we were doing this for years whilst the ME was broken for calling scripts at waypoints and LUA Predicate was broken.

___________________________________________________________________________

SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *

Link to comment
Share on other sites

I can't reproduce and got the exact correct expected result when launching scripts from waypoints or do scripts and script files. Attached a working example of what you were trying to achieve based on your post (same code)

 

So I believe the issue is the loading of the script is at fault and you haven't refreshed the mission.lua after editing it, which is a quite common issue. If you edit the script and don't update the trigger it takes the old script and never updates it. This is how DCS has always behaved.

 

To get it to refresh correctly, load a different scriptname, press save, update the new script, save it, and point to it in the do script file and press save.

 

Alternatively load your scripts in realtime with the following instructions which don't require any of that nonsense when updating.

 

variableTest.miz

___________________________________________________________________________

SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *

Link to comment
Share on other sites

In my personal experience (hundreds of events) in 2.5.0 and 2.5.1, I always update a DO SCRIPT FILE trigger by merely navigating to the file, selecting it and closing the window. Never fails to update (so long as I follow the procedure correctly).

Link to comment
Share on other sites

I do even worse. I delete the DO SCRIPT FILE and recreate the whole line. Also sometimes if by mistake you create a DO SCRIPT FILE and choose a script that you already load (say mist), then switch to the correct script, when running the mission the other script (mist in that case) won't load. You have to refresh it as well.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...