GetDotaStats / stat-collection

Library for setting up stat collection for dota2 mods
http://getdotastats.com/
GNU General Public License v2.0
11 stars 8 forks source link

[SCHEMA] Invasion of zombie #85

Open Gichik opened 8 years ago

Gichik commented 8 years ago

console_log_invasion.txt

invasion_files.zip

jimmydorry commented 8 years ago

Can't do this from my iPad. @SinZ163 want to have a look in my stead? I'm boarding a plane in a few hours.

Gichik commented 8 years ago

Nothing, I'm not in a hurry :)

Gichik commented 8 years ago

So, what about schem?

jimmydorry commented 8 years ago

Landed a few hours ago, and have just woken up. Let's have a look.

In the future, I highly recommend throwing your four files onto hastebin or pastebin, so they can be easily accessed.

jimmydorry commented 8 years ago

I would highly recommend having a variable for each slot, instead of doing the concatenated list.

Up to you though.

function GetItemSlot(hero, slot) versus function GetItemList(hero)

I've added both schemas, so pick the one you want and let me know so I can reject the other:

You grab the schemaID from: https://getdotastats.com/#s2__my__mods

Gichik commented 8 years ago

Oh, thank you very much!

I generally do not care, and you advise the second option? (Sorry for my bad enlgish)

jimmydorry commented 8 years ago

Yes, advise the second. The first will make a lot of combinations that can't be filtered down efficiently.

Gichik commented 8 years ago

Well, I understand, it is enough for me to abandon the function GetItemList(hero), instead of a variable "il" to have a few (i1,i2 ...) and send them through name GetItemName()?

Or write a function that will return precisely handle things?

jimmydorry commented 8 years ago

The function already exists. Check the utililities.lua in the lib folder under stat-collection.

https://github.com/GetDotaStats/stat-collection/blob/master/game/dota_addons/YOUR_ADDON/scripts/vscripts/statcollection/lib/utilities.lua

-- String of item name, without the item_ prefix
  function GetItemSlot(hero, slot)
    local item = hero:GetItemInSlot(slot)
    local itemName = ""

    if item then
        itemName = string.gsub(item:GetAbilityName(), "item_", "")
    end

    return itemName
end
Gichik commented 8 years ago

I should use it or GetItemName(hero, slot) ?

They seem to be the same:

function GetItemName(hero, slot) local item = hero:GetItemInSlot(slot) if item then local itemName = item:GetAbilityName() itemName = string.gsub(itemName, "item", "") --Cuts the item prefix return itemName else return "" end end

jimmydorry commented 8 years ago

Yea, whatever floats your boat. At the end of the day, they are your stats, and as long as they aren't creating a burden on the shared resources of the server, then I don't mind too much.

Gichik commented 8 years ago

Well, I send you the new schema file?

jimmydorry commented 8 years ago

For archiving purposes yes. If it matches that second schema, then you're ready to go.

Gichik commented 8 years ago

Yes, I used the GetItemSlot (hero, slot) Now I send.

Gichik commented 8 years ago

If i right understand:

http://hastebin.com/ceyovalahu.lua

jimmydorry commented 8 years ago

What about slot 6? lol

Gichik commented 8 years ago

Oh, right :D I forgot

Gichik commented 8 years ago

http://hastebin.com/uyadoyawic.lua

jimmydorry commented 8 years ago

and it's 0 based, like the rest of LUA.

i1 = slot0, i2 = slot1

LoD does their stats differently, but here's the relevant part:

https://github.com/LegendsOfDota/LegendsOfDota/blob/master/src/scripts/vscripts/pregame.lua#L333

jimmydorry commented 8 years ago

Here's another example: https://github.com/fcalife/dota_imba/blob/developer/game/dota_addons/dota_imba/scripts/vscripts/statcollection/schema.lua#L86

Gichik commented 8 years ago

Yeah, right, I have not woken up :))

http://hastebin.com/apukazayul.lua

Gichik commented 8 years ago

Well, if that's all, then once again thank you and good day for you.

jimmydorry commented 8 years ago

No problem. Thanks for putting up with me. Been awfully busy as of late. :(

jimmydorry commented 8 years ago

Oh, and I see that the majority of your games aren't finishing. If you have dedi's you will want to check that you actually end games by setting a teamWinner.

Games that don't finish don't get end of game stats.

@SinZ163 can weigh in if it's not a simple case of setting the team as winner.

Gichik commented 8 years ago

I have bad englesh, what is dedi?

In some my games people just leave, becouse all die or another problems.

jimmydorry commented 8 years ago

official dedicated servers.

If your games have Valve official hosting, then all games play to the end. Without dedicated servers, they don't end if the person hosting the game rage quits.

Gichik commented 8 years ago

Oh, yes, i have dedi.

Hmmm, ok, i try to see. Maybe the problem is in my sometimes inaccurate code.

jimmydorry commented 8 years ago

Let us know if you need help. It appears to work about 40% of the time. You must have some unexpected condition that causes this. Figure out all the winning and losing posibilities and see how they are covered. Make sure you don't use the SetTeamLoser (don't remember the exact name) function.

Gichik commented 8 years ago

In one map, I counted a victory if the NPC will not die for 24 minutes.

The other two - if for 20 minutes all not die.

In both cases, it is time dependent. And, I do not check the situation where everyone can leave.

I use SetGameWinner(), and also in one in Hammer in npc_dota_base use SetGameWinner then this entity die.

jimmydorry commented 8 years ago

Looks like you found the cause, very quickly.

You may want to look at how we wait for game states, and add some logic in your main LUA file similar to ours. You should add a detection for game state entering post_game (DOTA_GAMERULES_STATE_POST_GAME), and setting victory for the NPC team if it reaches this state before your time limit.

https://github.com/GetDotaStats/stat-collection/blob/master/game/dota_addons/YOUR_ADDON/scripts/vscripts/statcollection/lib/statcollection.lua#L170

jimmydorry commented 8 years ago

@SinZ163 found these, to further corroborate that post_game is the best place to be checking for this. There is no in-between state from start of game and end of game.

https://github.com/ModDota/API/blob/master/dota_enums.d.ts#L14

I'm off for now. Holler if you need help. There is no particular rush to fix this, but your stats won't be very representative until you do.

Gichik commented 8 years ago

I'm sorry, I do not quite understand: After the death of the NPC, I have to check stage game and if this a POST_GAME then set winner?

Or after the death of the NPC to establish the winner and also in a POST_GAME?

jimmydorry commented 8 years ago

Just set a listener to check if the game state changes. If the game state changes to post game before your time limit of 20mins, then set the NPC team (or any team that does not have real players on it) as the winners.

Gichik commented 8 years ago

ohh, ok, thanks