Jump to content

Handler not triggered?


Recommended Posts

Hi, I made this chunk:

 

DC_AMVI.addF10menu = {}
function DC_AMVI.addF10menu:onEvent(event)
	if event.id == S_EVENT_PLAYER_ENTER_UNIT then	--world.event.S_EVENT_BIRTH 

		if debugProcess == true then
			env.info(("DAWS AIE Logistic: detected BIRTH event"))
		end
	
		local init_name 		= event.initiator:getPlayerName()

		if init_name then	
			local init_group		= event.initiator:getGroup()
			local init_group_id		= init_group:getID()
			local init_group_name	= init_group:getName()

			if debugProcess == true then
				env.info(("DAWS AIE Logistic: adding f10 menù for group ID: " .. init_group_id))
			end				
			commandDB[init_group_name] = missionCommands.addCommandForGroup(init_group_id, "DAWS - Get Available fuel & ammo", nil, retrieveLogTable, {unit = event.initiator, groupName = init_group_name, groupID = init_group_id})
		end
	end
end
world.addEventHandler(DC_AMVI.addF10menu)

 

that should start each time a player enter an helicopter.

I tested that in single player and it doesn't work (the env.info call isn't showed in dcs.log.

 

What am I doing wrong?

 

PS:

DC_AMVI table exist.

 

PS2:

in log , only if I test it in MP environment, I can see this:

Scripting: event:type=under control,initiatorPilotName=AMVI_Chromium,target=Chevy 1.1,t=43200,targetMissionID=2,

Edited by chromium

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Link to comment
Share on other sites

bump :)

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Link to comment
Share on other sites

From my experience using this, this event does not fire in single player (but I would need to confirm if that's still the case).

 

This fires when you have selected a slot in multiplayer, and have clicked the button where you are physically put into an airframe.

 

If you need this mission to work both in SP and MP, I think you'll need to handle the S_EVENT_BIRTH in SP and call your code above. Otherwise use S_EVENT_PLAYER_ENTER_UNIT in MP. I don't think there is a way to check using DCS script if current mission is Multiplayer or not (you can do this in a mod however).

Developer of Kaukasus Insurgency - a customizable Dynamic PvE Campaign with cloud hosting and stats tracking. (Alpha)

 

http://kaukasusinsurgency.com/

Link to comment
Share on other sites

thanks.

also found the issue: it doesn't work for me using S_EVENT_BIRTH but using the number of event.id (15).

 

didn't understood why..

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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