Raised This Month: $4 Target: $400
 1% 

FF2 [Subplugin] Summon a boss


Post New Thread Reply   
 
Thread Tools Display Modes
LeAlex14
Member
Join Date: Jun 2020
Location: La France
Old 02-05-2021 , 15:12   Re: [Subplugin] Summon a boss
Reply With Quote #11

Quote:
Originally Posted by J0BL3SS View Post
Code:
public void OnPluginStart()
{
	HookEvent("arena_round_start", Event_RoundStart);
	HookEvent("teamplay_round_active", Event_RoundStart); // for non-arena maps
}
public void Event_RoundStart(Event event, const char[] name, bool dontBroadcast)
{
	MainBoss_PrepareAbilities();
	CreateTimer(1.0, TimerHookSpawn, _, TIMER_FLAG_NO_MAPCHANGE);
}

public Action TimerHookSpawn(Handle timer)
{
	HookEvent("player_spawn", Event_PlayerSpawn);
}

public void Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast)
{
	int iClient = GetEventInt(event, "userid");
	if(!GetClientOfUserId(iClient))
	{
		CreateTimer(0.2, SummonedBoss_PrepareAbilities, GetClientOfUserId(iClient), TIMER_FLAG_NO_MAPCHANGE);
	}
	else
	{
		LogError("ERROR: Invalid client index. %s:Event_PlayerSpawn()", this_plugin_name);
	}
}

public void MainBoss_PrepareAbilities()
{
	if(!FF2_IsFF2Enabled() || FF2_GetRoundState() != 1)
	{
		LogError("ERROR: Abilitypack called when round is over or when gamemode is not FF2. %s:MainBoss_PrepareAbilities()", this_plugin_name);
		return;
	}
	for(int bossClientIdx = 1; bossClientIdx < MaxClients; bossClientIdx++)
	{
		int bossIdx = FF2_GetBossIndex(bossClientIdx);
		if(bossIdx >= 0)
		{
			HookAbilities(bossIdx, bossClientIdx);
		}
	}
}

public Action SummonedBoss_PrepareAbilities(Handle timer, int bossClientIdx)
{
	if(!bossClientIdx)
	{
		int bossIdx = FF2_GetBossIndex(bossClientIdx);
		if(bossIdx >= 0)
		{
			HookAbilities(bossIdx, bossClientIdx);
		}
		else
		{
			PrintToServer("WARNING: Respawned player has no boss index. %s:SummonedBoss_PrepareAbilities()", this_plugin_name);
			//LogError("WARNING: Respawned player has no boss index. %s:SummonedBoss_PrepareAbilities()", this_plugin_name);
		}
	}
	else
	{
		LogError("ERROR: Unable to find respawned player. %s:SummonedBoss_PrepareAbilities()", this_plugin_name);
	}
}

public void HookAbilities(int bossIdx, int bossClientIdx)
{
	//Define Your Ability Arguments, do things ...
	//My Rage
	if(FF2_HasAbility(bossIdx, this_plugin_name, "rage_myability"))
	{
		//AMS Triggers
		AMS_TEST[bossClientIdx] = AMS_IsSubabilityReady(bossIdx, this_plugin_name, "rage_myability");
		if(AMS_TEST[bossClientIdx])
		{
			AMS_InitSubability(bossIdx, bossClientIdx, this_plugin_name, "rage_myability", "TEST");
		}
		MyAbility_Duration[bossClientIdx] = FF2_GetAbilityArgumentFloat(bossIdx, this_plugin_name, "rage_myability", 1, 10.0);
		MyAbility_Distance[bossClientIdx] = FF2_GetAbilityArgumentFloat(bossIdx, this_plugin_name, "rage_myability", 2, 1024.0);
	}
}
This is what i did to make compatible my subplugins to future usage.
Ams doesn't works with summoned boss, i mean, summoned boss cannot use ams
LeAlex14 is offline
Tim q
Senior Member
Join Date: Aug 2020
Old 03-12-2021 , 21:31   Re: [Subplugin] Summon a boss
Reply With Quote #12

