|
Title: [need feedback/testing] Ninja, by Cereal Killer Post by: cerealkiller on July 30, 2010, 06:55:21 PM Here my race I coded with the help of TC
Code: /** * File: War3Source_[Cereal] NINJA.sp * Description: a race for War3Source. * Author(s): Cereal Killer + Ownz */ // War3Source stuff #pragma semicolon 1 #include <sourcemod> #include "W3SIncs/War3Source_Interface" #include <sdktools> #include <sdktools_functions> #include <sdktools_tempents> #include <sdktools_tempents_stocks> #include <sdkhooks> new thisRaceID; new Float:InvisibilityAlpha[7]={1.0,0.85,0.70,0.65,0.55,0.45,0.4}; new Float:SkillLongJump[7]={0.0,2.0,2.5,3.0,4.5,5.0,5.5}; new Float:DodgeChance[7]={0.0,0.05,0.10,0.15,0.20,0.25,0.3}; new Float:VanishChance[7]={0.0,0.04,0.7,0.11,0.14,0.17,0.2}; new Handle:ultRangeCvar; new g_offsCollisionGroup; new m_vecVelocity_0, m_vecVelocity_1, m_vecBaseVelocity; new Float:ASSASSINATION_cooldown[7]={40.0,35.0,30.0,25.0,20.0,15.0,10.0}; new String:ultimateSound[]="ambient/office/coinslot1.wav"; new SKILL_INVIS, SKILL_LONGJUMP, SKILL_DODGE, SKILL_VANISH, ULT_ASSASSINATION; public Plugin:myinfo = { name = "War3Source Race - Ninja", author = "Cereal Killer + Ownz ", description = "The Ninja race for War3Source.", version = "1.0.0.0", url = "http://war3source.com" }; // War3Source Functions public OnPluginStart() { ultRangeCvar=CreateConVar("war3_ninja_ult_range","99999","Range of ninja assination ultimate"); g_offsCollisionGroup = FindSendPropOffs("CBaseEntity", "m_CollisionGroup"); m_vecVelocity_0 = FindSendPropOffs("CBasePlayer","m_vecVelocity[0]"); m_vecVelocity_1 = FindSendPropOffs("CBasePlayer","m_vecVelocity[1]"); m_vecBaseVelocity = FindSendPropOffs("CBasePlayer","m_vecBaseVelocity"); HookEvent("player_jump",PlayerJumpEvent); } public OnClientPutInServer(client) { SDKHook(client, SDKHook_WeaponCanUse, OnWeaponCanUse); } public Action:OnWeaponCanUse(client, weapon) { if(War3_GetRace(client)==thisRaceID) { decl String:name[64]; GetEdictClassname(weapon, name, sizeof(name)); if(!StrEqual(name, "weapon_knife", false)){ return Plugin_Handled; } } return Plugin_Continue; } public OnWar3LoadRaceOrItemOrdered2(num) { if(num==180) { thisRaceID=War3_CreateNewRace("[Cereal] Ninja","ninja"); SKILL_INVIS=War3_AddRaceSkill(thisRaceID,"Camo","blend in with the environment",false,6); SKILL_LONGJUMP=War3_AddRaceSkill(thisRaceID,"Long Jump","Jump farther",false,6); SKILL_DODGE=War3_AddRaceSkill(thisRaceID,"Dodge Bullets","Evade Bullets",false,6); SKILL_VANISH=War3_AddRaceSkill(thisRaceID,"Vanish","Chance to vanish into thin air when hit",false,6); ULT_ASSASSINATION=War3_AddRaceSkill(thisRaceID,"Assassination","Get behind a random enemy",true,6); War3_CreateRaceEnd(thisRaceID); } } // ************************************************************* public OnMapStart() { War3_PrecacheSound(ultimateSound); } new Float:pOsition[3]; public OnUltimateCommand(client,race,bool:pressed) { new userid=GetClientUserId(client); if(race==thisRaceID && pressed && userid>1 && IsPlayerAlive(client) ) { new ult_level=War3_GetSkillLevel(client,race,ULT_ASSASSINATION); if(ult_level>0) { if(War3_SkillNotInCooldown(client,thisRaceID,ULT_ASSASSINATION,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(War3_ValidPlayer(i,true)&&GetClientTeam(i)!=team&&!War3_GetImmunity(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,"No Target Found"); } else { new damage=RoundFloat(float(War3_GetMaxHP(bestTarget))/2.0); if(damage>0) { War3_CachedPosition(bestTarget,Float:pOsition); TeleportEntity(client,pOsition,NULL_VECTOR,NULL_VECTOR); SetEntData(bestTarget, g_offsCollisionGroup, 2, 4, true); EmitSoundToAll(ultimateSound,client); CooldownUltimate(client); } } } } else { PrintHintText(client,"Level Your Ultimate First"); } } } public CooldownUltimate(client) { new skilllevel_assassination=War3_GetSkillLevel(client,thisRaceID,ULT_ASSASSINATION); War3_CooldownMGR(client,ASSASSINATION_cooldown[skilllevel_assassination],thisRaceID,ULT_ASSASSINATION,false,false,_,"Assasination"); } public OnRaceSelected(client,newrace) { if(newrace!=thisRaceID) { War3_SetBuff(client,fInvisibilitySkill,thisRaceID,1.0); War3_SetBuff(client,fMaxSpeed,thisRaceID,1.0); } else { ActivateSkills(client); } } // ************************************************************************************************* public ActivateSkills(client) { if(War3_GetRace(client)==thisRaceID) { new skilllevel=War3_GetSkillLevel(client,thisRaceID,SKILL_INVIS); new Float:alpha=InvisibilityAlpha[skilllevel]; War3_SetBuff(client,fInvisibilitySkill,thisRaceID,alpha); SetEntData(client, g_offsCollisionGroup, 2, 4, true); } } public OnSkillLevelChanged(client,race,skill,newskilllevel) { if(War3_GetRace(client)==thisRaceID) { ActivateSkills(client); } } public Action:OnWar3TakeDamage(victim,attacker,inflictor,Float:damage,damagetype) { new skill_level_dodge=War3_GetSkillLevel(victim,thisRaceID,SKILL_DODGE); if(victim==thisRaceID && skill_level_dodge>0 &&GetClientTeam(attacker)!=GetClientTeam(victim)) { if(GetRandomFloat(0.0,1.0)<=DodgeChance[skill_level_dodge] && !War3_GetImmunity(attacker,Immunity_Skills)) { War3_FlashScreen(victim,RGBA_COLOR_BLUE); War3_DamageModPercent(0.0); //NO DAMAMGE } } } public OnWar3EventPostHurt(victim,attacker,dmg){ if(War3_ValidPlayer(victim,true)&&War3_GetRace(victim)==thisRaceID){ new skilllevel=War3_GetSkillLevel(victim,thisRaceID,SKILL_VANISH); if(skilllevel>0&&War3_Chance(VanishChance[skilllevel])){ PrintHintText(victim,"You disapear in the shadows"); War3_SetBuff(victim,fInvisibilitySkill,thisRaceID,0); CreateTimer(1.5,Invis1,victim); } } } public Action:Invis1(Handle:timer,any:victim) { if(War3_GetRace(victim)==thisRaceID) { new skilllevel=War3_GetSkillLevel(victim,thisRaceID,SKILL_INVIS); War3_SetBuff(victim,fInvisibilitySkill,thisRaceID,InvisibilityAlpha[skilllevel]); } else{ War3_SetBuff(victim,fInvisibilitySkill,thisRaceID,1.0); } } public OnWar3EventSpawn(client) { new race=War3_GetRace(client); if(race==thisRaceID) { War3_SetMaxHP(client,War3_GetMaxHP(client)-60); ActivateSkills(client); } } public PlayerJumpEvent(Handle:event,const String:name[],bool:dontBroadcast) { new client=GetClientOfUserId(GetEventInt(event,"userid")); if(War3_GetRace(client)==thisRaceID){ new skilllevel=War3_GetSkillLevel(client,thisRaceID,SKILL_LONGJUMP); if(skilllevel>0){ new Float:velocity[3]={0.0,0.0,0.0}; velocity[0]= GetEntDataFloat(client,m_vecVelocity_0); velocity[1]= GetEntDataFloat(client,m_vecVelocity_1); velocity[0]*=SkillLongJump[skilllevel]*0.25; velocity[1]*=SkillLongJump[skilllevel]*0.25; SetEntDataVector(client,m_vecBaseVelocity,velocity,true); } } } This race contains 4 skills and 6 level for a max of 24 total levels. -The first skill is Camo which make you invisible. -The second skill is Long Jump which make you jump longer. -The third skill is dodge bullets which make you evade enemy damage. -The ultimate is Assassination, which is basically smoke and mirrors for old WCS ninja but for War3: Source and coded by me :D. -There is one pre-leveled skill or wtv you would call it xD. when someone shoots you it turn you 100% for 1 second but still take damage ofc. -You spawn with 40 HP and a knife. Again thx to TC and Ownz for helping me *Edit : I changed the race. Ownz help me on improving my race it was OP before according to him. Dont worry, ultimate hasn't changed. Im too lazy to reenter changes but most importantly there another skill and thats taking the pre-leveled skill and turning it into a real on xD. so theres a fifth skill named vanish. **Edit: i fixed an error that evryone turned 100% invis thx to syther O.o :-\ Title: Re: [need feedback/testing] Ninja, by Cereal Killer Post by: Scyther on August 03, 2010, 01:06:54 AM When i used this race everyone became 100% invisible and the message "You disappeared into the shadows" popped up on all races .
Title: Re: [need feedback/testing] Ninja, by Cereal Killer Post by: Ownz on August 03, 2010, 08:05:37 AM need race check
public OnWar3EventPostHurt(victim,attacker,dmg){ if(War3_ValidPlayer(victim,true)){ Title: Re: [need feedback/testing] Ninja, by Cereal Killer Post by: cerealkiller on August 03, 2010, 03:29:22 PM When i used this race everyone became 100% invisible and the message "You disappeared into the shadows" popped up on all races . i fixed that adding a if(War3_GetRace(client)==thisRaceID)... (should be updated in code) srry n00bish error its my first race xP thx Ownz again... Title: Re: [need feedback/testing] Ninja, by Cereal Killer Post by: [Oddity]TeacherCreature on August 07, 2010, 10:44:17 AM Ur pass players so u dont get stuck on them will not work
also even if it would work the way u have it set up ur in no collission group all round, and if it worked u would have trouble knifing people. You also at no point ever remove no collilsion group so if u change race it is still on, and if u use ultiamte enough to target everyone then everyone would be on it all the time to turn collisions on for other players set tehre baseclass group to 5 Title: Re: [need feedback/testing] Ninja, by Cereal Killer Post by: nvn on August 26, 2010, 06:40:06 AM i've fixed weapon restriction to prevent bug that allow ppl use weapons when playing ninja
but when they switching back to another race , they cant use anything exept knife Quote public OnRaceSelected(client,newrace) red was added by me{ if(newrace != thisRaceID) { War3_WeaponRestrictTo(client,thisRaceID,""); War3_SetBuff(client,fInvisibilitySkill,thisRaceID,1.0); War3_SetBuff(client,fMaxSpeed,thisRaceID,1.0); } if(newrace == thisRaceID) { War3_WeaponRestrictTo(client,thisRaceID,"weapon_knife"); } else { ActivateSkills(client); } } _ solved Title: Re: [need feedback/testing] Ninja, by Cereal Killer Post by: nathanrr44 on August 30, 2010, 09:41:28 AM can you release 1.6B+ compatible please
Title: Re: [need feedback/testing] Ninja, by Cereal Killer Post by: Schmarotzer on September 09, 2010, 08:13:42 PM can you release 1.6B+ compatible please Code: /** * File: War3Source_[Cereal] NINJA.sp * Description: a race for War3Source. * Author(s): Cereal Killer + Ownz */ // War3Source stuff #pragma semicolon 1 #include <sourcemod> #include "W3SIncs/War3Source_Interface" #include <sdktools> #include <sdktools_functions> #include <sdktools_tempents> #include <sdktools_tempents_stocks> #include <sdkhooks> new thisRaceID; new Float:InvisibilityAlpha[7]={1.0,0.85,0.70,0.65,0.55,0.45,0.4}; new Float:SkillLongJump[7]={0.0,2.0,2.5,3.0,4.5,5.0,5.5}; new Float:DodgeChance[7]={0.0,0.05,0.10,0.15,0.20,0.25,0.3}; new Float:VanishChance[7]={0.0,0.04,0.7,0.11,0.14,0.17,0.2}; new Handle:ultRangeCvar; new g_offsCollisionGroup; new m_vecVelocity_0, m_vecVelocity_1, m_vecBaseVelocity; new Float:ASSASSINATION_cooldown[7]={40.0,35.0,30.0,25.0,20.0,15.0,10.0}; new String:ultimateSound[]="ambient/office/coinslot1.wav"; new SKILL_INVIS, SKILL_LONGJUMP, SKILL_DODGE, SKILL_VANISH, ULT_ASSASSINATION; public Plugin:myinfo = { name = "War3Source Race - Ninja", author = "Cereal Killer + Ownz ", description = "The Ninja race for War3Source.", version = "1.0.0.0", url = "http://war3source.com" }; // War3Source Functions public OnPluginStart() { ultRangeCvar=CreateConVar("war3_ninja_ult_range","99999","Range of ninja assination ultimate"); g_offsCollisionGroup = FindSendPropOffs("CBaseEntity", "m_CollisionGroup"); m_vecVelocity_0 = FindSendPropOffs("CBasePlayer","m_vecVelocity[0]"); m_vecVelocity_1 = FindSendPropOffs("CBasePlayer","m_vecVelocity[1]"); m_vecBaseVelocity = FindSendPropOffs("CBasePlayer","m_vecBaseVelocity"); HookEvent("player_jump",PlayerJumpEvent); } public OnClientPutInServer(client) { SDKHook(client, SDKHook_WeaponCanUse, OnWeaponCanUse); } public Action:OnWeaponCanUse(client, weapon) { if(War3_GetRace(client)==thisRaceID) { decl String:name[64]; GetEdictClassname(weapon, name, sizeof(name)); if(!StrEqual(name, "weapon_knife", false)){ return Plugin_Handled; } } return Plugin_Continue; } public OnWar3LoadRaceOrItemOrdered2(num) { if(num==180) { thisRaceID=War3_CreateNewRace("[Cereal] Ninja","ninja"); SKILL_INVIS=War3_AddRaceSkill(thisRaceID,"Camo","blend in with the environment",false,6); SKILL_LONGJUMP=War3_AddRaceSkill(thisRaceID,"Long Jump","Jump farther",false,6); SKILL_DODGE=War3_AddRaceSkill(thisRaceID,"Dodge Bullets","Evade Bullets",false,6); SKILL_VANISH=War3_AddRaceSkill(thisRaceID,"Vanish","Chance to vanish into thin air when hit",false,6); ULT_ASSASSINATION=War3_AddRaceSkill(thisRaceID,"Assassination","Get behind a random enemy",true,6); War3_CreateRaceEnd(thisRaceID); } } // ************************************************************* public OnMapStart() { War3_PrecacheSound(ultimateSound); } new Float:pOsition[3]; public OnUltimateCommand(client,race,bool:pressed) { new userid=GetClientUserId(client); if(race==thisRaceID && pressed && userid>1 && IsPlayerAlive(client) ) { new ult_level=War3_GetSkillLevel(client,race,ULT_ASSASSINATION); if(ult_level>0) { if(War3_SkillNotInCooldown(client,thisRaceID,ULT_ASSASSINATION,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,"No Target Found"); } else { new damage=RoundFloat(float(War3_GetMaxHP(bestTarget))/2.0); if(damage>0) { War3_CachedPosition(bestTarget,Float:pOsition); TeleportEntity(client,pOsition,NULL_VECTOR,NULL_VECTOR); SetEntData(bestTarget, g_offsCollisionGroup, 2, 4, true); EmitSoundToAll(ultimateSound,client); CooldownUltimate(client); } } } } else { PrintHintText(client,"Level Your Ultimate First"); } } } public CooldownUltimate(client) { new skilllevel_assassination=War3_GetSkillLevel(client,thisRaceID,ULT_ASSASSINATION); War3_CooldownMGR(client,ASSASSINATION_cooldown[skilllevel_assassination],thisRaceID,ULT_ASSASSINATION,false,false,_,"Assasination"); } public OnRaceSelected(client,newrace) { if(newrace!=thisRaceID) { War3_SetBuff(client,fInvisibilitySkill,thisRaceID,1.0); War3_SetBuff(client,fMaxSpeed,thisRaceID,1.0); } else { ActivateSkills(client); } } // ************************************************************************************************* public ActivateSkills(client) { if(War3_GetRace(client)==thisRaceID) { new skilllevel=War3_GetSkillLevel(client,thisRaceID,SKILL_INVIS); new Float:alpha=InvisibilityAlpha[skilllevel]; War3_SetBuff(client,fInvisibilitySkill,thisRaceID,alpha); SetEntData(client, g_offsCollisionGroup, 2, 4, true); } } public OnSkillLevelChanged(client,race,skill,newskilllevel) { if(War3_GetRace(client)==thisRaceID) { ActivateSkills(client); } } public OnW3TakeDmgAll(victim,attacker,Float:damage) /** public Action:OnWar3TakeDamage(victim,attacker,inflictor,Float:damage,damagetype) **/ { new skill_level_dodge=War3_GetSkillLevel(victim,thisRaceID,SKILL_DODGE); if(victim==thisRaceID && skill_level_dodge>0 &&GetClientTeam(attacker)!=GetClientTeam(victim)) { if(GetRandomFloat(0.0,1.0)<=DodgeChance[skill_level_dodge] && !W3HasImmunity(attacker,Immunity_Skills)) { W3FlashScreen(victim,RGBA_COLOR_BLUE); War3_DamageModPercent(0.0); //NO DAMAMGE } } } public OnWar3EventPostHurt(victim,attacker,dmg){ if(ValidPlayer(victim,true)&&War3_GetRace(victim)==thisRaceID){ new skilllevel=War3_GetSkillLevel(victim,thisRaceID,SKILL_VANISH); if(skilllevel>0&&War3_Chance(VanishChance[skilllevel])){ PrintHintText(victim,"You disapear in the shadows"); War3_SetBuff(victim,fInvisibilitySkill,thisRaceID,0); CreateTimer(1.5,Invis1,victim); } } } public Action:Invis1(Handle:timer,any:victim) { if(War3_GetRace(victim)==thisRaceID) { new skilllevel=War3_GetSkillLevel(victim,thisRaceID,SKILL_INVIS); War3_SetBuff(victim,fInvisibilitySkill,thisRaceID,InvisibilityAlpha[skilllevel]); } else{ War3_SetBuff(victim,fInvisibilitySkill,thisRaceID,1.0); } } public OnWar3EventSpawn(client) { new race=War3_GetRace(client); if(race==thisRaceID) { War3_SetMaxHP(client,War3_GetMaxHP(client)-60); ActivateSkills(client); } } public PlayerJumpEvent(Handle:event,const String:name[],bool:dontBroadcast) { new client=GetClientOfUserId(GetEventInt(event,"userid")); if(War3_GetRace(client)==thisRaceID){ new skilllevel=War3_GetSkillLevel(client,thisRaceID,SKILL_LONGJUMP); if(skilllevel>0){ new Float:velocity[3]={0.0,0.0,0.0}; velocity[0]= GetEntDataFloat(client,m_vecVelocity_0); velocity[1]= GetEntDataFloat(client,m_vecVelocity_1); velocity[0]*=SkillLongJump[skilllevel]*0.25; velocity[1]*=SkillLongJump[skilllevel]*0.25; SetEntDataVector(client,m_vecBaseVelocity,velocity,true); } } } Title: Re: [need feedback/testing] Ninja, by Cereal Killer Post by: cerealkiller on October 10, 2010, 05:08:51 PM add me to steam if you want all my recent races (about 5 or 6)
http://steamcommunity.com/id/cerealkiller135 ;D Title: Re: [need feedback/testing] Ninja, by Cereal Killer Post by: Chuck on March 23, 2011, 12:14:49 PM this race making my server crash when a person choose ninja race! Anyone know how to fix it? here is the log when person change race to Ninja...
3/ - player: UTIL_SetModel: not precached: models/player/techknow/tmnt/ninja.mdl 3/ - player: UTIL_SetModel: not precached: models/player/techknow/tmnt/ninja.mdl Title: Re: [need feedback/testing] Ninja, by Cereal Killer Post by: Zydu on March 24, 2011, 03:17:53 AM It seems you need to add models to meake it work.
http://techknowmodels.19.forumer.com/viewtopic.php?t=120 Title: Re: [need feedback/testing] Ninja, by Cereal Killer Post by: Chuck on March 24, 2011, 01:39:43 PM I have that model in my server and in fast download server!!! so it probably cause the race crashing i believe?
Title: Re: [need feedback/testing] Ninja, by Cereal Killer Post by: Schmarotzer on March 25, 2011, 07:56:42 AM 3/ - player: UTIL_SetModel: not precached: models/player/techknow/tmnt/ninja.mdl
3/ - player: UTIL_SetModel: not precached: models/player/techknow/tmnt/ninja.mdl Title: Re: [need feedback/testing] Ninja, by Cereal Killer Post by: Chuck on March 25, 2011, 12:58:24 PM Sweet i just fixed it!! all i did is look the different between 2 skin races file :)!! I didn't know what precached mean in sourcepawn
|