GoldenEye: Source Forums

  • December 02, 2024, 07:56:01 pm
  • Welcome, Guest
Advanced search  

News:

Pages: [1]   Go Down

Author Topic: [Bug] -Python function SetExcludedCharacters only allows frist 58 chars in list  (Read 18184 times)

0 Members and 1 Guest are viewing this topic.

null

  • Agent
  • *
  • Posts: 39
  • Reputation Power: 0
  • null is looked down upon.
  • Offline Offline

The function GEMPGameRules.SetExcludedCharacters(char_list * string) only allows the first 58 chars including commas, after that any characters will be ignored from the exclusion, example:

#58 characters between: (" AND ,oddjob will prevent oddjob and characters after from being excluded.
Code: [Select]
GEMPGameRules.SetExcludedCharacters("bond,boris,valentin,guard,jaws,infantry,Mishkin,Mayday    ,oddjob,ourumov,samedi,female_scientist,006_mi6")

#57 characters between: (" AND ,oddjob will prevent ourumov and characters after from being excluded.
Code: [Select]
GEMPGameRules.SetExcludedCharacters("bond,boris,valentin,guard,jaws,infantry,Mishkin,Mayday   ,oddjob,ourumov,samedi,female_scientist,006_mi6")

I'm not sure how to trace the code it its origin, but I'm guessing this is part of the main compiled code binary, which i have no access to.

Btw, what is the reference string for the "Random" character?

Thanks,
Null
Logged

null

  • Agent
  • *
  • Posts: 39
  • Reputation Power: 0
  • null is looked down upon.
  • Offline Offline

I noticed i can't edit my posts, but an after thought that characters can be confusing because I'm using two contexts

I mean string characters here:
Quote
#58 total characters between: (" AND ,oddjob
#57 total characters between: (" AND ,oddjob

I mean player selected characters here:
Quote
will prevent oddjob and characters after from being excluded.
will prevent ourumov and characters after from being excluded.

Sorry for the confusion.

Null
Logged

killermonkey

  • GES Programmer
  • Retired Lead Developer
  • GE:S Fanatic
  • *
  • Posts: 5,473
  • Reputation Power: 346
  • killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!killermonkey is awe-inspiring!
  • Offline Offline
    • DroidMonkey Apps

This function was not meant to exclude all the characters except for one. It was meant for one or two exclusions for gameplay reasons (like live and let die)
Logged

Entropy-Soldier

  • Managing Director
  • 00 Agent
  • ***
  • Posts: 506
  • Reputation Power: 372
  • Entropy-Soldier is awe-inspiring!Entropy-Soldier is awe-inspiring!Entropy-Soldier is awe-inspiring!Entropy-Soldier is awe-inspiring!Entropy-Soldier is awe-inspiring!Entropy-Soldier is awe-inspiring!Entropy-Soldier is awe-inspiring!Entropy-Soldier is awe-inspiring!Entropy-Soldier is awe-inspiring!Entropy-Soldier is awe-inspiring!Entropy-Soldier is awe-inspiring!Entropy-Soldier is awe-inspiring!
  • Offline Offline

Well I had a whole reply typed up to say basically that but KM beat me to it.  Ultimately the system was set up under the assumption the character exclusions would be minimal so the variable dedicated to it is only 64 bytes.

Anyway, "_random" is the identifier for the random character slot, but the exclusion list seems to be applied before it's added so putting it on there won't have any effect.  This is probably by design since this character slot is most likely expected to always exist.


Honestly for what you're trying to do I'd say just force everyone to be the desired character on spawn.  I guess we could add a python setting to bypass character select for occasions like this to make the presentation a bit cleaner, but functionally it would be the same.
Logged
"By reading this, you’ve done more than you can imagine." - Adrian

null

  • Agent
  • *
  • Posts: 39
  • Reputation Power: 0
  • null is looked down upon.
  • Offline Offline

