October 26, 2014, 12:49:02 AM

Author Topic: War3Source News for SourceMod  (Read 7480 times)

Offline pimpinjuice

  • Level 1 Trained Beginner
  • *
  • Posts: 31
War3Source News for SourceMod
« on: June 13, 2007, 02:17:29 AM »
Hello all,

Most of you know who I am, Anthony "PimpinJuice" Iacono. For those of you who don't know who I am, I am the original programmer of the Warcraft plugin for the Source engine. For a long time I was inactive, as well as experimenting with different types of programming language options for creation for the official Warcraft plugin. I have great news, it is time for an update :]
Let me explain first by talking about what I ended up doing.

Recently SourceMod (http://sourcemod.com/), the pawn based scripting platform for the Source engine, has made major strides. From the beginning of Source, I wanted to use it to code Warcraft. As soon as the nightly build system came out for SourceMod I started hackin' away at what is now known and named War3Source. SourceMod is amazing, its lightning fast and even is almost as fast as C++ with multiple benchmark tests. Not only that, but the capabilities of SourceMod are incredible! It is made by the same creators of AMXX for CS 1.6. When created, they wanted to give it the same ease of use, but add more, and the work has payed off.

Now that you know how I made War3Source, lets talk about it! War3Source is a fully customizable Warcraft plugin created by me, Anthony. First, lets talk about basic functionallity before I get into developer functions.

- Same Warcraft you know and love, you get experience from things such as killing players, saving hostages, and bomb based tasks.

- There is support for MySQL and local storage. Each database is handled to perform the best and most optimized possible. For all those nerds out there that are curious about how local storage works, it is done through SQLite. All these things are coded into SourceMod :]

- There is a maximum of level 16 for each race, which allows a person to be level 4 in every skill for their race, but every level becomes harder to reach as the XP you require to level increases.

- There is a big list of commands players can access by typing "war3help" in chat, here is a list.
Quote
say showxp - Show the current experience information for the current race.
say changerace - Change to a different race.
say skillsinfo - Display the skill information for the current race.
say resetskills - Resets all your skill levels for the current race and allows you to rechoose.
say spendskills - Spend any unused skill points you have.
say showskills - Show which skill levels you currently have.
say showcredits - Show your current shop credit count.
say shopmenu - Bring up the shop menu at which you can buy items.
+ultimate - Use an ultimate that required a bind.
war3admin - Bring up the admin menu at which you can modify player info.

- The admin menu allows you to administrate the players in the server with the following options, this doesn't show everything as there is sub-options.
Quote
View detailed information
Reset skills
Set race
Give shop item
Increase/Decrease XP
Increase/Decrease Level
Increase/Decrease Credits

- The shopmenu system is based on a credit system, so any HL2 mod will load the War3Source plugin. Basically, each kill gives you a certain amount of credits to spend at the shop, but the server has a variable to change the max amount a player can have.

I am sure I forgot some features, ask if you have a question about them. Now, developers, you will be excited to know that just like WC3 and WCS you can create your own races and shop items. But with War3Source you code races, shopitems, and add help commands in your own SourceMod plugin. As mentioned, SourceMod code is very easy to pick up. I prefer it over eventscripts to be honest. Here is an example of a race for all of you coders to drool over, its the Undead Scourge race. All code is subject to change. Just so you know, I don't expect anyone to understand this yet, I just expect you to see the power of it:
Quote
/**
 * File: War3Source_UndeadScourge.sp
 * Description: The Undead Scourge race for War3Source.
 * Author(s): Anthony Iacono
 */
 
#pragma semicolon 1

#include <sourcemod>
#include <../War3Source/War3Source_Interface.inc>
#include <tempents>

// Defines
#define MAX_PLAYERS 64
#define IS_ALIVE !GetLifestate

// War3Source stuff
new raceID; // The ID we are assigned to
new healthOffset[MAX_PLAYERS+1];
new speedOffset;
new lifestateOffset;
new gravityOffset[MAX_PLAYERS+1];
new explosionModel;

// Suicide bomber check
new bool:m_Suicided[MAX_PLAYERS+1]={false};

public Plugin:myinfo =
{
    name = "War3Source Race - Undead Scourge",
    author = "PimpinJuice",
    description = "The Undead Scourge race for War3Source.",
    version = "1.0.0.0",
    url = "http://pimpinjuice.net/"
};

