Jump to content

Recommended Posts

  • 4 weeks later...
Posted
On 10/26/2024 at 8:43 AM, Lekaa said:

 

 

 

@Grimes

I think i fixed the 

Group not accessible by unit in event handler. This is a DCS bug

 

local function groupSpawned(event)
		if event.id == world.event.S_EVENT_BIRTH and timer.getTime() > event.time + 1 then
			if Object.getCategory(event.initiator) == 1 then
				local g = Unit.getGroup(event.initiator)
				if g and event.initiator:getPlayerName() and event.initiator:getPlayerName() ~= "" then
					local unitName = event.initiator:getName()
					if unitName and not mist.DBs.MEunitsByName[unitName] then
						local gName = g:getName()
						if not tempSpawnedGroups[gName] then
							tempSpawnedGroups[gName] = {type = 'group', gp = g}
							tempSpawnGroupsCounter = tempSpawnGroupsCounter + 1
						end
					end
				else
					log:error('Group not accessible by unit in event handler. This is a DCS bug')
				end
			elseif Object.getCategory(event.initiator) == 3 or Object.getCategory(event.initiator) == 6 then
				local staticName = StaticObject.getName(event.initiator)
				if staticName then
					tempSpawnedGroups[staticName] = {type = 'static'}
					tempSpawnGroupsCounter = tempSpawnGroupsCounter + 1
				end
			end
		end
	end

 

by adding 

> event.time + 1 then

 

Quote

    local function groupSpawned(event)
        -- Ignora unidades criadas no início da missão
        if event.id == world.event.S_EVENT_BIRTH and timer.getTime0() < timer.getAbsTime() then
            if Object.getCategory(event.initiator) == 1 then -- Verifica se é uma unidade
                local unit = event.initiator
                local g = Unit.getGroup(unit)
                
                -- Verifica se o grupo está acessível
                if g then
                    -- Grupo acessível, processa normalmente
                    local gName = g:getName()
                    if event.initiator:getPlayerName() ~= "" and not mist.DBs.MEunitsByName[event.initiator:getName()] then
                        if not tempSpawnedGroups[gName] then
                            tempSpawnedGroups[gName] = {type = 'group', gp = g}
                            tempSpawnGroupsCounter = tempSpawnGroupsCounter + 1
                        end
                    end
                else
                    -- Grupo não acessível, tenta novamente após um pequeno atraso
                    mist.scheduleFunction(function()
                        local retryGroup = Unit.getGroup(unit)
                        if retryGroup then
                            local retryGroupName = retryGroup:getName()
                            if not tempSpawnedGroups[retryGroupName] then
                                tempSpawnedGroups[retryGroupName] = {type = 'group', gp = retryGroup}
                                tempSpawnGroupsCounter = tempSpawnGroupsCounter + 1
                            end
                        else
                            log:error('Group not accessible by unit in event handler. This is a DCS bug')
                        end
                    end, {}, timer.getTime() + 1) -- Tenta novamente em 1 segundo
                end
            elseif Object.getCategory(event.initiator) == 3 or Object.getCategory(event.initiator) == 6 then
                -- Trata objetos estáticos
                local staticName = StaticObject.getName(event.initiator)
                if staticName then
                    tempSpawnedGroups[staticName] = {type = 'static'}
                    tempSpawnGroupsCounter = tempSpawnGroupsCounter + 1
                end
            end
        end
    end
 

 

Posted

Hello, I have the programing skills of a script kiddie and my searching skills are failing me. I want to use mist.dynAddStatic, but was unsure about stuff. Is the type and category based on the information when you emplace it using the mission editor, ie type="FARP Tent" category="Structures". Or is it something else? Also, based on the example on the wiki does everything that has a space use an underscore for type?

  • 1 month later...
Posted (edited)

I used mist.respawnInZone('Gruppe','Zone') and it comes up with with error.

What am I doing wrong?

typ.jpg