i had to change my reply a little too since you're reply.  Luckily, I was planning on choosing characters specifically, but this was kinda driving me crazy because
Code: [Select]
player.SetPlayerModel()
has its own quirks.

Maybe just an update to the comment starting in GEMPGameRules.py #Line: 201 would be suitable.

Code: [Select]
def SetExcludedCharacters( char_list ):
    '''
    Exclude characters from being shown on the character select panel.
   
    char_list -- Comma seperated list of character identities (ex. "006_mi6,bond,samedi")
    '''

Thanks for the info guys!

Null
Logged

Entropy-Soldier

  • Managing Director
  • 00 Agent
  • ***
  • Posts: 506
  • Reputation Power: 372
  • Entropy-Soldier is awe-inspiring!Entropy-Soldier is awe-inspiring!Entropy-Soldier is awe-inspiring!Entropy-Soldier is awe-inspiring!Entropy-Soldier is awe-inspiring!Entropy-Soldier is awe-inspiring!Entropy-Soldier is awe-inspiring!Entropy-Soldier is awe-inspiring!Entropy-Soldier is awe-inspiring!Entropy-Soldier is awe-inspiring!Entropy-Soldier is awe-inspiring!Entropy-Soldier is awe-inspiring!
  • Offline Offline

Yeah, a more clear definition of the function's purpose is due at the very least, though it could conceivably be extended to include more characters as well.  We'll look at it for 5.1.


What quirks does SetPlayerModel() have?  I haven't looked at these functions much myself so I'd love to know if they could be improved.
Logged
"By reading this, you’ve done more than you can imagine." - Adrian

null

  • Agent
  • *
  • Posts: 39
  • Reputation Power: 0
  • null is looked down upon.
  • Offline Offline

Awesome, glad you ask, i have notifications turned off or i would have replied sooner. 

player.SetPlayerModel() was actually a little too much fun to test, because if you try and use it directly in OnPlayerSpawn without the right checks SetPlayerModel  and/or OnPlayerSpawn gets called like 20 times per player spawn, which will lead to a crash once the gameplay is reloaded with like 20 * player spawns. 

This works for teams though (ignore the name, color, levels, kills though):
Code: [Select]
import random 

#Track team levels and kills
        self.TEAM_SCORES = {
            Glb.TEAM_JANUS: {
                'name': "Janus",
                'color': "^r",
                'Levels': 0,
                'Kills': 0,
                'chars': ['boris', 'guard', 'infantry', 'ourumov', 'jaws', 'samedi', 'mayday', 'oddjob'],
                'random_char': random.choice (self.TEAM_SCORES[Glb.TEAM_JANUS]['chars'])
            },
            Glb.TEAM_MI6: {
                'name': "MI6",
                'color': "^i",
                'Levels': 0,
                'Kills': 0,
                'chars': ['bond', '006_mi6', 'female_scientist', 'mishkin', 'valentin'],
                'random_char': random.choice (self.TEAM_SCORES[Glb.TEAM_MI6]['chars'])
            }
        }

self.CreateCVar("ar_onecharperteam", "1", "Each team is assigned one character each. (Use 0 to disable)")

if player and player.GetTeamNumber() == Glb.TEAM_JANUS and not player.GetPlayerModel().lower() == self.TEAM_SCORES[Glb.TEAM_JANUS]['random_char'] and self.ar_onecharperteam == 1:
     player.SetPlayerModel(self.TEAM_SCORES[Glb.TEAM_JANUS]['random_char'], 0)
if player and player.GetTeamNumber() == Glb.TEAM_MI6 and not player.GetPlayerModel().lower() == self.TEAM_SCORES[Glb.TEAM_MI6]['random_char'] and self.ar_onecharperteam == 1:
     player.SetPlayerModel(self.TEAM_SCORES[Glb.TEAM_MI6]['random_char'], 0)
Logged
Pages: [1]   Go Up