KaukausInsurgency / ki-dcs

Kaukasus Insurgency
5 stars 2 forks source link

Unable to use SLC menu in helicopter #260

Closed Igneous01 closed 6 years ago

Igneous01 commented 6 years ago

3276 2018-07-20 02:14:35.999 INFO SCRIPTING: KI.Hooks.GameEventHandler ERROR - [string "C:\Users\david\Documents\GitHub\KI\DCSScripts\SLC.lua"]:44: attempt to index a nil value

Igneous01 commented 6 years ago

When slotting in first time in MI8, the above error occurs when checking if the helicopter is capable of using SLC.

Unable to use SLC menu.

Igneous01 commented 6 years ago

It appears that birth event logic has changed... the birth event handler fires before the actual unit is created, causing this error.

ie. birth event raised here:

2018-07-20 02:14:35.996 INFO SCRIPTING: KI.Hooks.GameEventHandler:onEvent(event) called

2018-07-20 02:14:35.996 INFO SCRIPTING: KI.Hooks.GameEventHandler - BIRTH for SLCPilot51

2018-07-20 02:14:35.996 INFO SCRIPTING: SLC.InitSLCForUnit() called

2018-07-20 02:14:35.996 INFO SCRIPTING: SLC.InitSLCForUnit - SLC Pilot SLCPilot51 found, initializing

but birth creation of unit happens after

2018-07-20 02:14:36.000 INFO SCRIPTING: 5868( 13)/E: EVENT00000.onEvent({[1]=S_EVENT_BIRTH,[2]={[IniUnit]={[ClientAlive2]=false,[ClientBriefing]=,[ClassName]=CLIENT,[AliveCheckScheduler]={[SchedulerObject]=,[MasterObject]=,[ClassName]=SCHEDULER,[Schedules]={[1]=43#CLIENT#000001810,},},[ClientAlive]=false,[Messages]={},[MessageSwitch]=true,[ClientTransport]=false,[_Tasks]={},[ONBOARDSIDE]={[BACK]=3,[FRONT]=4,[RIGHT]=2,[NONE]=0,[LEFT]=1,},[ClientBriefingShown]=false,[Menus]={},[ClientName]=SLCPilot51,},[IniPlayerName]=Igneous01,[initiator]={[id]=16973313,},[id]=15,[IniTypeName]=Mi-8MT,[IniObjectCategory]=1,[IniUnitName]=SLCPilot51,[IniCategory]=1,[IniCoalition]=1,[time]=0,[IniDCSGroup]={[id_]=197,},[IniDCSUnitName]=SLCPilot51,[IniDCSUnit]=,[IniDCSGroupName]=TEST SLOT,},[3]=SLCPilot51,[5]=1,})