Edited by void68
Posted
1 hour ago, void68 said:

I used mist.respawnInZone('Gruppe','Zone') and it comes up with with error.

What am I doing wrong?

typ.jpg

Share your code 

Posted

You're most likely passing a nil value to mist.  As lekka said, we can't help much without seeing your code.

System Specs:

Spoiler

📻Callsign:Kandy  💻Processor:13th Gen Intel(R) Core(TM) i9-13900K - 🧠RAM: 64GB - 🎥Video Card: NVIDIA RTX 4090 - 🥽 Display: Pimax 8kx VR Headset - 🕹️Accessories:  VKB Gunfighter III MCG Ultimate, VKB STECS Standard, Thrustmaster TPR Pedals, Simshaker JetPad, Predator HOTAS Mounts, 3D Printed Flight Button Box 

📹 Video Capture Software:  Open Broadcaster Software (OBS), 🎞️ Video Editing Software:  PowerDirector 35

 Into The Jungle (MP Mission)  F18: Scorpion's Sting  Apache Campaign - Griffins  Kiowa Campaign - Assassins 

 

Posted (edited)
15 hours ago, void68 said:

I used mist.respawnInZone('Gruppe','Zone') and it comes up with with error.

What am I doing wrong?

typ.jpg

It's quite obvious what's wrong here. The error message says it right out.

Your code is trying to to pass a string 'Gruppe.zone' as 2 parameters. This is not how parameters are passed.

You even wrote the answer to the problem in your first line.
Should be mist.respawnInZone('Gruppe','Zone')

not "mist.respawnInZone('Gruppe,Zone')"

 

Gruppe should also be a valid group name.

zone should also be a valid zone name.

 

Good luck

Edited by Kanelbolle
Posted (edited)

Well, I have no real additional code here, I did an "execute script file" mist.lua and "execute script" with the code under triggers action. Gruppe (ground unit group to spawn) and Zone (triggerzone) were both defined.

 

I don't quite understand as

vor 3 Stunden schrieb Kanelbolle:

Should be mist.respawnInZone('Gruppe','Zone')

not "mist.respawnInZone('Gruppe,Zone')"

Gruppe should also be a valid group name.

zone should also be a valid zone name.

Isn't that exactly what I wrote and what it should be: mist.respawnInZone('Gruppe','Zone')? Gruppe and Zone are valid. I even put a space at the approbiate places around the comma like in the wiki, no change. Even stranger thing is that after I copied/pasted the different codes from the wiki it suddenly worked - despite they look exactly like my input - the parameters between {} and the nil, 4000 weren't the problem as I deleted them and still the script works.

 

script.jpg

SA2 is the name of both the group and the zone, not the best choice I know, but it was just for testing purpose.

Well, I don't know why it does work now and did not before. Thanks for help nontheless.

Edited by void68
typos
Posted
1 hour ago, void68 said:

Well, I have no real additional code here, I did an "execute script file" mist.lua and "execute script" with the code under triggers action. Gruppe (ground unit group to spawn) and Zone (triggerzone) were both defined.

 

I don't quite understand as

Isn't that exactly what I wrote and what it should be: mist.respawnInZone('Gruppe','Zone')? Gruppe and Zone are valid. I even put a space at the approbiate places around the comma like in the wiki, no change. Even stranger thing is that after I copied/pasted the different codes from the wiki it suddenly worked - despite they look exactly like my input - the parameters between {} and the nil, 4000 weren't the problem as I deleted them and still the script works.

 

script.jpg

SA2 is the name of both the group and the zone, not the best choice I know, but it was just for testing purpose.

Well, I don't know why it does work now and did not before. Thanks for help nontheless.

Make sure your zone exists in the editor

Posted (edited)

MIST v4.5.126 Hotfix throwing error

MIST Community - I have a strange error that's suddenly popping up in a mission I've had running for 6+ months on a dedicated server.  Hopefully someone can help here because I don't really understand why its happening.

