Jump to content

Recommended Posts

Posted

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.

Posted

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')

 

Posted

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 ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

  • Recently Browsing   0 members

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