Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.

New to the forum? Say hello in this topic! Also make sure to read the rules.

We should be able to get the team from the IUser

Here you can find ScriptAPI suggestions implemented in the game.
Forum rules
By using the forum you agree to the following rules.
Locked
MrAnyone
Meatbag
Posts: 8
Joined: Wed May 18, 2016 1:44 pm
SFD Account: MtMercer
Gender:
Age: 19

We should be able to get the team from the IUser

Post by MrAnyone » Mon Jan 15, 2018 1:01 am

I'm making an map script and I noticed that I can't get this information from the game script interface:

Image

Is there any way to get the user team? I need this to persist the teams in an map that I'm making.

This can be added to the IUser interface, since the player already have an (in game current) getTeam.

Code: Select all

interface IUser {
    PlayerTeam GetTeam();
}
The GetTeam() method above would return the game team (team that it need to respawn), not the IPlayer team.

Another questions, why Game.CreatePlayer() doesn't persists the team from the game settings? It always spawns a new player using the independent team.

I'm current limited by that, thanks for reading! I'm waiting a response.
0 x

User avatar
JakSparro98
Superfighter
Superfighter
Posts: 375
Joined: Fri Jul 15, 2016 7:56 pm
Started SFD: PreAlpha 1.0.5
Location: Rome, Italy
Gender:
Age: 20

Post by JakSparro98 » Mon Jan 15, 2018 12:04 pm

MrAnyone wrote:
Mon Jan 15, 2018 1:01 am
I'm making an map script and I noticed that I can't get this information from the game script interface:

Image

Is there any way to get the user team? I need this to persist the teams in an map that I'm making.

This can be added to the IUser interface, since the player already have an (in game current) getTeam.

Code: Select all

interface IUser {
    PlayerTeam GetTeam();
}
The GetTeam() method above would return the game team (team that it need to respawn), not the IPlayer team.

Another questions, why Game.CreatePlayer() doesn't persists the team from the game settings? It always spawns a new player using the independent team.

I'm current limited by that, thanks for reading! I'm waiting a response.
The IUser class only keep track of real players interfaces, you can specify the entity they will controll but everything else (health, team, world position, etc...) is handled by the IPlayer class.

Since you're trying to set players teams with /SETTEAMS command, the changes will be applied next round, that's why you can see an arrow with a number of a team, but technically the player team is still the same untill a new round begins.

I guess you will find more usefull the possibility to perform custom commands by reading the chat through scripts, an already planned feature that brings unlimited uses and also may solve your needs to change something (script behaviour, game objects, etc...) during runtime, you can read about ScriptAPI changes here.
1 x

MrAnyone
Meatbag
Posts: 8
Joined: Wed May 18, 2016 1:44 pm
SFD Account: MtMercer
Gender:
Age: 19

Post by MrAnyone » Mon Jan 15, 2018 11:15 pm

The IUser class only keep track of real players interfaces, you can specify the entity they will controll but everything else (health, team, world position, etc...) is handled by the IPlayer class.

Since you're trying to set players teams with /SETTEAMS command, the changes will be applied next round, that's why you can see an arrow with a number of a team, but technically the player team is still the same untill a new round begins.

I guess you will find more usefull the possibility to perform custom commands by reading the chat through scripts, an already planned feature that brings unlimited uses and also may solve your needs to change something (script behaviour, game objects, etc...) during runtime, you can read about ScriptAPI changes here.
Oh, so the IUser can't have a team, that I understood.

Now, I think that what I really need is get the current teams settings. Or, in a more generic approach, get the server game info. Is there any way to do that?

I'll explain what I need to do if it helps you clarify what I'm asking:
  • It's an arena map, every time a player dies, it goes to a lobby.
  • When the player selects a kit. I need to know what team the /setteams command gives for the user ID. It's sequential if /setteams 10000000, user with ID 0 will have the team 1 (blue).
  • Suppose that I create (respawn) a player. The player comes with team 0, how do I get the game settings to give him the correct one? It's impossible currently.
Thanks for the response! I liked the currently scriptAPI planned features.
0 x

User avatar
JakSparro98
Superfighter
Superfighter
Posts: 375
Joined: Fri Jul 15, 2016 7:56 pm
Started SFD: PreAlpha 1.0.5
Location: Rome, Italy
Gender:
Age: 20

Post by JakSparro98 » Mon Jan 15, 2018 11:52 pm

MrAnyone wrote:
Mon Jan 15, 2018 11:15 pm
The IUser class only keep track of real players interfaces, you can specify the entity they will controll but everything else (health, team, world position, etc...) is handled by the IPlayer class.

Since you're trying to set players teams with /SETTEAMS command, the changes will be applied next round, that's why you can see an arrow with a number of a team, but technically the player team is still the same untill a new round begins.

I guess you will find more usefull the possibility to perform custom commands by reading the chat through scripts, an already planned feature that brings unlimited uses and also may solve your needs to change something (script behaviour, game objects, etc...) during runtime, you can read about ScriptAPI changes here.
Oh, so the IUser can't have a team, that I understood.

Now, I think that what I really need is get the current teams settings. Or, in a more generic approach, get the server game info. Is there any way to do that?

I'll explain what I need to do if it helps you clarify what I'm asking:
  • It's an arena map, every time a player dies, it goes to a lobby.
  • When the player selects a kit. I need to know what team the /setteams command gives for the user ID. It's sequential if /setteams 10000000, user with ID 0 will have the team 1 (blue).
  • Suppose that I create (respawn) a player. The player comes with team 0, how do I get the game settings to give him the correct one? It's impossible currently.
Thanks for the response! I liked the currently scriptAPI planned features.
Very few things are impossible with current classes provided by the ScriptAPI, there is a simple solution for what you asks.

When a player dies you can save his instance in a custom object, then when it's time to respawn him you can read data from this object wich contains the user that was controlling the player, what his team was, and so on.
Now that the user is reassigned a new player with same profile, same team, etc. you only need to read the sender team when some one press a button in the lobby.

I simplified the steps just for giving you an idea of how this system works with scripts, if you need some code, no problem, me and the scripters community will help you with pleasure.
1 x

MrAnyone
Meatbag
Posts: 8
Joined: Wed May 18, 2016 1:44 pm
SFD Account: MtMercer
Gender:
Age: 19

Post by MrAnyone » Tue Jan 16, 2018 3:11 am

I already did that, but there is a problem, when a new player logs in into the server, I can't get "what is his team on /setteams".

Code that I'm working on: https://pastebin.com/z1hXynLC
I know it is kinda messed up, like old "Utils.settimers", I'm working in this code since like, 2016 but I never had time to properly finish it.

Line 776 has a persistentTeam variable from the DynamicUser class. Line 787 assigns it, the problem about new players is that when someone logs in they doesn't spawn automatically and the team assigned to the player when I use the respawn() method (line 876) is 0.

So even when doing that the script can't dynamically assign the teams.

If the host decides to keep the teams all 0 in the middle of the game, only in the next round the script will "figure out" the correct teams to use.

Thanks for the feedback!
me and the scripters community will help you with pleasure.
This is what makes this community great.
0 x

User avatar
Gurt
Lead Programmer
Lead Programmer
Posts: 1284
Joined: Sun Feb 28, 2016 3:22 pm
Title: Lead programmer
Started SFD: Made it!
Location: Sweden
Gender:
Age: 28

Post by Gurt » Sun Mar 11, 2018 1:14 pm

Added IUser.GetTeam() (If this user isn't controlling any player the current team assigned in the lobby will be returned.)
Added IUser.GameSlotIndex property (Gets the game slot index (lobby slot index) this user occupies.)
Available after Beta 1.0.2c
2 x
Gurt

Locked

Who is online

Users browsing this forum: No registered users and 1 guest