hi there everyone,
i just have a question, i want to update the salmon (summoning) code
i wanted to update it so it uses the sounds from sound_ability and i wanted to make
it a rage_clone and charge_salmon mix up, with an arg which allows people to make the summoned people
use an specifig model, health, class and weapon, the sound part is ok, but i need some help for the rest
im simply copied and modifit a little from rage_clone, but i probably made some mistakes there, every help
is welcome so i can learn and become better in scripting
Here is the Code:
Spoiler
Code:
Charge_New_Salmon(const String:ability_name[],index,slot,action)
{
new Float:charge=FF2_GetBossCharge(index,slot);
new Boss=GetClientOfUserId(FF2_GetBossUserId(index));
new var3=FF2_GetAbilityArgument(index,this_plugin_name,ability_name, 3); //sound
new var4=FF2_GetAbilityArgument(index,this_plugin_name,ability_name, 4); //summon_per_rage
new Float:duration=FF2_GetAbilityArgumentFloat(index,this_plugin_name,ability_name,5,3.0); //uber_protection
new var6=FF2_GetAbilityArgument(index,this_plugin_name,ability_name, 6); //Normal player with his loadout or players with specific class, weapon and model?
new bool:changemodel=bool:FF2_GetAbilityArgument(index,this_plugin_name,ability_name,7);
new weaponmode=FF2_GetAbilityArgument(index,this_plugin_name,ability_name,8);
switch (action)
{
case 1:
{
SetHudTextParams(-1.0, 0.88, 0.15, 255, 255, 255, 255);
ShowSyncHudText(Boss, jumpHUD, "%t","salmon_status_2",-RoundFloat(charge));
}
case 2:
{
SetHudTextParams(-1.0, 0.88, 0.15, 255, 255, 255, 255);
if (bEnableSuperDuperJump[index])
{
SetHudTextParams(-1.0, 0.88, 0.15, 255, 64, 64, 255);
ShowSyncHudText(Boss, jumpHUD,"%t","super_duper_jump");
}
else
ShowSyncHudText(Boss, jumpHUD, "%t","salmon_status",RoundFloat(charge));
}
case 3:
{
new Action:act = Plugin_Continue;
new super = bEnableSuperDuperJump[index];
Call_StartForward(OnHaleJump);
Call_PushCellRef(super);
Call_Finish(act);
if (act != Plugin_Continue && act != Plugin_Changed)
return;
if (act == Plugin_Changed) bEnableSuperDuperJump[index] = super;
decl Float:pos[3];
if (bEnableSuperDuperJump[index])
{
decl Float:vel[3];
decl Float:rot[3];
GetEntPropVector(Boss, Prop_Data, "m_vecVelocity", vel);
GetClientEyeAngles(Boss, rot);
vel[2]=750.0+500.0*charge/70+2000;
vel[0]+=Cosine(DegToRad(rot[0]))*Cosine(DegToRad(rot[1]))*500;
vel[1]+=Cosine(DegToRad(rot[0]))*Sine(DegToRad(rot[1]))*500;
bEnableSuperDuperJump[index]=false;
TeleportEntity(Boss, NULL_VECTOR, NULL_VECTOR, vel);
}
else
{
if(var3!=0)
{
EmitSoundToAll(ZEPH_SND);
EmitSoundToAll(ZEPH_SND);
}
new ii;
for (new i=0; i<var4; i++)
{
ii = GetRandomDeadPlayer();
if(ii != -1 && var6 == 0)
{
bSalmon = true;
FF2_SetFF2flags(ii,FF2_GetFF2flags(ii)|FF2FLAG_ALLOWSPAWNINBOSSTEAM);
ChangeClientTeam(ii,BossTeam);
TF2_RespawnPlayer(ii);
TF2_AddCondition(ii, TFCond_Ubercharged, duration);
}
else if(ii != -1 && var6 != 0)
{
bSalmon = true;
FF2_SetFF2flags(ii,FF2_GetFF2flags(ii)|FF2FLAG_ALLOWSPAWNINBOSSTEAM);
ChangeClientTeam(ii,BossTeam);
TF2_RespawnPlayer(ii);
{
decl weapon;
new Handle:BossKV[8];
decl String:s[PLATFORM_MAX_PATH];
decl String:bossname[32];
FF2_GetBossSpecial(index,bossname,32);
decl maxkv;
for(maxkv=0;maxkv<8;maxkv++)
{
if (!(BossKV[maxkv]=FF2_GetSpecialKV(maxkv)))
break;
}
if (IsValidEdict(ii) && IsClientConnected(ii) && !IsPlayerAlive(ii) && GetClientTeam(ii)>_:TFTeam_Spectator)
{
if (LastClass[ii] == TFClass_Unknown)
LastClass[ii] = TF2_GetPlayerClass(ii);
CloneOwnerIndex[ii]=index;
if (changemodel)
{
new see=GetRandomInt(0,maxkv-1);
TF2_SetPlayerClass(ii,TFClassType:KvGetNum(BossKV[see], "class",0));
KvGetString(BossKV[see], "model",s, PLATFORM_MAX_PATH);
SetVariantString(s);
AcceptEntityInput(ii, "SetCustomModel");
SetEntProp(ii, Prop_Send, "m_bUseClassAnimations",1);
}
switch (weaponmode)
{
case 0:
TF2_RemoveAllWeapons(ii);
case 1:
{
TF2_RemoveAllWeapons(ii);
weapon=SpawnWeapon(ii,"tf_weapon_shovel",264,34,0,"");
if (IsValidEdict(weapon))
{
SetEntPropEnt(ii, Prop_Send, "m_hActiveWeapon",weapon);
SetEntProp(weapon, Prop_Send, "m_iWorldModelIndex", -1);
}
}
}
}
}
new ent = MaxClients+1;
decl owner;
while ((ent = FindEntityByClassname(ent, "tf_wearable")) != -1)
{
if ((owner=GetEntPropEnt(ent, Prop_Send, "m_hOwnerEntity"))<=MaxClients && owner>0 && GetClientTeam(owner)==BossTeam)
AcceptEntityInput(ent, "kill");
}
while ((ent = FindEntityByClassname(ent, "tf_wearable_demoshield")) != -1)
{
if ((owner=GetEntPropEnt(ent, Prop_Send, "m_hOwnerEntity"))<=MaxClients && owner>0 && GetClientTeam(owner)==BossTeam)
AcceptEntityInput(ent, "kill");
}
TF2_AddCondition(ii, TFCond_Ubercharged, duration);
}
}
}
decl String:s[PLATFORM_MAX_PATH];
if (FF2_RandomSound("sound_ability",s,PLATFORM_MAX_PATH,index,slot))
{
EmitSoundToAll(s, Boss, _, SNDLEVEL_TRAFFIC, SND_NOFLAGS, SNDVOL_NORMAL, 100, Boss, pos, NULL_VECTOR, true, 0.0);
EmitSoundToAll(s, Boss, _, SNDLEVEL_TRAFFIC, SND_NOFLAGS, SNDVOL_NORMAL, 100, Boss, pos, NULL_VECTOR, true, 0.0);
for (new i=1; i<=MaxClients; i++)
if (IsClientInGame(i) && i!=Boss)
{
EmitSoundToClient(i,s, Boss, _, SNDLEVEL_TRAFFIC, SND_NOFLAGS, SNDVOL_NORMAL, 100, Boss, pos, NULL_VECTOR, true, 0.0);
EmitSoundToClient(i,s, Boss, _, SNDLEVEL_TRAFFIC, SND_NOFLAGS, SNDVOL_NORMAL, 100, Boss, pos, NULL_VECTOR, true, 0.0);
}
}
}
}
}
And the ability i use in the boss config:
Spoiler
Code:
"abilityX" (normally 2, but i used here X for some reason)
{
"name" "charge_new_salmon"
"arg0" "1" // Ability Slot. Do not change!
"arg1" "3" // (No. of Seconds to Charge to 100%)
"arg2" "73" // (No. of Seconds of Charge Cooldown)
"arg3" "1" // Sound (0 = No sound when hale summon. 1 = Play sound when hale summon.)
"arg4" "5" // (No. of max players to be summoned per Charge.)
"arg5" "3.0" // Duration (No. of Seconds of Uber Protection for players that were just summoned.)
"arg6" "5"
"arg7" "1"
"arg8" "1"
"arg9" "models/customfleetings/spy/announcer/spy.mdl"
"arg10" "8"
"arg11" "0.0001"
"arg12" "tf_weapon_knife"
"arg13" "4"
"arg14" "68 ; -1"
//68: -1x cap rate
"arg15" "0"
"arg16" "0"
"arg17" "125"
"plugin_name" "M7_abilities"
}