Quote:
Originally Posted by LordHotPocketHomicide
For a long time now, I've had an idea for a Hale that would progressively get stronger at certain points in his BGM (background music). For example, at, say, 1:47, he would get a new ability, and each time stamp and its new abilities could be specified within the plugin's args. And whenever the Hale gains a new ability, it would be announced via a custom message that would appear at the top of the screen (like sm_csay), which would also be specified in the args. Would such a thing be possible? If so, how could I make it, if it doesn't already exist?
|
It's possible. For a basic plugin, you can use simple timers, which is specified in seconds by the arg
something like
Code:
#define NEWABILITY "special_newability"
float abilitytime[3];
public void ArenaRoundStart(Event event, const char[] name, bool dontBroadcast)
{
for(int client=MaxClients; client; client--)
{
if(!IsValidClient(client))
{
continue;
}
int boss=FF2_GetBossIndex(client);
if(boss>=0 && FF2_HasAbility(boss, THIS_PLUGIN_NAME, NEWABILITY))
{
abilitytime[0]=FF2_GetAbilityArgumentFloat(boss, THIS_PLUGIN_NAME, NEWABILITY, 1);
CreateTimer(abilitytime[0], Timer_NewAbility, boss, TIMER_FLAG_NO_MAPCHANGE);
}
}
}
public Action Timer_NewAbility(Handle timer, any boss)
{
static int newabilities=0;
switch(newabilities)
{
case 0: // new ability 1
{
PrintCenterTextAll("%t", "newability1");
}
case 1: // new ability 2
{
PrintCenterTextAll("%t", "newability2");
}
case 2: // new ability 3
{
PrintCenterTextAll("%t", "newability3");
}
}
if(newabilities>=2)
{
newabilities=0;
return Plugin_Stop;
}
abilitytime[1]=FF2_GetAbilityArgumentFloat(boss,THIS_PLUGIN_NAME, NEWABILITY, 2);
abilitytime[2]=FF2_GetAbilityArgumentFloat(boss,THIS_PLUGIN_NAME, NEWABILITY, 3);
CreateTimer(abilitytime[newabilities==0 ? 1:2], Timer_NewAbility, boss, TIMER_FLAG_NO_MAPCHANGE);
newabilities+=1;
return Plugin_Continue;
}
stock bool IsValidClient(int clientIdx, bool aliveOnly=false)
{
if (clientIdx<=0 || clientIdx>=MAX_PLAYERS || clientIdx>MaxClients) return false;
if(aliveOnly) return IsClientInGame(clientIdx) && IsPlayerAlive(clientIdx);
return IsClientInGame(clientIdx);
}
__________________