// War3Source Functions
public OnServerCfg()
{
    raceID=War3_CreateRace("Undead Scourge","undead","You are now an Undead Scourge.","You will be an Undead Scourge when you die or respawn.","Vampiric Aura","Gives you a 60% chance to gain 12-30% of the\ndamage you did in attack, back as health. It can\nbe blocked if the player is immune.","Unholy Aura","Gives you a speed boost, 8-36% faster.","Levitation","Allows you to jump higher by \nreducing your gravity by 8-64%.","Suicide Bomber","Use your ultimate bind to explode\nand damage the surrounding players extremely,\nwill automatically activate on death.");
    HookEvent("player_hurt",PlayerHurtEvent);
    HookEvent("player_spawn",PlayerSpawnEvent);
    HookEvent("player_death",PlayerDeathEvent);
    speedOffset=FindSendPropOffs("CBasePlayer","m_flLaggedMovementValue");
    lifestateOffset=FindSendPropOffs("CAI_BaseNPC","m_lifeState");
    explosionModel=PrecacheModel("materials/sprites/zerogxplode.vmt",false);
}

public OnMapStart()
{
    PrecacheSound("weapons/explode5.wav",false);
}

public OnWar3PlayerAuthed(client,war3player)
{
    healthOffset[client]=FindDataMapOffs(client,"m_iHealth");
    gravityOffset[client]=FindDataMapOffs(client,"m_flGravity");
}

public Float:DistanceBetween(Float:a[3],Float:b[3])
{
    return SquareRoot((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1])+(a[2]-b[2])*(a[2]-b[2]));
}

public PowerOfRange(Float:location[3],Float:radius,Float:check_location[3])
{
    new Float:distance=DistanceBetween(location,check_location);
    new Float:healthtakeaway=0.0;
    if(distance<radius)
        healthtakeaway=1-FloatDiv(distance,radius)+0.20;
    return FloatRound(100*healthtakeaway);
}

// Stocks
#define COLOR_DEFAULT 0x01
#define COLOR_TEAM 0x03
#define COLOR_GREEN 0x04 // Actually red for DOD
stock War3Source_ChatMessage(target,color,const String:szMsg[],any:...)
{
    if(strlen(szMsg)>191)
    {
        LogError("Disallow string len(%d)>191",strlen(szMsg));
        return;
    }
    decl String:buffer[192];
    VFormat(buffer,sizeof(buffer),szMsg,4);
    Format(buffer,191,"%s\n",buffer);
    new Handle:hBf;
    if(target==0)
        hBf=StartMessageAll("SayText");
    else
        hBf=StartMessageOne("SayText",target);
    if(hBf!=INVALID_HANDLE)
    {
        BfWriteByte(hBf, 0);
        BfWriteString(hBf, buffer);
        EndMessage();
    }
}

public GetLifestate(client)
{
    return GetEntData(client,lifestateOffset,1);
}

public Undead_SuicideBomber(client,war3player,race,ult_level)
{
    new Float:radius=0.0;
    new r_int;
    switch(ult_level)
    {
        case 1:
        {
            radius=200.0;
            r_int=200;
        }
        case 2:
        {
            radius=250.0;
            r_int=250;
        }
        case 3:
        {
            radius=300.0;
            r_int=300;
        }
        case 4:
        {
            radius=350.0;
            r_int=350;
        }
    }
    new Float:client_location[3];
    GetClientAbsOrigin(client,client_location);
    new Float:zero[3]={0.0,0.0,0.0};
    for(new x=1;x<MAX_PLAYERS+1;x++)
    {
        if(x<=GetClientCount()&&IsClientConnected(x))
        {
            TEExplosion(explosionModel,x,0.0,client_location,10.0,30,r_int,20,zero);
            TEEmitSound(x,client,"weapons/explode5.wav",1.0);
            if(x!=client&&IS_ALIVE(x))
            {
                new war3player_check=War3_GetWar3Player(x);
                if(war3player_check>-1)
                {
                    if(!War3_GetImmunity(war3player_check,Immunity_Ultimates)&&!War3_GetImmunity(war3player_check,Immunity_Explosion))
                    {
                        new Float:location_check[3];
                        GetClientAbsOrigin(x,location_check);
                        new hp=PowerOfRange(client_location,radius,location_check);
                        new newhealth=GetClientHealth(x)-hp;
                        SetHealth(x,newhealth);
                        if(newhealth<=0)
                        {
                            FakeClientCommand(x,"kill\n");
                            if(GetClientTeam(client)!=GetClientTeam(x))
                            {
                                new addxp;
                                new level=War3_GetLevel(war3player,race);
                                addxp=5+level;
                                new newxp=War3_GetXP(war3player,race)+addxp;
                                War3_SetXP(war3player,race,newxp);
                                War3Source_ChatMessage(client,COLOR_DEFAULT,"%c[War3Source] %cYou gained %d XP for killing someone with a suicide bomb.",COLOR_GREEN,COLOR_DEFAULT,addxp);
                            }
                        }
                    }
                }
            }
        }
    }
    m_Suicided[client]=true;
    FakeClientCommand(client,"kill\n");
}

