Kleinbart Posted March 27, 2021 Posted March 27, 2021 Hi folks, I am building a multiplayer mission. In this context I need to know the unit name of my own aircraft. The function must have the correct unitname depending on the player who calls the function. I have done it with: Unit.getByName(Unit.getPlayerName()) but of course this does not work. Does anyone have a solution? Thanks.
Kleinbart Posted March 28, 2021 Author Posted March 28, 2021 I may have expressed myself in a complicated way. In the multiplayer mission there are 10 aircraft which can be selected by the players. Group1: AircraftPlayer-1 Unit name: AircraftPayer-1-1 to AircraftPayer-1-5 Group2: AircraftPlayer-2 Unitname: AircraftPayer-2-1 to AircraftPayer-2-5 Both groups are in the same coalition.For example, my friend takes Aircraft-2-4 and I take Aircraft-1-2. In the mission, players can query the distance to a specific target. But for that I need to know that my friend is in Aircraft-2-4 and I am in Aircraft-1-2. When my friend retrieves the distance, his is calculated, when I retrieve the distance, mine is calculated. Therefore I am looking for a query in the form of: Unit.getByName('CurrentPlayer')
Grimes Posted March 29, 2021 Posted March 29, 2021 There is no "current player" type of parameter. I assume you are using mission commands to query the distance. Annoyingly the smallest those go is at a group level, so you have two options. 1. Make each client their own group, and create mission commands for each group passing the groupId that called it to the function for checking the distance. 2.Add a submenu for each client to correspond with whatever commands you want. The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
Kleinbart Posted March 29, 2021 Author Posted March 29, 2021 Thanks for your answer. With variant 1 it works for me.
Recommended Posts