What about sounds when boss is summoned?
Tim q is offline
LeAlex14
Member
Join Date: Jun 2020
Location: La France
Old 03-13-2021 , 05:26   Re: [Subplugin] Summon a boss
Reply With Quote #13

Quote:
Originally Posted by Tim q View Post
What about sounds when boss is summoned?
Use rage sound or menu ability sounds
LeAlex14 is offline
J0BL3SS
Senior Member
Join Date: Sep 2020
Location: Turkey
Old 03-13-2021 , 07:49   Re: [Subplugin] Summon a boss
Reply With Quote #14

Code:
public void OnPluginStart2()
{
	HookEvent("arena_round_start", Event_RoundStart);
	HookEvent("teamplay_round_active", Event_RoundStart); // for non-arena maps
	
	HookEvent("arena_win_panel", Event_RoundEnd);
	HookEvent("teamplay_round_win", Event_RoundEnd); // for non-arena maps
}

public void Event_RoundStart(Event event, const char[] name, bool dontBroadcast)
{
	ClearEverything();
	
	MainBoss_PrepareAbilities();
	CreateTimer(1.0, TimerHookSpawn, _, TIMER_FLAG_NO_MAPCHANGE);
}

public Action TimerHookSpawn(Handle timer)
{
	HookEvent("player_spawn", Event_PlayerSpawn);
}

public void Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast)
{
	int UserIdx = GetEventInt(event, "userid");
	
	if(IsValidClient(GetClientOfUserId(UserIdx)))
	{
		CreateTimer(0.3, SummonedBoss_PrepareAbilities, UserIdx, TIMER_FLAG_NO_MAPCHANGE);
	}
	else
	{
		FF2_LogError("ERROR: Invalid client index. %s:Event_PlayerSpawn()", this_plugin_name);
	}
}

public Action SummonedBoss_PrepareAbilities(Handle timer, int UserIdx)
{
	if(!FF2_IsFF2Enabled() || FF2_GetRoundState() != 1)
		return;

	int bossClientIdx = GetClientOfUserId(UserIdx);
	if(IsValidClient(bossClientIdx))
	{
		int bossIdx = FF2_GetBossIndex(bossClientIdx);
		if(bossIdx >= 0)
		{
			HookAbilities(bossIdx, bossClientIdx);
		}
	}
	else
	{
		FF2_LogError("ERROR: Unable to find respawned player. %s:SummonedBoss_PrepareAbilities()", this_plugin_name);
	}
}


public void MainBoss_PrepareAbilities()
{
	if(!FF2_IsFF2Enabled() || FF2_GetRoundState() != 1)
	{
		FF2_LogError("ERROR: Abilitypack called when round is over or when gamemode is not FF2. %s:MainBoss_PrepareAbilities()", this_plugin_name);
		return;
	}
	for(int bossClientIdx = 1; bossClientIdx <= MaxClients; bossClientIdx++)
	{
		int bossIdx = FF2_GetBossIndex(bossClientIdx);
		if(bossIdx >= 0)
		{
			HookAbilities(bossIdx, bossClientIdx);
		}
	}
}


public void Event_RoundEnd(Event event, const char[] name, bool dontBroadcast)
{
	ClearEverything();
}

public void HookAbilities(int bossIdx, int bossClientIdx)
{
	if(bossIdx >= 0)
	{
		//Hook the global variables, abilities.
	}
}
Currently What im using in my abilitypacks to be make compatible with ff2_summonaboss
__________________
My Steam Profile
My Discord Name: J0BL3SS#5320
J0BL3SS is offline
LeAlex14
Member
Join Date: Jun 2020
Location: La France
Old 03-13-2021 , 09:39   Re: [Subplugin] Summon a boss
Reply With Quote #15

Quote:
Originally Posted by J0BL3SS View Post
Code:
public void OnPluginStart2()
{
	HookEvent("arena_round_start", Event_RoundStart);
	HookEvent("teamplay_round_active", Event_RoundStart); // for non-arena maps
	
	HookEvent("arena_win_panel", Event_RoundEnd);
	HookEvent("teamplay_round_win", Event_RoundEnd); // for non-arena maps
}