public OnUltimateCommand(client,war3player,race,bool:pressed)
{
    if(pressed)
    {
        if(race==raceID&&IS_ALIVE(client))
        {
            new ult_level=War3_GetSkillLevel(war3player,race,3);
            if(ult_level)
                Undead_SuicideBomber(client,war3player,race,ult_level);
        }
    }
}

public OnSkillLevelChanged(client,war3player,race,skill,oldskilllevel,newskilllevel)
{
    if(race==raceID&&skill==1)
    {
        new Float:speed=1.0;
        switch(newskilllevel)
        {
            case 1:
                speed=1.08;
            case 2:
                speed=1.1733;
            case 3:
                speed=1.266;
            case 4:
                speed=1.36;
        }
        SetEntDataFloat(client,speedOffset,speed);
    }
    else if(race==raceID&&skill==2)
    {
        new Float:gravity=1.0;
        switch(newskilllevel)
        {
            case 1:
                gravity=0.92;
            case 2:
                gravity=0.733;
            case 3:
                gravity=0.5466;
            case 4:
                gravity=0.36;
        }
        SetEntDataFloat(client,gravityOffset[client],gravity);
    }
}

// Generic
public SetHealth(entity,amount)
{
    SetEntData(entity,healthOffset[entity],amount,true);
}

public PlayerHurtEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
    new userid=GetEventInt(event,"userid");
    new attacker_userid=GetEventInt(event,"attacker");
    if(userid&&attacker_userid&&userid!=attacker_userid)
    {
        new index=GetClientOfUserId(userid);
        new attacker_index=GetClientOfUserId(attacker_userid);
        new war3player=War3_GetWar3Player(index);
        new war3player_attacker=War3_GetWar3Player(attacker_index);
        if(war3player!=-1&&war3player_attacker!=-1)
        {
            new race_attacker=War3_GetRace(war3player_attacker);
            if(race_attacker==raceID)
            {
                new skill_attacker=War3_GetSkillLevel(war3player_attacker,race_attacker,0);
                if(skill_attacker>0&&GetRandomInt(1,10)<=6&&!War3_GetImmunity(war3player,Immunity_HealthTake))
                {
                    new Float:percent_health;
                    switch(skill_attacker)
                    {
                        case 1:
                            percent_health=0.12;
                        case 2:
                            percent_health=0.18;
                        case 3:
                            percent_health=0.24;
                        case 4:
                            percent_health=0.30;
                    }
                    new Float:damage=float(GetEventInt(event,"dmg_health"));
                    new leechhealth=FloatRound(damage*percent_health);
                    if(leechhealth)
                    {
                        new newhealth=GetClientHealth(index)-leechhealth;
                        if(newhealth<0)
                            newhealth=0;
                        SetHealth(index,newhealth);
                        new newhealth_attacker=GetClientHealth(attacker_index)+leechhealth;
                        SetHealth(attacker_index,newhealth_attacker);
                    }
                }
            }
        }
    }
}

public PlayerSpawnEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
    new userid=GetEventInt(event,"userid");
    new index=GetClientOfUserId(userid);
    new war3player=War3_GetWar3Player(index);
    if(war3player>-1)
    {
        m_Suicided[index]=false;
        new race=War3_GetRace(war3player);
        if(race==raceID)
        {
            new skilllevel_unholy=War3_GetSkillLevel(war3player,race,1);
            new Float:speed=1.0;
            switch(skilllevel_unholy)
            {
                case 1:
                    speed=1.08;
                case 2:
                    speed=1.1733;
                case 3:
                    speed=1.266;
                case 4:
                    speed=1.36;
            }
            SetEntDataFloat(index,speedOffset,speed);
            new skilllevel_levi=War3_GetSkillLevel(war3player,race,2);
            new Float:gravity=1.0;
            switch(skilllevel_levi)
            {
                case 1:
                    gravity=0.92;
                case 2:
                    gravity=0.733;
                case 3:
                    gravity=0.5466;
                case 4:
                    gravity=0.36;
            }
            SetEntDataFloat(index,gravityOffset[index],gravity);
        }
    }
}

public PlayerDeathEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
    new userid=GetEventInt(event,"userid");
    new index=GetClientOfUserId(userid);
    new war3player=War3_GetWar3Player(index);
    if(war3player>-1&&!m_Suicided[index])
    {
        new race=War3_GetRace(war3player);
        if(race==raceID)
        {
            new ult_level=War3_GetSkillLevel(war3player,race,3);
            if(ult_level)
                Undead_SuicideBomber(index,war3player,race,ult_level);
        }
    }
}

