Page 5 of 5 FirstFirst ... 3 4 5
Results 41 to 49 of 49

Thread: 008 Crypt Lord [80] v1.0.9

  1. Default

    There is also another global var added to this race which has its own section under all the other decelerations:
    Code:
    //TIMERS
    new Handle:SpawnTimer[MAXPLAYERS+1];
    This is for dealing with timers which require tracking to prevent errors or to ensure they get killed on demand. This is part of the timer handling system that does not exist in any of the races that I have not coded. The other parts of the system are explained below:

    Code:
    public OnPluginStart()
    {    
        //Safe way to stop timers at end of round
        HookEvent("round_end",RoundEnd);
    }
    
    public OnMapStart()
    {
        OnMapStart_UltBlockSound();
        
        War3_PrecacheSound(ultimateSound);
        
        //Reset Arrays
        Array_Fill(SpawnTimer, MAXPLAYERS+1, INVALID_HANDLE);
    }
    
    public RoundEnd(Handle:event,const String:name[],bool:dontBroadcast)
    {
        //CLEAR TIMERS
        LoopClearTimers();
    }
    
    public OnClientDisconnect(client)
    {
        ClearTimers(client);
    }
    
    //CLEAR TIMERS
    ClearTimers(client)
    {
        CleanTimerCell(SpawnTimer, client);
    }
    In the above section of the Crypt Lord we see that firstly the method order follows a logical process to make it easy to read and reference. We can also see that there is a lot of automated handling to ensure that timers are tracked and destroyed correctly when needed. This is very important to prevent crashes. This is also all the code needed to ensure that a timer which must end when the round stops or the client spawns, dies ect does so without creating errors.



  2. Default

    So here is the Original:
    Code:
    /**
     * File: War3Source_CryptLord.sp
     * Description: The Crypt Lord race for War3Source.
     * Author(s): Anthony Iacono & Ownage | Ownz
     */
     
    #pragma semicolon 1
    
    #include <sourcemod>
    #include "W3SIncs/War3Source_Interface"
    #include <sdktools>
    #include <sdktools_functions>
    #include <sdktools_tempents>
    #include <sdktools_tempents_stocks>
    #include <smlib>
    
    new thisRaceID;
    
    new SKILL_IMPALE,SKILL_SPIKE,SKILL_BEETLES,ULT_LOCUST;
    
    //Increase length from 5 to 6
    
    //skill 1
    //Impale
    new Float:ImpaleChanceArr[]={0.0,0.1,0.16,0.22,0.26,0.33}; 
    
    //skill 2
    //Spiked Carapace
    //new Float:SpikeDamageRecieve[]={1.0,0.95,0.9,0.85,0.8,0.75};
    //new Float:SpikeArmorGainArr[]={0.0,0.0,0.0,0.0,0.0,0.0};
    new Float:SpikeChanceArr[]={0.0,0.2,0.25,0.3,0.35,0.4}; 
    new Float:SpikeReturnDmgArr[]={0.0,0.1,0.13,0.15,0.17,0.2}; 
    new ArmorArr[]={0,110,130,160,180,200};
    
    //skill 3
    //Carrion Beetles
    new BeetleDamageArr[]={0,5,7,9,12,15};
    new Float:BeetleChanceArr[]={0.0,0.2,0.25,0.28,0.3,0.33};
    
    //ultimate
    //Locust Swarm
    new Handle:ultCooldownCvar;
    new Handle:ultRangeCvar;
    new const LocustDamage=25;
    new const LocustMaxHealth=150;
    new RemoveArmorArr[]={0,10,15,20,25,30};
    
    new String:ultimateSound[]="war3source/locustswarmloop.wav";
    
    
    public Plugin:myinfo = 
    {
        name = "War3Source Race - Crypt LordZ",
        author = "PimpinJuice & Ownz -ZERO <ibis>",
        description = "The Crypt Lord race for War3Source.",
        version = "2.0.0.5",
        url = "http://Www.OwnageClan.Com"
    };
    
    public OnPluginStart()
    {
        
        ultCooldownCvar=CreateConVar("war3_crypt_locust_cooldown","20","Cooldown between ultimate usage");
        ultRangeCvar=CreateConVar("war3_crypt_locust_range","800","Range of locust ultimate");
        
        LoadTranslations("w3s.race.crypt.phrases");
    }
    
    public OnWar3LoadRaceOrItemOrdered(num)
    {
        if(num==80)
        {
    
                                    
                                    //Update levels from 4 to 5
            thisRaceID=War3_CreateNewRaceT("crypt");
            SKILL_IMPALE=War3_AddRaceSkill(thisRaceID,"Impale","Shake and push the enemy, 10-33% chance",false,5);
            SKILL_SPIKE=War3_AddRaceSkill(thisRaceID,War3_GetGame()==Game_CS?"SpikedCarapaceCS":"SpikedCarapaceTF","Get 110-200 armor on spawn, 20-40% chance to deal 10-20% mirror damage",false,5);
            SKILL_BEETLES=War3_AddRaceSkill(thisRaceID,"CarrionBeetles","20-33% chance of your beetles attacking the enemy for 5-15 extra damage",false,5);
            ULT_LOCUST=War3_AddRaceSkill(thisRaceID,"LocustSwarm","steals 25HP and 10-30 armor from one random enemy",true,5); 
            War3_CreateRaceEnd(thisRaceID);    
        }
    
    }
    
    public OnMapStart()
    {
        
        War3_PrecacheSound(ultimateSound);
    }
    
    public OnWar3PlayerAuthed(client)
    {
        
    }
    
    public OnRaceChanged(client,oldrace,newrace)
    {
        if(oldrace==thisRaceID)
        {
        }
    }
    
    public OnWar3EventSpawn( client )
    {
        new race = War3_GetRace( client );
        if( race == thisRaceID )
        {
            new skilllevel_spike = War3_GetSkillLevel( client, thisRaceID, SKILL_SPIKE );
            if( skilllevel_spike > 0)
            {
                GivePlayerItem(client, "item_assaultsuit");
                War3_SetCSArmor(client,ArmorArr[skilllevel_spike]);
            }
        }
    }
    
    
    public OnUltimateCommand(client,race,bool:pressed)
    {
    
        if(race==thisRaceID && pressed && ValidPlayer(client,true) )
        {
            new ult_level=War3_GetSkillLevel(client,race,ULT_LOCUST);
            if(ult_level>0)
            {
                
                if(!Silenced(client)&&War3_SkillNotInCooldown(client,thisRaceID,ULT_LOCUST,true))
                {
                    new Float:posVec[3];
                    GetClientAbsOrigin(client,posVec);
                    new Float:otherVec[3];
                    new Float:bestTargetDistance=999999.0; 
                    new team = GetClientTeam(client);
                    new bestTarget=0;
                    
                    new Float:ultmaxdistance=GetConVarFloat(ultRangeCvar);
                    for(new i=1;i<=MaxClients;i++)
                    {
                        if(ValidPlayer(i,true)&&GetClientTeam(i)!=team&&!W3HasImmunity(i,Immunity_Ultimates))
                        {
                            GetClientAbsOrigin(i,otherVec);
                            new Float:dist=GetVectorDistance(posVec,otherVec);
                            if(dist<bestTargetDistance&&dist<ultmaxdistance)
                            {
                                bestTarget=i;
                                bestTargetDistance=GetVectorDistance(posVec,otherVec);
                                
                            }
                        }
                    }
                    if(bestTarget==0)
                    {
                        PrintHintText(client,"%T","No Target Found within {amount} feet",client,ultmaxdistance/10);
                    }
                    else
                    {
                        //Locous Attack
                        //new damage=RoundFloat(float(War3_GetMaxHP(bestTarget))*LocustDamagePercent[ult_level]);
                        
                        new damage=LocustDamage;
                        if(damage>0)
                        {
                            //Damage Player
                            if(War3_DealDamage(bestTarget,damage,client,DMG_BULLET,"locust")) //default magic
                            {
                                W3PrintSkillDmgHintConsole(bestTarget,client,War3_GetWar3DamageDealt(),ULT_LOCUST);
                                W3FlashScreen(bestTarget,RGBA_COLOR_RED);
                                
                                EmitSoundToAll(ultimateSound,client);
                                War3_CooldownMGR(client,GetConVarFloat(ultCooldownCvar),thisRaceID,ULT_LOCUST,false,_);
                            
                                //Armor Remove Part
                                if(War3_GetGame()==Game_CS)
                                {
                                    new armor=War3_GetCSArmor(bestTarget);
                                    new armor_subtract=RemoveArmorArr[ult_level];
                                    new armor_new=armor-armor_subtract;
                                    if(armor_new < 0)
                                    {
                                        armor_new=0;
                                    }
                                    
                                    War3_SetCSArmor(bestTarget,armor_new);
                                    
                                    
                                    //Give armor and health to client
                                    
                                    //Health
                                    new old_health=GetClientHealth(client);
                                    new max_health=LocustMaxHealth;
                                    if(old_health<max_health)
                                    {
                                        SetEntityHealth(client,old_health+LocustDamage);
                                    }
                                    
                                    new givearmor=War3_GetCSArmor(client);
                                    new givearmor_add=RemoveArmorArr[ult_level];
                                    new givearmor_new=givearmor+givearmor_add;
                                    
                                    War3_SetCSArmor(client,givearmor_new);
    
                                }
                            
                            }
                        }
                    }
                }
            }
            else
            {
                PrintHintText(client,"%T","Level Your Ultimate First",client);
            }
        }
    }
    
    
    //Removes damge as part of Spike ability, DISABLED
    /*
    public OnW3TakeDmgBullet(victim,attacker,Float:damage){
        if(ValidPlayer(victim,true)&&ValidPlayer(attacker,true)&&GetClientTeam(victim)!=GetClientTeam(attacker))
        {
            if(War3_GetRace(victim)==thisRaceID)
            {
                new skill_level=War3_GetSkillLevel(victim,thisRaceID,SKILL_SPIKE);
                if(skill_level>0&&!Hexed(victim,false))
                {
                    War3_DamageModPercent(SpikeDamageRecieve[skill_level]);  
                }
            }    
        }
    }
    */
    
    public OnWar3EventPostHurt(victim,attacker,damage)
    {
    
        if(W3GetDamageIsBullet()&&ValidPlayer(victim,true)&&ValidPlayer(attacker,true)&&GetClientTeam(victim)!=GetClientTeam(attacker))
        {
            
            if(War3_GetRace(victim)==thisRaceID)
            {
                //Spike Ability
                new skill_level=War3_GetSkillLevel(victim,thisRaceID,SKILL_SPIKE);
                if(skill_level>0&&!Hexed(victim,false))
                {
                    if(!W3HasImmunity(attacker,Immunity_Skills)){
                        
                        //Gives armor when attacked!? DISABLED
                        /*
                        if(War3_GetGame()==Game_CS)
                        {
                            new armor=War3_GetCSArmor(victim);
                            new armor_add=RoundFloat(damage*SpikeArmorGainArr[skill_level]);
                            if(armor_add>20) armor_add=20;
                            War3_SetCSArmor(victim,armor+armor_add);
                            
                            
                        }
                        */
                        
                        
                        //Deal Damage back to attacker
                        if(Math_GetRandomFloat( 0.00, 1.00 ) <= SpikeChanceArr[skill_level])
                        {
                            new returndmg=RoundFloat(FloatMul(SpikeReturnDmgArr[skill_level],float(damage)));
                            War3_DealDamage(attacker,returndmg,victim,_,"spiked_carapace",W3DMGORIGIN_SKILL,W3DMGTYPE_PHYSICAL);
                            PrintToConsole(victim,"%T","Returned {amount} damage to {player}",victim,War3_GetWar3DamageDealt(),attacker);
                            PrintToConsole(attacker,"%T","Received {amount} damage from Spiked Carapace from {player}",attacker,War3_GetWar3DamageDealt(),victim);
                        }
                    }
                }
                
                
                //Impale Ability (when being attacked!?)
                //skill_level = War3_GetSkillLevel(attacker,thisRaceID,SKILL_IMPALE);
                //if(skill_level>0&&!Hexed(victim,false)&&Math_GetRandomFloat(0.0,1.0)<=ImpaleChanceArr[skill_level])
                //{
                    //if(W3HasImmunity(attacker,Immunity_Skills))
                    //{
                        //PrintHintText(attacker,"%T","Blocked Impale",attacker);
                        //PrintHintText(victim,"%T","Enemy Blocked Impale",victim);
                    //}
                    //else
                    //{
                        //War3_ShakeScreen(attacker,2.0,50.0,40.0);
                        //PrintHintText(victim,"%T","Impaled enemy",victim);
                        //PrintHintText(attacker,"%T","You got impaled by enemy",attacker);
                        //W3FlashScreen(attacker,{0,0,128,80});
                    //}
                //}    
            }
            if(War3_GetRace(attacker)==thisRaceID)
            {
                //Beetles ability
                new skill_level = War3_GetSkillLevel(attacker,thisRaceID,SKILL_BEETLES);
                if(!Hexed(attacker,false)&&Math_GetRandomFloat(0.0,1.0)<=BeetleChanceArr[skill_level])
                {
                    if(W3HasImmunity(victim,Immunity_Skills))
                    {
                        PrintHintText(victim,"%T","You blocked beetles attack",victim);
                        PrintHintText(attacker,"%T","Beetles attack was blocked",attacker);
                    }
                    else
                    {
                        
                        War3_DealDamage(victim,BeetleDamageArr[skill_level],attacker,DMG_BULLET,"beetles");
                        W3PrintSkillDmgHintConsole(victim,attacker,War3_GetWar3DamageDealt(),SKILL_BEETLES);
                        W3FlashScreen(victim,RGBA_COLOR_RED);
                        
                    }
                }
                
                //Impale ability
                skill_level = War3_GetSkillLevel(attacker,thisRaceID,SKILL_IMPALE);
                if(skill_level>0&&!Hexed(attacker,false)&&Math_GetRandomFloat(0.0,1.0)<=ImpaleChanceArr[skill_level]) //spike always activates except chancemod reduction
                {
                    if(W3HasImmunity(attacker,Immunity_Skills)){
                        PrintHintText(victim,"%T","Blocked Impale",victim);
                        PrintHintText(attacker,"%T","Enemy Blocked Impale",attacker);
                    }
                    else
                    {
                        War3_ShakeScreen(victim,2.0,50.0,40.0);
                        PrintHintText(victim,"%T","You got impaled by enemy",victim);
                        PrintHintText(attacker,"%T","Impaled enemy",attacker);
                        W3FlashScreen(victim,{0,0,128,80});
                    }
                }
            }
        }
    }



  3. Default

    Here is the reprogrammed:
    Crypt Lord.txt
    Please note that in this reprogrammed version not 100% of the code is all mine. You can clearly see some lines where I have copy&pasted from the original as no changes to those parts of the code were needed. In some cases the same variable names were used as to make referencing to the original to ensure consistency in the effective operation of the program was maintained. Note that my name being listed as the only author is for internal use and is not intended to imply that all of the code contained within the program is 100% my original work.

    For those of you that are interested I think you will be able to see by comparing the two versions how I have "optimized" the original plugin. Made it easier to read and modify as well as unify its code base so that it can be easily updated. You will also see many areas that get replaced with methods that did not exist in the original. Many of these methods are from the stock functions which are used by all the reprogrammed races. By ensuring 100% code consistency via those methods it is easy to make changes to all the races from 1 place when a universal error is found or when a new feature needs to be implemented.



  4. Default

    im guessing "AbilityValue()" is a custom function from zerostocks that allows you to interpolate a % chance based on the min/max proc chances, the total race levels and current level?

    yeah, i see a lot of optimizations under the assumptions that leveling the powers is more linear with your design as opposed to a more complex custom progression of levels.


    keep posting those race codes zero, they were a good fun read to see the gears in motion for this race! (even though i tihnk crypt lord seems to be one of the easiest races to code compared to some other ones:S)
    Started from bottom. Now we here. <IBIS>


    Quote Originally Posted by ZERO View Post
    Trying to hack in IBIS is like trying to kill someone in a police station, not the best idea...

  5. Default

    It is which also makes it easier to read for beginners. As far as the scaling goes it was always linear for all the races anyways.



  6. Default

    1.0.8

    • Initial Release of reprogrammed version



  7. Default

    1.0.9
    Max health gain is now actually limited to 400hp



  8. Default

    [Killer Info] (>'-')>Faded<('-'<) killed you with spiked_carapace at a distance of 17.2 meters and has -186 health and 10 Armor left
    Crypt lord to op, plox nerf, bitch be killing with negative health
    OhGasm In Your Mouth : panorama is so nub
    Maukid : lol
    OhGasm In Your Mouth : never realized it

  9. Default

    what!?



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •