Editing and Customization > Modding Help

[Solved] How To Obtain Match Results During & After Each Match?

<< < (2/3) > >>

killermonkey:
Snippet is not enough. Is parent defined? Perhaps you should use self.

Self.RegisterEventHook

Phivex:
Ah. Yup. Changing "parent" to "self" fixed it and I was able to incorporate my other code. I also had to add "from GEGlobal import EventHooks". I was thinking the regular "import GEGlobal" would've been fine, but it didn't cut it. I was able to port my other code over. Thanks for the help!

Any idea how to get the current map and after match awards (e.g. "Where's the Armor", "Most Frantic", etc.)? I have all the data I want EXCEPT for that. I've been racking my brain trying to find it.

Edit: Integrating an event hook makes this code work for any game mode.

killermonkey:

--- Quote from: Phivex on September 18, 2016, 02:30:20 pm ---I also had to add "from GEGlobal import EventHooks". I was thinking the regular "import GEGlobal" would've been fine, but it didn't cut it.

--- End quote ---

This is because Python respects namespaces unlike C# (the one thing I hate about C# actually). If you import a module, you have to prepend the module name if you want to use any functions defined in it (i.e., GEGlobal.EventHooks.GP_PLAYERKILLED). You can also import all names into your current namespace (not recommended) by doing from GEGlobal import *.

The awards are not transmitted to python, unfortunately. We never intended python to be used for stat tracking, though its not a bad idea to start doing that!

Phivex:

--- Quote ---The awards are not transmitted to python, unfortunately. We never intended python to be used for stat tracking, though its not a bad idea to start doing that!
--- End quote ---


* That's what I'm currently attempting to implement, stat tracking. Once I'm done, I'll post the code if you want.
* Is the current map transmitted to python? I was hoping to use that in the stats too.
* I'm glad you mentioned implementing an event hook. I was able to create another one that gets the after round results. I noticed there isn't an event hook for a match, though, but there are a couple for round begin and end. Is an event hook for matches something that is on the roadmap?
* What about event hooks for non-deathmatch game modes like "blue flag grabbed", "blue flag captured", etc. for CTF, "weapon level change" for Arsenal, "golden gun obtained" for MWGG, and others? Are those things that are on the roadmap? If not, maybe there's another way I can easily get that info? I know I can go into each "..\GamePlay\<GameMode>.py" file and make additions there, but I guess now that you have me on the event hooks I'm kinda hooked on them (pardon the pun). Plus, the upkeep and organization of that would look horrible.

killermonkey:
Match end triggers OnRoundEnd. You can check that is the match end by using IsGameOver() function. https://github.com/goldeneye-source/ges-python/blob/master/stubs/GEMPGameRules.py#L147

You could implement your own event hooks for each game mode pretty easily, but to make it generic would take a significant effort. A good idea though if we were to implement stats in python.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version