Are the listed PVKII events still up to date and functional?

edited 9:24PM in Scripting
I edited the Superlogs: PVKII plugin to work for "Territory" gamemode. I used the gamemode_territory_capture event to reward all players who participated in a capture with points. I started a discussion on alliedmods.net, because the updated plugin didn't seem to work. A scripter fixed my syntax and told me that the event could be broken somehow.

The already included functions in Superlogs for the events chest_capture and player_objective work perfectly. The problem is:


So my questions are the following:
  1. Are the listed PVKII events still up to date?
  2. Did I choose the right "territory"-specific event and is it functional?

Comments

  • MadKatMadKat Senior
    edited January 2012
    I updated the Events page back in March of 2010. It could possibly be out of date.

    If I remember correctly, the event list is somewhere in the client's installation tree. I'm not seeing a copy on my server. Would you mind uploading the latest version here? I'd be happy to update the wiki as necessary.
    Programmer, Swashbuckler
    Author of PVKII Randomizer
    Author of PVKII WeaponsMaster
  • edited January 2012
    This one?

    //=========== (C) Copyright 1999 Valve, L.L.C. All rights reserved. ===========
    //
    // The copyright to the contents herein is the property of Valve, L.L.C.
    // The contents may be used and/or copied only with the written permission of
    // Valve, L.L.C., or in accordance with the terms and conditions stipulated in
    // the agreement/contract under which the contents have been supplied.
    //=============================================================================
    // No spaces in event names, max length 32
    // All strings are case sensitive
    //
    // valid data key types are:
    //   string : a zero terminated string
    //   bool   : unsigned int, 1 bit
    //   byte   : unsigned int, 8 bit
    //   short  : signed int, 16 bit
    //   long   : signed int, 32 bit
    //   float  : float, 32 bit
    //   local  : any data, but not networked to clients
    //
    // following key names are reserved:
    //   local	  : if set to 1, event is not networked to clients
    //   unreliable : networked, but unreliable
    //   suppress   : never fire this event
    //   time : firing server time
    //   eventid : holds the event ID
    "modevents"
    {
    "player_death"	// a game event, name may be 32 charaters long
    {
      "userid" "short"	// user ID who died  
      "attacker" "short"   // user ID who killed
      "assistid" "short"  // user ID of kill assister
      "weapon" "string"  // weapon name killed used
      "special" "bool"  // special attack
      "grail"  "bool"  // grail graced kill
      "suiassist" "bool"  // suicide assist
    }
    
    "player_changeteam"
    {
      "userid" "short"  // user ID who changed team
      "oldteam" "short"  // Team number of previous team
      "newteam" "short"  // Team number of new team
    }
    
    "player_changeclass"
    {
      "userid" "short"  // user ID who changed class
      "old_class" "short"  // class ID of old class
      "new_class" "short"  // class ID of new class
    }
    
    "player_spawn"
    {
      "userid" "short"  // user ID who just spawned
    }
    
    "player_objective"
    {
      "userid" "short"  // user ID of person who did objective
      "groupids" "string" // string of user IDs for a list of players doing an objective
      "assistid" "short"  // user ID of any assistant with objective (0 means unused)
      "enemyid" "short"  // user ID of possible enemy (0 means unused)
      "extra"  "string" // string of extra data that is placed in #EXTRA# section of the score string
      "text"  "string" // text to append to the userid's name ( The string is searched and uses: #I# is userid, #ASSIST# is assistid, and #ENEMY# is enemyid )
    }
    
    "player_points"
    {
      "userid" "short"  // user ID of person who gained points
      "points" "float"  // Points the user earned
      "sid"  "short"  // Score ID (These are the indices of the different specific scoring metrics, for example: killing someone who stole your chest recently)
    }
    
    "player_stats_updated"
    {
      "forceupload" "bool"
    }
    
    "player_nemesis"
    {
      "userid" "short" // user ID of player who caused the nemesis
      "victim" "short" // user ID of player who was the victim
    }
    
    "player_revenge"
    {
      "userid" "short" //user ID of player who achieved revenge
      "victim" "short" //user ID of player who was the nemesis
    }
    "npc_death"
    {
      "userid" "short"	// user ID whose parrot/npc died
      "attacker" "short"   // user ID who killed
      "weapon" "string"  // weapon name killed used
      "special" "bool"  // special attack
      "type"  "string" // classname of the npc entity (npc_parrot/npc_vulture)
    }
    
    "player_hurt"
    {
      "userid" "short"
      "health" "short"
      "priority" "short"
      "attacker" "short"
    }
    
    "player_special"
    {
      "userid" "short"  // user ID of player who used their special
    }
    
    "player_throw_explosive"
    {
      "userid" "short"  // user ID of player who tossed it
      "weapon" "string" // explosive type tossed (is the weapon name like powderkeg)
    }
    
    "player_bomb_explode"
    {
      "userid" "short"  // user ID of player who tossed it
      "victims" "string" // aray of chars representing user IDs of players who were hit (if any)
      "weapon" "string" // explosive type (is weapon name like powderkeg)
      "damage" "float"  // How much total damage was done
    }
    
    "player_melee_swing"
    {
      "userid" "short"  // user ID of player who swung
      "victims" "string" // array of chars representing user IDs of players who were hit (if any)
      "weapon" "string" // weapon that was swung
      "atkdir" "short"  // melee attack direction
      "damage" "float"  // how much damage was dealt total with the swing
      "hitper" "float"  // what percentage of the swing arc hit actual targets
    }
    
    "player_ranged_impact" //This also is fired when a powderkeg or chest hits a player. The weapon will be thrownkeg or chest
    {
      "userid" "short"  // user ID of player who fired
      "victim" "short"  // entindex of entity that was hit (if any)
      "weapon" "string" // weapon that was fired
      "damage" "float"  // how much damage was dealt, if 0 obviously missed or blocked by shield if victim is set
    }
    
    //For the next two events, to best detect these you would listen for the player_ranged_impact and trigger on your player's userid matching
    //store the victim id and then listen for a player_ranged_impale. If one comes within a short time with the same victim id you know it was your
    //player who impaled him and you will know what weapon was used.
    
    //It is the same for projectile_bounce just in reverse. You would listen for the bounce first then the player_ranged_impact if you wanted to know
    //that a player was ballin' and bounced the projectile off a surface for the kill
    
    "player_ranged_impale" //Fired when a player is impaled to a surface with a ranged weapon (only client-side)
    {
      "victim" "short"  // user ID of player who was impaled
    }
    
    "projectile_bounce" // Fired when a projectile has bounced off a surface
    {
      "userid" "short"  // user ID of player who shot this projectile
      "weapon" "string" // weapon that was fired
    }
    
    "player_healtheffect" // Fired when a player has a health effect applied to him, Food Pickups, Freebooter Poison
    {
      "userid" "short" // user ID of player who is having the health effect applied to
      "health" "float" // the health amount being added per second
      "duration" "float" // how long this effect will last. Total health change for this effect is (health * duration)
      "type"  "short" // type of the effect
    }
    
    "item_pickup"
    {
      "userid" "short" // user ID of player who picked up this item
      "type"  "short" // type of pickup, 0 = Food, 1 = Armor, 2 = Ranged Ammo (Since you have userid you can get specific type of armor/ammo from the team number of that player)
    }
    
    "chest_pickup"
    {
      "userid"  "short" // user ID of player who picked up the chest
      "chestid"  "short" // entity index of the chest that was picked up
      "last_owner" "byte"  // Team Number of the last owner of this chest; 2 = Pirates, 3 = Vikings, 4 = Knights (Last zone it was in essentially, if not in a zone initially it will be 1)
    }
    
    "chest_drop"
    {
      "userid"  "short" // user ID of player who dropped the chest
      "chestid"  "short" // entity index of the new chest that was dropped
      "oldid"   "short" // index of the old chest that was being carried. Chests get a new index every drop because of code to reduce latency in dropping them.
      "last_owner" "byte" // Team Number of the last owner of this chest; 2 = Pirates, 3 = Vikings, 4 = Knights (Last zone it was in essentially, if not in a zone initially it will be 1)
      "bashid"  "short" // user ID of the player (if any) that bashed the carrier to cause him to drop it
    }
    
    "chest_capture"
    {
      "userid"  "short" // user ID of player who captured this chest
      "chestid"  "short" // index of the chest that was captured
    }
    
    "chest_respawn"
    {
      "chestid" "short" // entity index of the chest that respawned back to its owner
    }
    
    "chest_special"
    {
      "userid"  "short" // user ID of player who initiated the special
      "chestid"  "short" // index of the chest that this special was performed with
    }
    
    "grail_pickup"
    {
      "team"  "short"  // Team whose trinket was picked up
      "userid" "short"  // user ID of player who picked up trinket
      "victim" "short"  // user ID of player who was killed to get trinket, otherwise 0
      "assistid" "short"  // user ID of player who assisted in killing the victim if was a non-kill pickup will always be 0
      "initial" "bool"  // true on round start
    }
    
    //Does not fire a drop if the carrier was killed and his attacker automatically recieved the grail because a grail_pickup will instead fire containing this same info except he will be the victim not userid.
    "grail_drop"
    {
      "userid" "short"  // user ID of player who dropped trinket
      "team"  "short"  // team of player who dropped trinket
      "killerid" "short"  // user ID of player who killed the trinket carrier
    }
    
    "grail_grace"
    {
      "userid" "short"  // user ID of player who is getting grace points
    }
    
    "grail_despawn"
    {
      "team" "short"   // team whose trinket despawned
    }
    
    "trinket_heal"
    {
      "team"  "short"  // team whose trinket this is
      "amount" "short"  // total amount healed to teammates by the trinket
    }
    "round_end"
    {
      "winner" "short"
    }
    
    "gamemode_suddendeath_begin" //Sudden Death has been entered in Last Team Standing
    {
      "plpirate" "short" // Number of players that are left alive
      "plviking" "short"
      "plknight" "short"
    }
    
    "gamemode_roundrestart" //The round is restarting
    {
      //Nada
    }
    
    "gamemode_firstround_wait_begin" // Fired when the game starts the Waiting for Players time period when first playing a new map
    {
    }
    
    "gamemode_firstround_wait_end" // Fired when the game ends the Waiting for Players time period when first playing a new map
    {
      "plpirate" "short" // Number of players on Pirates when this is fired
      "plviking" "short" // Number of players on Vikings when this is fired
      "plknight" "short" // Number of players on Knights when this is fired
    }
    
    "gamemode_territory_capture"
    {
      "userids" "string" // Each character is the user id of a player who captured it
      "team"  "short"  // Team that captured
      "tindex" "short"  // Territory that was captured
    }
    
    "gamemode_territory_guard"
    {
      "userid" "short"  // user ID of player getting guard points
    }
    
    "gamemode_territory_contested"
    {
      "pirates" "bool" // Are pirates in contest
      "vikings" "bool" // Are vikings in contest
      "knights" "bool" // Are knights in contest
    }
    "game_end"
    {
    }
    
    "update_mvp_panel"
    {
      "winner" "short"
      "pid_1"  "short"
      "pid_2"  "short"
      "pid_3"  "short"
      "pscore_1" "short"
      "pscore_2" "short"
      "pscore_3" "short"
      "pdmg_1" "float"
      "pdmg_2" "float"
      "pdmg_3" "float"
    }
    
    "spec_target_updated"
    {
    }
    
    "achievement_earned"
    {
      "player" "byte"  // entindex of the player
      "achievement" "short"  // achievement ID
    }
    
    "achievement_event_almost"
    {
      "achievement_name" "string"
      "my_val"   "short"
      "req_val"   "short"
    }
    
    "achievement_event"
    {
      "achievement_name" "string"
      "cur_val"   "short"
      "max_val"   "short"
    }
    }
    
  • MadKatMadKat Senior
    edited 9:24PM
    That's the one.

    The file looks like it agrees with what is on the wiki. It certainly looks like you got the right event.

    Does the event ever get fired? Or are the userids still just not working correctly.
    Programmer, Swashbuckler
    Author of PVKII Randomizer
    Author of PVKII WeaponsMaster
  • edited 9:24PM
    "McFlurry" suggested me to check the output of "userids" and, besides fixing a few things, added "PrintToChatAll ()".

    Here's his version:

    public Event_TerritoryCapture(Handle:event, const String:name[], bool:dontBroadcast)
    {
        new String:buffers[96][5]; //5 digits max in a userid by 16 which is >(256/(32/2)) + 16 semicolons
        new String:IDs[256];
        GetEventString(event, "userids", IDs, sizeof(IDs));
        PrintToChatAll(IDs);
        ExplodeString(IDs, ";", buffers, sizeof(buffers), sizeof(buffers[])); //I hope you know for sure that semicolons are the splitter
        for (new i=0; i<sizeof(buffers); i++)
        {
    	    LogPlayerEvent(GetClientOfUserId(StringToInt(buffers[i])), "triggered", "gamemode_territory_capture");
        }   
    } 
    


    Shouldn't it atleast output the string I received? Even if the function below would be wrong, it should print the string.
  • MadKatMadKat Senior
    edited 9:24PM
    It's still possible that the code is failing before the PrintToChatAll, though I would expect to see an error out in the server log.

    You can be totally sure by using the chat call at the beginning with a straight "TerritoryCapture called" event message.

    Also, just to be sure, is the event hooked properly?
    Programmer, Swashbuckler
    Author of PVKII Randomizer
    Author of PVKII WeaponsMaster
  • edited January 2012
    Yes, you're right. I put in a "PrintChatToAll ("Test")" and it worked. So the event itself seems to work.

    public Event_TerritoryCapture(Handle:event, const String:name[], bool:dontBroadcast)
    {
    	PrintToChatAll("Test"); // Works and gets printed after a territory capture!
    	new String:buffers[96][5]; //5 digits max in a userid by 16 which is >(256/(32/2)) + 16 semicolons
    	new String:IDs[256];
    	GetEventString(event, "userids", IDs, sizeof(IDs));
    	PrintToChatAll(IDs); // Doesnt work!
    	ExplodeString(IDs, ";", buffers, sizeof(buffers), sizeof(buffers[])); //I hope you know for sure that semicolons are the splitter
    	for (new i=0; i<sizeof(buffers); i++)
    	{
    			LogPlayerEvent(GetClientOfUserId(StringToInt(buffers[i])), "triggered", "gamemode_territory_capture");
    	}  
    }
    
  • MadKatMadKat Senior
    edited 9:24PM
    That's very interesting. Well, at least we know the bug is somewhere that we can fix it. I'll try to debug it after work if you haven't already solved it.
    Programmer, Swashbuckler
    Author of PVKII Randomizer
    Author of PVKII WeaponsMaster
  • edited January 2012
    No, just try it - if you got some time to do so. It's 1:30am here and I'll head to bed soon.


    Edit:

    McFlurry: "So that means that the userids string is never filled by the event. I would contact the mod developers about that."

    Either the code is wrong or the reason above.
  • CrackaPollyCrackaPolly PVKII Team, Authorized Creator
    edited January 2012
    Any of the lists of players are entindices, I never updated the comments :{

    They were originally to be userid's but they can go out of bounds of a char size while player entindices will not at our player limits

    Also there is no delimiters in this string. Each character of the string should be converted to its integer value and you will have the entindex of the player. It is more than likely that most output of this data as a string will be gibberish as 33 or so down to 1 will be the contents of each character (0 also means that the end of the list has been reached as player entindices start at 1

    Player Objective is only used by the death notice hud to display notices to the hud about objectives. So only score events that are showing something there will output player_objective event

    For tracking doing objective related things there is player_points which can work. I will add the enum for what each score id is for next patch in the comments, but I can post it here when I am home. Anytime someone triggers a score type the player_points will fire with the id of the score type triggered.
  • edited January 2012
    Do the "Score IDs" belong to points for killing, dying, completing objective?

    We are already able to log all current objectives, including a territory capture.

    My intention was to separate the points in "Territory" from the ones in "Booty" and other objectives.
  • CrackaPollyCrackaPolly PVKII Team, Authorized Creator
    edited January 2012
    Yes the player_points is the underlying system that is generating the score and populating the scoreboard for instance, although not using the event as it is not such a cheat safe way to do so. Event was mainly for future plans for stats, and for some of the achievements

    Here are the scoretypes


    Unknown = -1
    Kill = 0
    Assist = 1 (and so on...)
    Death = 2 (A death where the player isn't penalized)
    Suicide = 3(A death where the player is penalized) (I think there is a rare case this will trigger falsely because trigger_falldeath can be set to not cause suicides in which case the trigger_falldeath just decrements this score type so the player_points for the suicide still gets sent out even though it technically should not)
    Kill A Chest Thief Bonus = 4
    Assist Killing A Chest Thief Bonus = 5
    Return A Stolen Chest = 6
    Stealing A Chest = 7 (Grabbing a chest that doesn't belong to you, has some logic to prevent exploiting it, so won't fire multiple times on the same chest or in a short time)
    Capture A Chest = 8 (Putting a chest that didn't belong to you into your chest zone)
    Capturing A Territory = 9
    Protecting A Territory = 10 (Essentially standing around the territory)
    Kill An Enemy In An Owned Territory Bonus = 11
    Assist Killing An Enemy In An Owned Territory Bonus = 12
    Kill An Enemy In An Enemy Territory Bonus = 13
    Assist Killing An Enemy In An Enemy Territory Bonus = 14
    Grabbing A Trinket = 15
    Killing A Trinket Carrier Bonus = 16
    Assist Killing A Trinket Carrier Bonus = 17
    Staying With Your Trinket Carrier Bonus = 18
    Killing An Enemy With Trinket Graces Bonus = 19
    Assist Killing An Enemy With Trinket Graces Bonus = 20
    Trinket Carrier Bonus For Kills Under His Graces = 21
    Nemesis Bonus = 22 (Nemesis gives 0 points, it is mainly there for tracking in scoreboard and a logic vessel for the system)
    Revenge Bonus = 23 (Revenge occurs if the enemy killed in LTS has a gold coin in the scoreboard, which is gained when they kill you in a previous round [if the kill was not a revenge kill])
  • edited January 2012
    Painis
Sign In or Register to comment.