Page 1 of 1

GetPlayerSlot

Posted: Wed Nov 27, 2019 10:15 am
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!

Re: GetPlayerSlot

Posted: Thu Nov 28, 2019 10:32 am
by Marth8880
What do you mean by the slot? What are you trying to do?

Re: GetPlayerSlot

Posted: Sat Nov 30, 2019 10:01 am
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?

Re: GetPlayerSlot

Posted: Sat Nov 30, 2019 4:28 pm
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"

Re: GetPlayerSlot

Posted: Sat Dec 07, 2019 7:12 am
by Donhomerj
Thanks I think I can use that!

Re: GetPlayerSlot

Posted: Wed Dec 11, 2019 4:15 pm
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.

Re: GetPlayerSlot

Posted: Wed Dec 25, 2019 9:26 am
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!