Im starting to try to write my own race, this race is not finish yet, so far i have make this code, only speed ond shots should be finish i think, i have use 14 days just to write this, very hard becourse i newer try to code before, i have look at many races, some thing i try to steel for other races and then change the code, how does it look is there any mistake so far or i forget something in the speed and shots ?
Code: [Select]
/*
* War3Source Race - BongoMan
*
* File: War3Source_BongoMan.sp
* Description: The BongoMan race for War3Source.
* Author: Jumpman
*/
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <sdktools_tempents>
#include <sdktools_functions>
#include <sdktools_tempents_stocks>
#include <sdktools_entinput>
#include <sdktools_sound>
#include "W3SIncs/War3Source_Interface"
public Plugin:myinfo =
{
name = "War3Source - Race - BongoMan",
author = "Jumpman",
description = "The BongoMan race for War3Source",
version = "1.0.0",
url = "http://venskabsklanerne.dk/",
};
new thisRaceID;
new SKILL_BMSPEED, SKILL_BMGRAV, SKILL_BMHEALTH, SKILL_BMSHOTS, ULT_BMINVIS_TELE;
// Speed
new Float:BongoManSpeed[] = { 0.0, 1.1, 1.2, 1.3, 1.4, 1.5 };
// Gravity
new Float:BongoManGravity[] = { 1.0, 0.6, 0.52, 0.44, 0.34, 0.26 };
// Health
new BongoManHP[] = { 0,40, 50, 60, 70, 80 };
new BongoManArmor[] = { 0,50, 60, 80, 90, 100 };
// Shots
new Float:BongoManShots[] = { 1.0, 1.1, 1.15, 1.2, 1.25, 1.3 };
// Teleport
new Float:BongoManUltDelay[] = { 0.0, 6.0, 5.0, 4.0, 3.0 };
new bool:bIsInvisible[MAXPLAYERS];
// Sounds
new String:SpeedSnd[]="war3source/bongoman/speed.mp3";
new String:GravitySnd[]="war3source/bongoman/gravity.mp3";
new String:TeleportSnd[]="war3source/bongoman/teleport.mp3";
/* *********************** OnWar3LoadRaceOrItemOrdered2 *********************** */
public OnWar3LoadRaceOrItemOrdered2(num)
{
if(num==300){
thisRaceID=War3_CreateNewRace("BongoMan", "BongoMan");
SKILL_BMSPEED = War3_AddRaceSkill(thisRaceID, "BongoMan Speed", "BongoMan runs faster.", false, 5 );
SKILL_BMGRAV = War3_AddRaceSkill(thisRaceID, "BongoMan Gravity", "BongoMan jumps higher", false, 5 );
SKILL_BMHEALTH = War3_AddRaceSkill(thisRaceID, "BongoMan Health", "BongoMan have more healths", false, 5 );
SKILL_BMSHOTS = War3_AddRaceSkill(thisRaceID, "BongoMan Shots", "BongoMan shots hit 100%. (attack)", false, 5);
ULT_BMINVIS_TELE = War3_AddRaceSkill(thisRaceID, "BongoMan 100% Invisibility", "BongoMan teleport and become completely invisible when not moving", true, 4 );
W3SkillCooldownOnSpawn( thisRaceID, ULT_BMINVIS_TELE, 5.0, _ );
War3_CreateRaceEnd(thisRaceID);
}
}
/* *********************** OnMapStart *********************** */
public OnMapStart()
{
War3_PrecacheSound(SpeedSnd);
War3_PrecacheSound(GravitySnd);
War3_PrecacheSound(TeleportSnd);
}
/* *********************** OnWar3EventSpawn *********************** */
public OnWar3EventSpawn( client )
{
new race = War3_GetRace( client );
if( race == thisRaceID )
{
W3ResetAllBuffRace( client, thisRaceID );
InitPassiveSkills(client);
EmitSoundToAll(SpeedSnd,client);
}
}
/* *********************** InitPassiveSkills *********************** */
public InitPassiveSkills(client)
{
if(War3_GetRace(client)==thisRaceID)
{
new skill_lvl = War3_GetSkillLevel(client,thisRaceID,SKILL_BMSPEED);
if(skill_lvl > 0)
{
War3_SetBuff(client,fMaxSpeed,thisRaceID,BongoManSpeed[skill_lvl]);
}
}
}
/* *************************************** BongoMan Shots *************************************** */
public OnW3TakeDmgBulletPre(victim,attacker,Float:damage)
{
if(ValidPlayer(victim,true)&&ValidPlayer(attacker,false)&&GetClientTeam(victim)!=GetClientTeam(attacker))
{
if(War3_GetRace(attacker)==thisRaceID)
{
new skill=War3_GetSkillLevel(attacker,thisRaceID,SKILL_BMSHOTS);
if(skill>0)
{
War3_DamageModPercent(BongoManShots[skill]);
damage *= BongoManShots[skill];
}
}
}
}

Logged