public void Event_RoundStart(Event event, const char[] name, bool dontBroadcast)
{
	ClearEverything();
	
	MainBoss_PrepareAbilities();
	CreateTimer(1.0, TimerHookSpawn, _, TIMER_FLAG_NO_MAPCHANGE);
}

public Action TimerHookSpawn(Handle timer)
{
	HookEvent("player_spawn", Event_PlayerSpawn);
}

public void Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast)
{
	int UserIdx = GetEventInt(event, "userid");
	
	if(IsValidClient(GetClientOfUserId(UserIdx)))
	{
		CreateTimer(0.3, SummonedBoss_PrepareAbilities, UserIdx, TIMER_FLAG_NO_MAPCHANGE);
	}
	else
	{
		FF2_LogError("ERROR: Invalid client index. %s:Event_PlayerSpawn()", this_plugin_name);
	}
}

public Action SummonedBoss_PrepareAbilities(Handle timer, int UserIdx)
{
	if(!FF2_IsFF2Enabled() || FF2_GetRoundState() != 1)
		return;

	int bossClientIdx = GetClientOfUserId(UserIdx);
	if(IsValidClient(bossClientIdx))
	{
		int bossIdx = FF2_GetBossIndex(bossClientIdx);
		if(bossIdx >= 0)
		{
			HookAbilities(bossIdx, bossClientIdx);
		}
	}
	else
	{
		FF2_LogError("ERROR: Unable to find respawned player. %s:SummonedBoss_PrepareAbilities()", this_plugin_name);
	}
}


public void MainBoss_PrepareAbilities()
{
	if(!FF2_IsFF2Enabled() || FF2_GetRoundState() != 1)
	{
		FF2_LogError("ERROR: Abilitypack called when round is over or when gamemode is not FF2. %s:MainBoss_PrepareAbilities()", this_plugin_name);
		return;
	}
	for(int bossClientIdx = 1; bossClientIdx <= MaxClients; bossClientIdx++)
	{
		int bossIdx = FF2_GetBossIndex(bossClientIdx);
		if(bossIdx >= 0)
		{
			HookAbilities(bossIdx, bossClientIdx);
		}
	}
}


public void Event_RoundEnd(Event event, const char[] name, bool dontBroadcast)
{
	ClearEverything();
}

public void HookAbilities(int bossIdx, int bossClientIdx)
{
	if(bossIdx >= 0)
	{
		//Hook the global variables, abilities.
	}
}
Currently What im using in my abilitypacks to be make compatible with ff2_summonaboss
Also, did you find some issues with summon boss ?
LeAlex14 is offline
Tim q
Senior Member
Join Date: Aug 2020
Old 03-17-2021 , 20:20   Re: [Subplugin] Summon a boss
Reply With Quote #16

Somebody knows how to remove queue loss points when boss is summoned?
Tim q is offline
LeAlex14
Member
Join Date: Jun 2020
Location: La France
Old 03-18-2021 , 05:56   Re: [Subplugin] Summon a boss
Reply With Quote #17

The plugin already prevent that, point are added at the end of the round
LeAlex14 is offline
Tim q
Senior Member
Join Date: Aug 2020
Old 03-19-2021 , 06:28   Re: [Subplugin] Summon a boss
Reply With Quote #18

Quote:
Originally Posted by LeAlex14 View Post
The plugin already prevent that, point are added at the end of the round
Em nope it don't works all of people lose points forever.
Tim q is offline
LeAlex14
Member
Join Date: Jun 2020
Location: La France
Old 03-20-2021 , 06:13   Re: [Subplugin] Summon a boss
Reply With Quote #19

Quote:
Originally Posted by Tim q View Post
Em nope it don't works all of people lose points forever.
Ok, i'll see that later, I'm on another project rn
LeAlex14 is offline
Tim q
Senior Member
Join Date: Aug 2020
Old 03-20-2021 , 10:54   Re: [Subplugin] Summon a boss
Reply With Quote #20

Okay thx. I am waitnig for fix.
Tim q is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:23.


Powered by vBulletin®
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Theme made by Freecode