I am what I'd call a "consumer" of MIST and not really an expert at coding/lua.  Probably the worst type of "user" as I probably know enough to make presumptions and make myself dangerous.  What follows is the information I've gathered in hopes of making it easier to diagnose.  Thanks to anyone who attempts to follow and assist.

This all started after updating to the latest DCS patch version 2.9.14.8222 MT.  Not saying that's the culprit, but I am suspicious.  I've also been updating my mission over time, so there's a high degree of probability that this wound is somehow self inflicted.

The community started reporting this error to me over the weekend.  I also had it happen on my server as well

image.png

I pulled the section from DCS.LOG as well

image.png

I then went to MIST to see what line 1525 was all about to see what routine it was in and how my mission might be calling it with bogus data.  But, in this case, the function in question is called "addDeadObject" and is a function loaded at MIST init.
Here's the function that's blowing up

image.png

The other line of code mentioned in the script error is 2096.  That code is below

image.png

Honestly, from here, I just don't have the skills to interpret what's happening.  Line 1525 is blowing up because something called "val.object" isn't valid.  From there, when the code tries to set the "pos" variable with an invalid variable, the script blows up.

Why this code has worked for literally MONTHS and just within the past couple of days throws errors, it a mystery to me.

Any thoughts on how to correct what's going on would be greatly appreciated.

Thanks!!

Edited by Mistermann
Added version to message

System Specs:

Spoiler

📻Callsign:Kandy  💻Processor:13th Gen Intel(R) Core(TM) i9-13900K - 🧠RAM: 64GB - 🎥Video Card: NVIDIA RTX 4090 - 🥽 Display: Pimax 8kx VR Headset - 🕹️Accessories:  VKB Gunfighter III MCG Ultimate, VKB STECS Standard, Thrustmaster TPR Pedals, Simshaker JetPad, Predator HOTAS Mounts, 3D Printed Flight Button Box 

📹 Video Capture Software:  Open Broadcaster Software (OBS), 🎞️ Video Editing Software:  PowerDirector 35

 Into The Jungle (MP Mission)  F18: Scorpion's Sting  Apache Campaign - Griffins  Kiowa Campaign - Assassins 

 

Posted

Which

5 minutes ago, Mistermann said:

MIST throwing error

MIST Community - I have a strange error that's suddenly popping up in a mission I've had running for 6+ months on a dedicated server.  Hopefully someone can help here because I don't really understand why its happening.

I am what I'd call a "consumer" of MIST and not really an expert at coding/lua.  Probably the worst type of "user" as I probably know enough to make presumptions and make myself dangerous.  What follows is the information I've gathered in hopes of making it easier to diagnose.  Thanks to anyone who attempts to follow and assist.

This all started after updating to the latest DCS patch version 2.9.14.8222 MT.  Not saying that's the culprit, but I am suspicious.  I've also been updating my mission over time, so there's a high degree of probability that this wound is somehow self inflicted.

The community started reporting this error to me over the weekend.  I also had it happen on my server as well

image.png

I pulled the section from DCS.LOG as well

image.png

I then went to MIST to see what line 1525 was all about to see what routine it was in and how my mission might be calling it with bogus data.  But, in this case, the function in question is called "addDeadObject" and is a function loaded at MIST init.
Here's the function that's blowing up

image.png

The other line of code mentioned in the script error is 2096.  That code is below

image.png

Honestly, from here, I just don't have the skills to interpret what's happening.  Line 1525 is blowing up because something called "val.object" isn't valid.  From there, when the code tries to set the "pos" variable with an invalid variable, the script blows up.

Why this code has worked for literally MONTHS and just within the past couple of days throws errors, it a mystery to me.

Any thoughts on how to correct what's going on would be greatly appreciated.

Thanks!!

version sre you using of mist?

Posted (edited)
5 minutes ago, Lekaa said:

Which version are you using of mist?

The hotfix version - which I believe is the latest - 

image.png

