Jump to content

Recommended Posts

Posted

After applying the latest DCS patch from 12/22 the following working code now throws an error:

function Event_Handler_Global:onEvent(event)
	if(world.event.S_EVENT_DEAD == event.id) then 
		env.info('START: helpers FUNCTION: helpers_Event_Handler:onEvent CRASH/DEAD event.initiator:getCategory(): OBJECT CAT:'..event.initiator:getCategory())
	end
end

2022-12-23 12:00:08.172 ERROR   SCRIPTING (Main): Mission script error: [string "C:\dynamicCampaign\events.lua"]:722: attempt to index field 'initiator' (a nil value)
stack traceback:
	[C]: ?
	[string "C:\dynamicCampaign\events.lua"]:722: in function 'onEvent'
	[string "Scripts/World/EventHandlers.lua"]:13: in function <[string "Scripts/World/EventHandlers.lua"]:11>

This has always worked before. Any idea why the dead event no longer has a valid initiator field/object as of the last patch? I didn't see anything in the patch notes that would suggest something has changed.

I created and maintain Operation Candyland, a DCS Open Beta server. Since 2019, Operation Candyland has been one of the best persistent campaigns running on DCS. Featuring ALL modern US and Russian Air, Ground, and Sea forces dynamically controlled by a standalone AI controller. At any given time, there are over 500 units on the map without any lag or desync due to the standalone nature of the system. Experience one of the best multiday campaign experiences in DCS either solo or with a group of other pilots. Both new and veteran DCS pilots will find Operation Candyland a refreshing challenge where no two campaigns are ever the same. Challenge yourself by reaching the top of a custom scoreboard which grades you based on your sortie performance and experience a custom F10 fog of war system which reveals units based on your coalition's current level of command and control. Rescue downed friendly pilots or captured downed enemy pilots in order to extract valuable intel to progress the mission. Learn more at: https://discord.gg/operation-candyland

Posted (edited)

Hello.

In your log, initiator is nil. Sure CRASH is covering the DEAD event, by NIL-ing all available information from initiator.
if _Event.initiator then ....
local alaCATE = _Event.initiator:getCategory()
if alaCATE <= 1 then ....

I have solve my problems (for Client+AI) by using UNIT_LOST instead of DEAD.
If i may suggest, try test: CRASH in a seperate check, but after UNIT_LOST. Avoid check both with OR in the same line.

Thank you.

Edited by ADHS

Democracy was already invented, while Scrat was eating oak fruits.

Posted
On 12/23/2022 at 4:45 PM, xcandiottix said:

After applying the latest DCS patch from 12/22 the following working code now throws an error:

function Event_Handler_Global:onEvent(event)
	if(world.event.S_EVENT_DEAD == event.id) then 
		env.info('START: helpers FUNCTION: helpers_Event_Handler:onEvent CRASH/DEAD event.initiator:getCategory(): OBJECT CAT:'..event.initiator:getCategory())
	end
end

2022-12-23 12:00:08.172 ERROR   SCRIPTING (Main): Mission script error: [string "C:\dynamicCampaign\events.lua"]:722: attempt to index field 'initiator' (a nil value)
stack traceback:
	[C]: ?
	[string "C:\dynamicCampaign\events.lua"]:722: in function 'onEvent'
	[string "Scripts/World/EventHandlers.lua"]:13: in function <[string "Scripts/World/EventHandlers.lua"]:11>

This has always worked before. Any idea why the dead event no longer has a valid initiator field/object as of the last patch? I didn't see anything in the patch notes that would suggest something has changed.

+1.

We use the Dead event for persistancy. S_EVENT_DEAD did not work atm.

Posted
On 12/24/2022 at 12:56 AM, ADHS said:

Hello.

In your log, initiator is nil. Sure CRASH is covering the DEAD event, by NIL-ing all available information from initiator.
if _Event.initiator then ....
local alaCATE = _Event.initiator:getCategory()
if alaCATE <= 1 then ....

I have solve my problems (for Client+AI) by using UNIT_LOST instead of DEAD.
If i may suggest, try test: CRASH in a seperate check, but after UNIT_LOST. Avoid check both with OR in the same line.

Thank you.

 

Sorry for the confusion, "CRASH/DEAD" is just a generic log entry I made for something dying. You can ignore that. The exact problem is that the DEAD event was throwing an error because it had no initiator.

13 minutes ago, thornx said:

+1.

We use the Dead event for persistancy. S_EVENT_DEAD did not work atm.

After the hot patch a few days ago I think it is working again. Or at least I haven't seen the error since.

