Archived copy of war3source.com, the War3Source forum (2009–2020), rebuilt from the Internet Archive by wc3mods.net. This page was captured on 2012-10-25 (original capture). Forum · All archived topics · Wiki · Bug tracker · Blog
Chat

War3:Source
October 24, 2012, 10:56:47 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Download: http://war3source.com/index.php?board=9.0
What is War3Source?: http://war3source.com/index.php?topic=200.0
Sample Stats: http://war3source.com/war3stats
Steam Community Group: http://steamcommunity.com/groups/war3source
War3Source SVN Checkout: http://ownageclan.com/svn/war3source/
War3Source servers: http://www.game-monitor.com/search.php?vars=war3_version=
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: XP gain for Medics Uber  (Read 373 times)
iceman
Full Member
***
Posts: 162



View Profile
« on: December 08, 2010, 05:28:59 PM »

Xp bonus when a medic ubers would be sweet
Logged
Glider⠠⠵
Global Moderator
Sr. Member
*****
Posts: 413


⠠⠵


View Profile
« Reply #1 on: December 09, 2010, 12:56:34 AM »

Untested. This is from a addon I was writing to hook several tf2 only events and award XP for them but I ran into some trouble and gave up.
Code:
#pragma semicolon 1
#include "W3SIncs/War3Source_Interface"

public OnPluginStart()
{
if(War3_GetGame() != Game_TF){
SetFailState("Only works in TF2");
}
else
{
HookEvent("player_chargedeployed", PlantedUber);
}
}

public PlantedUber(Handle:event, const String:name[], bool:dontBroadcast)
{
new medic = GetClientOfUserId(GetEventInt(event, "userid"));
awardEXP(medic, 25);
PrintHintText(medic, "You gained 25 EXP for deploying an uber.");
}

public awardEXP(client, amount)
{
new race = War3_GetRace(client);
new totalXP = War3_GetXP(client, race) + amount;
War3_SetXP(client, race, totalXP);
}

In case anyone wants to pick the full thing up:

Code:
#pragma semicolon 1
#include "W3SIncs/War3Source_Interface"  

public Plugin:myinfo =
{
name = "War3Source - TF2 EXP Addon",
author = "Ted Theodore Logan",
description = "Give exp for various TF2 only things",
version = "1.0",
};

public OnPluginStart()
{
if(War3_GetGame() != Game_TF){
SetFailState("Only works in TF2");
}
else
{
HookEvent("object_destroyed",ObjectDestroyed);
HookEvent("player_chargedeployed", PlantedUber);
HookEvent("player_upgradedobject", UpgradedBuilding);
HookEvent("player_extinguished", Event_player_extinguished);
}
}

public ObjectDestroyed(Handle:event, const String:name[], bool:dontBroadcast)
{
new attacker = GetEventInt(event, "attacker");
new assister = GetEventInt(event, "assister");
new objectType = GetEventInt(event, "objecttype");
new bool:IncompleteStructure = GetEventBool(event, "was_building");
new awarded;

if(ValidPlayer(attacker))
{

switch(objectType)
{
case 0: // Dispenser
{
awarded = 20;
}
case 1: // Teleporter, both entry and exit
{
awarded = 30;
}
case 2:  // Sentry
{
awarded = 35;
}
}

if(IncompleteStructure) // Half the exp if it was still in progress
{
awarded = RoundToFloor(awarded / 2.0);
}

awardEXP(attacker, awarded);
awardEXP(assister, awarded);

PrintHintText(attacker, "You gained EXP for destroying a structure!");
PrintHintText(assister, "You gained EXP for assisting in the destruction of a structure!");

}
}

public PlantedUber(Handle:event, const String:name[], bool:dontBroadcast)
{
new medic = GetClientOfUserId(GetEventInt(event, "userid"));
awardEXP(medic, 25);
PrintHintText(medic, "You gained 25 EXP for deploying an uber.");
}

public Event_player_extinguished(Handle:event, const String:name[], bool:dontBroadcast)
{
new healer = GetClientOfUserId(GetEventInt(event, "healer"));
if(ValidPlayer(healer)) // Could also be world
{
awardEXP(healer, 10);
PrintHintText(healer, "You gained 10 EXP for extinguishing a player!");
}
}

public UpgradedBuilding(Handle:event, const String:name[], bool:dontBroadcast)
{
new engineer = GetClientOfUserId(GetEventInt(event, "userid"));
new bool:isbuilder = GetEventBool(event, "isbuilder");
if(!isbuilder)
{
awardEXP(engineer, 10);
PrintHintText(engineer, "You gained 10 EXP for upgrading someone elses structure!");
}
}

public awardEXP(client, amount)
{
new race = War3_GetRace(client);
new totalXP = War3_GetXP(client, race) + amount;
War3_SetXP(client, race, totalXP);
}

http://wiki.alliedmods.net/Team_Fortress_2_Events
« Last Edit: December 09, 2010, 12:58:31 AM by Foolishfox » Logged

iceman
Full Member
***
Posts: 162



View Profile
« Reply #2 on: December 09, 2010, 06:05:03 AM »

Thanks, i will try the medic out. What kind of trouble with the full version?
Logged
Glider⠠⠵
Global Moderator
Sr. Member
*****
Posts: 413


⠠⠵


View Profile
« Reply #3 on: December 09, 2010, 09:06:09 PM »

Nothing working  Grin
Logged

Ownz
Developer
Administrator
Hero Member
*****
Posts: 2046



View Profile WWW Email
« Reply #4 on: December 09, 2010, 09:07:11 PM »

?
Logged

DarkEnergy
Ownz
Developer
Administrator
Hero Member
*****
Posts: 2046



View Profile WWW Email
« Reply #5 on: December 19, 2010, 12:00:08 PM »

so is ur script working or not?
Logged

DarkEnergy
Glider⠠⠵
Global Moderator
Sr. Member
*****
Posts: 413


⠠⠵


View Profile
« Reply #6 on: December 20, 2010, 02:25:45 AM »

Don't think so. Like I said, it's untested. If anyone wants to implement a proper working version, that should give you at least the basics on how to do it.
Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!