ESAc_matador Posted May 10, 2017 Share Posted May 10, 2017 I have an issue with this... I made script, works fine in single player, I made this as a test... assaulthelo({"gato 2", "gato 3","gato 4"}, "helicargo1", {"bat1", "bat2"}) assaulthelo({"gato 2", "gato 3","gato 4"}, "helicargo2", {"bat1", "bat2"}) where helicargo1 and 2 are the pilots names... In the scripts there are commands, but if you enter the cockpit after the script is executed.... you dont have the commands. I suppose it does not detect you entering the cockpit... how can I solve it?? i tried a lots of things, but I dont understand the event handlers... shouldnt this work?? function assaulthelo(transportable, helicoptercommander, batery) _Helo = Unit.getByName(helicoptercommander) if _Helo == nil then return else .... Link to comment Share on other sites More sharing options...
ESAc_matador Posted May 10, 2017 Author Share Posted May 10, 2017 after long hours trying I finnally got it. I did this function heloscript(transportable, helicoptercommander, batery) local _unit = Unit.getByName(helicoptercommander) if _unit ~= nil and _unit:isExist() == true then assaulthelo(transportable, helicoptercommander, batery) end heloHandler = {} function heloHandler:onEvent(event) if event.id == world.event.S_EVENT_BIRTH then local helo = event.initiator local heloname = helo:getName() if heloname == helicoptercommander then assaulthelo(transportable, helicoptercommander, batery)--this is the real funciton!!! heloHandler = {} end end end world.addEventHandler(heloHandler) end heloscript({"gato 2", "gato 3","gato 4"}, "helicargo1", {"bat1", "bat2"}) heloscript({"gato 2", "gato 3","gato 4"}, "helicargo2", {"bat1", "bat2"}) [\code] Link to comment Share on other sites More sharing options...
Recommended Posts