Scripts do not work for Dedicated Server - Printable Version +- Comrades in Arms Discussion Board (http://forum.ciahome.net) +-- Forum: Comrades in Arms Life (http://forum.ciahome.net/forumdisplay.php?fid=3) +--- Forum: Mission Making (http://forum.ciahome.net/forumdisplay.php?fid=8) +--- Thread: Scripts do not work for Dedicated Server (/showthread.php?tid=2240) |
Scripts do not work for Dedicated Server - Behemeth - 08-22-2012 Hello all, I'm trying myself on a mission which works ok for SP and MP on non-dedicated servers. When playing on dedicated server some scripts don't work as intended though. 1) The players start inside an aircraft. I add the following script with addAction to allow a HALO jump Code: _requestingUnit = _this select 1; This works ONLY with those sleeps. Whereas in SP/MP-non-dedicated it also works without the sleeps. Now I'm confused on the one hand because I do not know why I need those and worried on the other hand because I don't know if other (slower) dedicated server might need longer sleeps. I would be grateful for any insight in that. 2) It is also possible that there are some AIs in the slots. Since they are stupid and would never reach their destination if I would let them HALO I place them near the landing area Code: if(isServer) then This does work for SP/MP-non-dedicated but not for dedicated server. The parachutes are created, but the AIs just drop out of the aircraft and fall to death. Thanks for any help on that Behemeth Re: Scripts do not work for Dedicated Server - Behemeth - 08-23-2012 OK for the second problem: 1) for whatever reason I need to execute setPos twice 2) moveInDriver has to be executed local to unit this results in the following working but ugly code: Code: // remove AIs from the plane when reaching the jump zone Any suggestion on how to make the code nicer would be greatly appreciated As well as an answer regarding the sleep issue Re: Scripts do not work for Dedicated Server - wolfenswan - 08-24-2012 Quote: 2) It is also possible that there are some AIs in the slots. Since they are stupid and would never reach their destination if I would let them HALO I place them near the landing area Are the AI on their own or in the same group as the player? Edit: Nevermind, you found a solution. As for Quote:[size=78%]Any suggestion on how to make the code nicer would be greatly appreciated[/size] Welcome to Arma scripting. There's no such thing as nice code here. Re: Scripts do not work for Dedicated Server - mikey - 08-24-2012 Whenever you work with player objects, as you do with your addAction and such, you need to make sure the variable is assigned the proper value when in a dedicated environment. Also some commands in ArmA can only be used when the game is running (time > 0). So to fix future problem 1's, add this to the top of the script: waitUntil { !(isNull player) }; waitUntil { time > 0 }; You really should read up on MP scripting and JIP on the biki if you want scripts to work in a dedi env. For problem 2, like wolf said, welcome to ArmA scripting. When I create stuff I usually run stuff line by line in my debugger to see what works and what doesn't in that situation, and all the stuff that works gets pasted in a file. It's not very common that you can just script an entire file without doublechecking the effects of every line of code in a debugger. |