GetPlayerSlot

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
Donhomerj
Recruit Womprat Killer
Posts: 12
Joined: Sun Feb 17, 2019 5:55 am
Projects :: No Mod project currently.
Games I'm Playing :: SWBF2
xbox live or psn: No gamertag set

GetPlayerSlot

Post by Donhomerj »

Hi Guys, i am looking for a way to get the slot of an character, or unit.
Are there any functions known I could not find so far?

Thank you!
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: GetPlayerSlot

Post by Marth8880 »

What do you mean by the slot? What are you trying to do?
Donhomerj
Recruit Womprat Killer
Posts: 12
Joined: Sun Feb 17, 2019 5:55 am
Projects :: No Mod project currently.
Games I'm Playing :: SWBF2
xbox live or psn: No gamertag set

Re: GetPlayerSlot

Post by Donhomerj »

The players are set in a slot in the multiplayer. Like slot0 = me slot1 = "another user" slot2 = "a third one"
I want to identify them and track who killed who


EDIT
To specify this more:

Like I have a function OnCharacterDeath(killer, victim) in lua

I want to do something like
killers = {}
victims = {}

killers[someindex] = MagicNameOrIDExtractorIamLookingFor(killer)
killers[someindex] = MagicNameOrIDExtractorIamLookingFor(victim)

I expect a return value with either the slot like when I have 5 Players:
"player1", "player2", "player3", "player4", "player5"
like: 0, 1, 2, 3, 4 or the names of the players.

Is there some function I could not find so far? Or how would you solve this?
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: GetPlayerSlot

Post by Marth8880 »

IIRC the v1.3 patch docs come with some information on how to do things with player data. I've not had to deal with player data before, so I'd suggest having a look there. :)

Looks like it's here: "GameData\addon\AAA-v1.3patch\docs\howtos\Using Ingame Player Data.txt"
Donhomerj
Recruit Womprat Killer
Posts: 12
Joined: Sun Feb 17, 2019 5:55 am
Projects :: No Mod project currently.
Games I'm Playing :: SWBF2
xbox live or psn: No gamertag set

Re: GetPlayerSlot

Post by Donhomerj »

Thanks I think I can use that!
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: GetPlayerSlot

Post by [RDH]Zerted »

I believe killer and victim are already the character ids you're looking for, just be sure they aren't nil when you try to use them (suicides, player leaves server).

Humans/AIs are characters. When spawned, characters have units. Units are objects. Quickly searching, this topic may help understand how to work with them: http://gametoast.com/viewtopic.php?f=27 ... er#p204070 but I know there's better documentation out there.

You can get character's names using v1.3 features, but they aren't that useful since you can't display those names so there isn't much point. The only thing I know it was used for was admin-like features. Enter a map with a specific name and the script gives your character special boosts. It was used for banning specific people and some clan stuff. If you were trying to do advanced 3+ playable team things you could sort people into teams based on their name. Combine that with the profile renaming cheat code and people don't need to create new profiles when changing names.
Donhomerj
Recruit Womprat Killer
Posts: 12
Joined: Sun Feb 17, 2019 5:55 am
Projects :: No Mod project currently.
Games I'm Playing :: SWBF2
xbox live or psn: No gamertag set

Re: GetPlayerSlot

Post by Donhomerj »

What I exactly am looking for is a way to the playerslot or the playerhash.

I am syncing ingame values with the swbf2admin server software. But currently it is not possible for me to see which unit in the game currently belongs to which player, what I can address in the server software.
I am only able to read float values so far, so I need a number, that represents the players ingame.
Since each player has a slot in multiplayer assigned, I hoped I could use that as ID.

Btw. how is 1.3 coded?

Thanks for your help!
Post Reply