There are tons of War3Source commands you can call through the War3Source_Interface.inc. If I were you developers, learn SourceMod now so you have a head start!

Phew, thats a mouth full, but the thing you have all been waiting for is probably some sort of release date. The simple fact is, the plugin is done. I just need to wait for some tiny SourceMod additions and finish up the default races and shopmenu items.

Please ask me any questions and tell me any comments you have by either replying here, PMing me, or e-mailing me at anthonyiacono@gmail.com.

Developers:
Here is the list of commands in the interface:
Quote
/**
 * File: War3Source_Interface.inc
 * Description: The file to be included for creating races and whatnot.
 * Author(s): Anthony Iacono 
 */

// The types of immunities you can get/set from.
enum War3Immunity
{
   Immunity_Ultimates = 0, // Immune from ultimates
   Immunity_HealthTake = 1, // Immune from health taking
   Immunity_Explosion = 2, // Immune from explosion based stuff
   Immunity_ShopItems = 3, // Immune from shop items
};
 
native War3_CreateRace(String:name[],String:short[],String:switchmessage_instant[],String:switchmessage_dead[],String:skill1[],String:skill1_desc[],String:skill2[],String:skill2_desc[],String:skill3[],String:skill3_desc[],String:ult[],String:ult_desc[]);
native War3_CreateShopItem(String:name[],String:desc[],String:cost[]);
native War3_CreateHelpCommand(String:name[],String:desc[]);
native War3_GetWar3Player(client);
native War3_GetLevel(war3player,race);
native War3_GetRace(war3player);
native War3_GetXP(war3player,race);
native War3_SetXP(war3player,race,newxp);
native War3_GetSkillLevel(war3player,race,skill);
native War3_GetOwnsItem(war3player,item);
native War3_SetOwnsItem(war3player,item,owns);
native War3_GetImmunity(war3player,War3Immunity:immunity);
native War3_SetImmunity(war3player,War3Immunity:immunity,imm_state);
forward OnWar3PlayerAuthed(client,war3player);
forward OnUltimateCommand(client,war3player,race,bool:pressed);
forward OnItemPurchase(client,war3player,item);
forward OnSkillLevelChanged(client,war3player,race,skill,oldskilllevel,newskilllevel);

Natives are normal functions and forwards are functions that are called to the race/shopitem plugin. PM me for a description of each command.
« Last Edit: June 13, 2007, 03:42:05 PM by pimpinjuice »

Offline CloudStrife

  • Level 5 Trained Intermediate
  • *****
  • Posts: 104
Re: War3Source News for SourceMod
« Reply #1 on: June 13, 2007, 09:36:19 AM »
So this has only Undead Scourge, Orchish Horde, Night Elves and Human Aliance only right?

Offline HOLLIDAY

  • <Race Maker>
  • Moderator
  • Level 7 Expert
  • *****
  • Posts: 2780
  • Country: 00
  • of all the things ive lost i miss my mind the most
    • HOLLIDAYWCS.COM
Re: War3Source News for SourceMod
« Reply #2 on: June 13, 2007, 11:20:48 AM »
reconized the name a couple days ago that it was a spoof

how is this different from wcs? sounds like same mode different code

Offline pimpinjuice

  • Level 1 Trained Beginner
  • *
  • Posts: 31
Re: War3Source News for SourceMod
« Reply #3 on: June 13, 2007, 03:16:15 PM »
Hey all,
The default races are going to be the 4, but you can create races.
This system is alot more extensive than War3Source. One example I have is the immunity system. Coders can make you immune from stuff such as ultimates, or exposions. Also, WCS is built on ES, which is not made for big plugins like this. You will notice a very significant difference in performance. If you guys want a list of admin commands tell me.

Offline pimpinjuice

  • Level 1 Trained Beginner
  • *
  • Posts: 31
Re: War3Source News for SourceMod
« Reply #4 on: June 13, 2007, 03:43:05 PM »
I posted a list of developer commands in the first post, once you learn SourceMod it will make more sense, but if you need help coding a race let me know, also, if you need the interface include file so you can get a head start on coding races, let me know.

Offline HOLLIDAY

  • <Race Maker>
  • Moderator
  • Level 7 Expert
  • *****
  • Posts: 2780
  • Country: 00
  • of all the things ive lost i miss my mind the most
    • HOLLIDAYWCS.COM
