Author Topic: BongoMan  (Read 421 times)

Jumpman

  • Full Member
  • ***
  • Posts: 123
    • View Profile
BongoMan
« on: June 13, 2016, 03:44:36 AM »
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];
}
}
}
}
[+35]Jumpman

abgar

  • Full Member
  • ***
  • Posts: 114
    • View Profile
Re: BongoMan
« Reply #1 on: June 14, 2016, 01:50:57 AM »
It's a start mate :)

Here's some suggestions for you to consider (if you choose to :) )
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 "W3SIncs/War3Source_Interface"  // Added this here

// Delete all the includes after this line, as they're already included in the <sdktools> block above
#include <sdktools_tempents>
#include <sdktools_functions>
#include <sdktools_tempents_stocks>
#include <sdktools_entinput>
#include <sdktools_sound>


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_AddSkillBuff(thisRaceID,SKILL_BMSPEED,fMaxSpeed,BongoManSpeed);  // Set your speed buff with this line, instead.

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);  // If this is a sound to indicate a speed buff, you might be better to put that in your InitPassiveSkills with a check to make sure that the speed skill has been levelled
}
}


// I would be adding the below as well, to make sure that all buffs are removed when changing FROM this race TO  any other race
public OnRaceChanged(client,oldrace,newrace)
{
if(newrace != thisRaceID)
{
War3_WeaponRestrictTo(client,thisRaceID,"");
W3ResetAllBuffRace(client,thisRaceID);
}
else
{
if (ValidPlayer(client,true))
        {
InitPassiveSkills(client);
}
}
}

/* *********************** InitPassiveSkills *********************** */
public InitPassiveSkills(client)
{
// Removed this, and added the War3_AddSkillBuff line in public OnWar3LoadRaceOrItemOrdered2(num).  The reason for doing it that way is that you've only got your
// InitPassiveSkills being called on spawn.  So, if you're already level 2 speed, then level up to level 3, you won't get the speed increase until next spawn.
/*
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];  // Why are you multiplying the damage here, when War3_DamageModPercent already does that for you?
}
}
}
}