I created and maintain Operation Candyland, a DCS Open Beta server. Since 2019, Operation Candyland has been one of the best persistent campaigns running on DCS. Featuring ALL modern US and Russian Air, Ground, and Sea forces dynamically controlled by a standalone AI controller. At any given time, there are over 500 units on the map without any lag or desync due to the standalone nature of the system. Experience one of the best multiday campaign experiences in DCS either solo or with a group of other pilots. Both new and veteran DCS pilots will find Operation Candyland a refreshing challenge where no two campaigns are ever the same. Challenge yourself by reaching the top of a custom scoreboard which grades you based on your sortie performance and experience a custom F10 fog of war system which reveals units based on your coalition's current level of command and control. Rescue downed friendly pilots or captured downed enemy pilots in order to extract valuable intel to progress the mission. Learn more at: https://discord.gg/operation-candyland

Posted
39 minutes ago, xcandiottix said:

Sorry for the confusion, "CRASH/DEAD" is just a generic log entry I made for something dying. You can ignore that. The exact problem is that the DEAD event was throwing an error because it had no initiator.

After the hot patch a few days ago I think it is working again. Or at least I haven't seen the error since.

Interesting. We capture dead events, but since 23 DEC it is broken. At least all missions have stopped logging dead events. Without changing the scripts.
... Hm. Maybe something else changed in the API or DCS Event system.

Posted
1 hour ago, thornx said:

Interesting. We capture dead events, but since 23 DEC it is broken. At least all missions have stopped logging dead events. Without changing the scripts.
... Hm. Maybe something else changed in the API or DCS Event system.

My apologies, I took a second look at the code and in fact I must have switched it to the UNIT_LOST event. Here is the current code I have that is working. I too have a persistent campaign so this is critical. 

--if(world.event.S_EVENT_DEAD == event.id) then --Commented out in favor of below
if(world.event.S_EVENT_UNIT_LOST == event.id) then
--Note the initiator for unit lost is the same as it would have been for dead it seems.

 

I created and maintain Operation Candyland, a DCS Open Beta server. Since 2019, Operation Candyland has been one of the best persistent campaigns running on DCS. Featuring ALL modern US and Russian Air, Ground, and Sea forces dynamically controlled by a standalone AI controller. At any given time, there are over 500 units on the map without any lag or desync due to the standalone nature of the system. Experience one of the best multiday campaign experiences in DCS either solo or with a group of other pilots. Both new and veteran DCS pilots will find Operation Candyland a refreshing challenge where no two campaigns are ever the same. Challenge yourself by reaching the top of a custom scoreboard which grades you based on your sortie performance and experience a custom F10 fog of war system which reveals units based on your coalition's current level of command and control. Rescue downed friendly pilots or captured downed enemy pilots in order to extract valuable intel to progress the mission. Learn more at: https://discord.gg/operation-candyland

Posted
9 hours ago, xcandiottix said:

I must have switched it to the UNIT_LOST event

🙂

  • Like 1

Democracy was already invented, while Scrat was eating oak fruits.

Posted (edited)
On 12/31/2022 at 5:51 AM, ADHS said:

🙂

Is this a permanent move from ED? Or just a Bug in the DEAD Event? I lack the motivation to convert all my missions to UNIT_LOST 🙂

Edited by thornx
Posted (edited)
3 hours ago, thornx said:

Is this a permanent move from ED?

Hello.
Sorry, but i dont know so to give you an answer.

Personally, i don't mind for such changes anymore.
My custom event handler has been set in a way
that if something have change, is reporting back
and is sorting the events by it's own, no matter
what ED have change in the events code section.

Thank you.

 

Edited by ADHS

Democracy was already invented, while Scrat was eating oak fruits.

Posted (edited)
On 12/24/2022 at 4:56 PM, ADHS said:

I have solve my problems (for Client+AI) by using UNIT_LOST instead of DEAD.

On 12/31/2022 at 6:44 AM, xcandiottix said:

I must have switched it to the UNIT_LOST event. Here is the current code I have that is working.

if(world.event.S_EVENT_UNIT_LOST == event.id) then

😂

Edited by ADHS

Democracy was already invented, while Scrat was eating oak fruits.

  • 3 weeks later...
Posted
On 1/2/2023 at 8:42 PM, thornx said:

Is this a permanent move from ED? Or just a Bug in the DEAD Event? I lack the motivation to convert all my missions to UNIT_LOST 🙂

 

Did you ever get an answer to your question.

I'm having issues too. S_EVENT_UNIT_LOST isn't working for me either on certain units (Cows is the one I'm using for testing at the moment). I'd love to know if there is another option available as a workaround, or whether this is a deliberate change, not a bug and we're going to lose this feature so I can stop wasting my time developing missions that require this if it's not coming back.

  • Like 1
Posted

They brake things all the time. Its pointless finding away around a bug. Because next patch (up to soon = 2 years)  the way around is broken and the bug is fixed 🙂

 

  • Recently Browsing   0 members

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