Re: War3Source News for SourceMod
« Reply #5 on: June 13, 2007, 03:45:46 PM »
Quote
Coders can make you immune from stuff such as ultimates, or exposions
same here ammune to ultimates headshots (almost) mole
destroy enemys invisibility

same commands too
« Last Edit: June 13, 2007, 03:49:20 PM by HOLLIDAY »

Offline pimpinjuice

  • Level 1 Trained Beginner
  • *
  • Posts: 31
Re: War3Source News for SourceMod
« Reply #6 on: June 13, 2007, 03:55:41 PM »
One of the main reasons I created it was because of ES is not for big gamemodes. I have spoken to Andy (kryptonite), and he said he wont be as active as well. Remember, I CREATED wc3 originally, most of the techniques of coding are mind on ES. Mani is planned to be on death row, and without mani, WCS wont work, so your only options is to have an alternative. SourceMod is also like AMXX, anyone who is a server admininstrator for 1.6 can tell you that plugins are very fast under this system, and they never give you any trouble because everything is built in.

Offline HOLLIDAY

  • <Race Maker>
  • Moderator
  • Level 7 Expert
  • *****
  • Posts: 2780
  • Country: 00
  • of all the things ive lost i miss my mind the most
    • HOLLIDAYWCS.COM
Re: War3Source News for SourceMod
« Reply #7 on: June 13, 2007, 04:02:10 PM »
without mani? wcs dosent need mani to work
everything is es est
« Last Edit: June 13, 2007, 04:04:43 PM by HOLLIDAY »

Offline Drakshasak

  • Level 0 Beginner
  • Posts: 9
Re: War3Source News for SourceMod
« Reply #8 on: June 14, 2007, 07:03:50 PM »
Well this sounds really interesting. do you have any sort of ETA cause i cant wait to see it. I really like the warcraft aspect of CS but the ES version is kinda lacking on some parts IMO. that and the fact that this server is unstable as hell :(

Offline pimpinjuice

  • Level 1 Trained Beginner
  • *
  • Posts: 31
Re: War3Source News for SourceMod
« Reply #9 on: June 14, 2007, 09:49:18 PM »
Gameconnect will probably have some servers this weekend :]

As for the CBase stuff, it does have it built in, its just not fully released yet, its called sdktools (any cbase stuff), not only that you can sigscan :]

Offline Drakshasak

  • Level 0 Beginner
  • Posts: 9
Re: War3Source News for SourceMod
« Reply #10 on: June 14, 2007, 09:52:28 PM »
gameconnect. Where is that server located???

Offline pimpinjuice

  • Level 1 Trained Beginner
  • *
  • Posts: 31
Re: War3Source News for SourceMod
« Reply #11 on: June 14, 2007, 10:30:32 PM »
There is one in the US and one in the EU that are going to be set up for War3Source. See http://gameconnect.info/ for more info about game connect.

Offline Diraiba

  • not not telling you why im not no amdin cause i am
  • Level 7 Expert
  • *****
  • Posts: 405
  • Koekjen?
Re: War3Source News for SourceMod
« Reply #12 on: June 14, 2007, 10:57:51 PM »
Dude how did u come up with such a stupid name? war3 CHANGE IT IT SUCKS!

First find a better name it has completely NOTHING to do with warcraft3 it sounds more like a WAR! game then a WARcraft GAme.
dude  really...


Care...
* Edit *

Oh yes one more thing ur kinda advertising on this site now i think they dont really apriciate (bad english) That

AND Krypto came up with this idea to code in the sourcemod asswell and now we see you take that oppertunity away(Wich to ME looks like stealing his idea) AND ur advertising this on HIS site don man really...


Care...
« Last Edit: June 14, 2007, 11:03:56 PM by :D|POWER| »


Offline pimpinjuice

  • Level 1 Trained Beginner
  • *
  • Posts: 31
Re: War3Source News for SourceMod
« Reply #13 on: June 14, 2007, 11:20:28 PM »
I talk to kryptonite all the time, trust me, he knows about this post. He knew I was working on it for months now, if anything HE stole my idea since I am the original creator of warcraft for Source. Also, I am not advertising, I was talking about a plugin.

Offline Diraiba

  • not not telling you why im not no amdin cause i am
  • Level 7 Expert
  • *****
  • Posts: 405
  • Koekjen?
Re: War3Source News for SourceMod
« Reply #14 on: June 14, 2007, 11:43:30 PM »
Cry Cry wankwank So what if you talk to him all the time so do i thats no big deal and yes u are the original creator of warcraft that sucked....

now a better mod came and WITH THE RELEASE OF THIS CAME THE WORDS that krypto would code this all in sourcemod asswell!