Edited by Mistermann

System Specs:

Spoiler

📻Callsign:Kandy  💻Processor:13th Gen Intel(R) Core(TM) i9-13900K - 🧠RAM: 64GB - 🎥Video Card: NVIDIA RTX 4090 - 🥽 Display: Pimax 8kx VR Headset - 🕹️Accessories:  VKB Gunfighter III MCG Ultimate, VKB STECS Standard, Thrustmaster TPR Pedals, Simshaker JetPad, Predator HOTAS Mounts, 3D Printed Flight Button Box 

📹 Video Capture Software:  Open Broadcaster Software (OBS), 🎞️ Video Editing Software:  PowerDirector 35

 Into The Jungle (MP Mission)  F18: Scorpion's Sting  Apache Campaign - Griffins  Kiowa Campaign - Assassins 

 

Posted
1 minute ago, Lekaa said:

Use the dev version.  The one you use is old

This is embarrassing - I wonder how many other people are using 4.5.126 because it says "Latest" on Github.  Never would have thought to delve into the development branch.

Thanks, Lekaa.

System Specs:

Spoiler

📻Callsign:Kandy  💻Processor:13th Gen Intel(R) Core(TM) i9-13900K - 🧠RAM: 64GB - 🎥Video Card: NVIDIA RTX 4090 - 🥽 Display: Pimax 8kx VR Headset - 🕹️Accessories:  VKB Gunfighter III MCG Ultimate, VKB STECS Standard, Thrustmaster TPR Pedals, Simshaker JetPad, Predator HOTAS Mounts, 3D Printed Flight Button Box 

📹 Video Capture Software:  Open Broadcaster Software (OBS), 🎞️ Video Editing Software:  PowerDirector 35

 Into The Jungle (MP Mission)  F18: Scorpion's Sting  Apache Campaign - Griffins  Kiowa Campaign - Assassins 

 

Posted
1 minute ago, Mistermann said:

This is embarrassing - I wonder how many other people are using 4.5.126 because it says "Latest" on Github.  Never would have thought to delve into the development branch.

Thanks, Lekaa.

Glad to help

  • Thanks 1
  • 2 months later...
Posted

Hi all.  

Our mission maker uses MIST, and we also use CTLD.  I am building a scoring sheet for our group based off exported TACVIEW Flight Logs.

One big thing is missing- none of the CTLD messages that denote events (like 'Troops Deployed') are recorded in TACVIEW, as TACVIEW is merely telemetry based.

Does anyone know a way using MIST, to record (to a file) these CTLD events or messages?  TACVIEW can import data (.txt or .csv for example) into a recording, prior to then exporting the combination out as one.

Any ideas appreciated.

'52

  • 2 weeks later...
Posted

Hey all,

I have a few questions regarding respawning in MIST. The first is, How much more reliable is mist.groupIsDead over Group.getByName?

I'm asking because I was looking up another issue and I came across a few posts as well as the wiki that seem to point at mist.groupIsDead being better at picking up when groups are dead. Now I was advised to use (a long time ago) this to make the death detection as good as it can be :

if (Group.getByName('GroupName') and #Group.getByName('GroupName'):getUnits() < 1) or not Group.getByName('GroupName') then
 

So I was wondering, would it be better for me now to just use groupIsDead over all of the above? Or is there still a combination like the above that makes the death detection a little more foolproof?

 

Posted

They are basically the same thing, just written a little differently. 

if (Group.getByName('GroupName') and #Group.getByName('GroupName'):getUnits() < 1) or not Group.getByName('GroupName') then

Here is a direct copy/paste of the the function call within mist. 

    function mist.groupIsDead(groupName) -- copy more or less from on station
		local gp = Group.getByName(groupName)
        if gp then 
            if  #gp:getUnits() > 0 and gp:isExist() == true  then
                return false
            end
		end
		return true
	end

 

  • Thanks 1

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

  • Recently Browsing   0 members

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