Raised This Month: $32 Target: $400
 8% 

FF2 [Subplugin] Summon a boss


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LeAlex14
Member
Join Date: Jun 2020
Location: La France
Old 02-03-2021 , 04:03   [Subplugin] Summon a boss
Reply With Quote #1

I really like minions or clones... But sometimes, we need another boss, so I create this plugin (I just pick a function of BatFox's ff2 code, really, I do nothing). I also really like the idea of red backup, but sometimes, the backup wasn't really strong vs the boss.
So this plugin add 2 new ability, summon a boss (works like clones) or summon a red boss backup.
Code:
"ability5"
	{
		"name"		"Summon_Another_Boss0"

		"arg1"		"0" // Boss Index in character.cfg -1 (yes, don't works if you don't set that) I don't mention it but you can put a lot of index and the plugin choose a random ("1 ; 2 ; 3")
		"arg2"		"2"	// Number of boss
		
		"arg3"		"2" // HP Mode (works with arg4) : 1 = Defined Hp; 2 = % Summoner Max Hp; 3 = % Summoned boss Hp in normal mode
		"arg4"		"65" // HP receive (% if arg3 = 2 or 3)
		
		"arg5"		"4" // Lives Mode (works with arg6) : 1 = If summoned have multiple life, add new life number and maxnumber; 2 = If summoned have multiple life, add % of summoned life number and maxnumber; 3 = % Summoner life; 4 = Add life and max life
		"arg6"		"1" // Lives receive (% if arg3 = 2 or 3)
		
		"arg7"		"2" // Damage rage Mode (works with arg8) : 1 = Defined Rage damage; 2 = % Summoner Rage Damage; 3 = % Summoned rage damage in normal mode
		"arg8"		"75" // Damage rage needed (% if arg3 = 2 or 3)
		
		"arg9"		"1" // 0 = at the spawn, 1 = on the player
                 "arg10"            "0" // Trigger by ams 0 = no, 1 = yes

		"plugin_name"	"ff2_summonaboss"
	}
	
	"ability6"
	{
		"name"		"Boss_Merc_Backup"

		"arg1"		"3"	// Merc need to left
		"arg2"		"1"	// Boss Index in character.cfg -1 (yes, don't works if you don't set that) you can also put some index and the plugin choose randomly 1
		"arg3"		"1" // Number of boss
		
		"arg4"		"1" // HP Mode (works with arg5) : 1 = Defined Hp; 2 = % Boss with this ability Max Hp; 3 = % Summoned boss Hp in normal mode
		"arg5"		"5000" // HP receive (% if arg3 = 2 or 3)
		
		"arg6"		"4" // Lives Mode (works with arg7) : 1 = If summoned have multiple life, add new life number and maxnumber; 2 = If summoned have multiple life, add % of summoned life number and maxnumber; 3 = % Boss with this ability life; 4 = Add life and max life
		"arg7"		"3" // Lives receive (% if arg3 = 2 or 3)
		
		"arg8"		"1" // Damage rage Mode (works with arg9) : 1 = Defined Rage damage; 2 = % Boss with this ability Rage Damage; 3 = % Summoned rage damage in normal mode
		"arg9"		"2500" // Damage rage needed (% if arg3 = 2 or 3)
		
		"arg10"		"1"	// Backup mode 0 = infinite backup if another summoned boss have backup, 1 = 1 backup

		"plugin_name"	"ff2_summonaboss"
	}


I also join 2 plugin compatible with this boss spawn, Dynamics Defaults and Improved Saxton.
You can download the seeldier.cfg, and saxtinv2.cfg (download saxton hale v2 for ressource at this link) and place him into character.cfg like that:
Code:
"Freak Fortress 2"
{
	"1"		"seeldier"
	"2"		"saxtonv2"
}


WARNING You need compatible plugin because a lot of plugin works with on round start, so, you need to hook when a player spawn.

WARNING Ams are not compatible with summoned boss and i'll upload a version of summonaboss compatible with ams and with menu manager later (in 1/2 hours)


Example:
Code:
public OnPluginStart2()
{
	HookEvent("arena_round_start", event_round_start);
	HookEvent("teamplay_round_win", OnRoundEnd, EventHookMode_PostNoCopy);
}

public void OnRoundEnd(Event event, const char[] name, bool dontBroadcast)
{
	UnhookEvent("player_spawn",SpawnEvent);
}

public Action SpawnEvent(Handle event,const char[] name,bool dontBroadcast)
{
    int client_id = GetEventInt(event, "userid");
    int client = GetClientOfUserId(client_id);

    CreateTimer(0.5, IsASummondedBoss, client, TIMER_FLAG_NO_MAPCHANGE);
}

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

public Action IsASummondedBoss(Handle timer, int client)
{
     // Stuff in on round start for one player, example:
int boss = FF2_GetBossIndex(client);
	if(boss>=0 && (FF2_HasAbility(boss, this_plugin_name, "example")))
	{
		VarExample[client]=true;
	}
}


public Action:event_round_start(Handle event, const char[] name, bool dontBroadcast)
{
	for(new client=1;client<=MaxClients;client++)
	{
		new boss=FF2_GetBossIndex(client);
		if(boss>=0 && (FF2_HasAbility(boss, this_plugin_name, "example")))
		{
			VarExample[client]=true;
		}
	}
}
Credit:
Batfox for his amazing work with his plugin
Sarysa for all plugin

Change:
Add menu ability and ams

Project:
If you like this plugin, i'll try to make include files for easier compatibility
Attached Files
File Type: sp Get Plugin or Get Source (ff2_dynamic_defaults.sp - 191 views - 138.3 KB)
File Type: smx ff2_dynamic_defaults.smx (46.6 KB, 145 views)
File Type: sp Get Plugin or Get Source (improved_saxton.sp - 112 views - 109.3 KB)
File Type: smx improved_saxton.smx (38.9 KB, 116 views)
File Type: cfg seeldier.cfg (4.5 KB, 115 views)
File Type: cfg saxtonv2.cfg (17.6 KB, 143 views)
File Type: sp Get Plugin or Get Source (ff2_summonaboss.sp - 183 views - 21.8 KB)
File Type: smx ff2_summonaboss.smx (13.3 KB, 208 views)

Last edited by LeAlex14; 02-05-2021 at 03:30.
LeAlex14 is offline
J0BL3SS
Senior Member
Join Date: Sep 2020
Location: Turkey/Istanbul
Old 02-03-2021 , 05:40   Re: [Subplugin] Summon a boss
Reply With Quote #2

Great subplugin. But needs a lot improvements
__________________
My Steam Profile
My Discord Name: J0BL3SS#5320 | j0bl3ss

I don't really look at steam or alliedmodders, contact me from discord if you need it.
J0BL3SS is offline
LeAlex14
Member
Join Date: Jun 2020
Location: La France
Old 02-03-2021 , 08:27   Re: [Subplugin] Summon a boss
Reply With Quote #3

Update:
Add compatibility with ams and menu (for multiple boss)
Add a reworked version of Bat's menu wich works with summoned boss
LeAlex14 is offline
J0BL3SS
Senior Member
Join Date: Sep 2020
Location: Turkey/Istanbul
Old 02-03-2021 , 09:54   Re: [Subplugin] Summon a boss
Reply With Quote #4

Quote:
Originally Posted by LeAlex14 View Post
Update:
Add compatibility with ams and menu (for multiple boss)
Add a reworked version of Bat's menu wich works with summoned boss
i suggest you to zip all of these. Also perfect!
__________________
My Steam Profile
My Discord Name: J0BL3SS#5320 | j0bl3ss

I don't really look at steam or alliedmodders, contact me from discord if you need it.
J0BL3SS is offline
Batfoxkid
Senior Member
Join Date: Nov 2018
Location: ''On the map''
Old 02-03-2021 , 11:39   Re: [Subplugin] Summon a boss
Reply With Quote #5

There's no need to edit Menu Abilities to add compatibility as it already offers natives to use

Code:
/**
 * Sets up boss casting (make sure the boss has the menu manager ability)
 *
 * @param boss		Boss index
 * @param call		Call the MA_OnMakeBoss forwards
 *
 * @noreturn
 */
native void MA_MakeBoss(int boss, bool call=true);
__________________
Batfoxkid is offline
LeAlex14
Member
Join Date: Jun 2020
Location: La France
Old 02-03-2021 , 12:00   Re: [Subplugin] Summon a boss
Reply With Quote #6

Quote:
Originally Posted by Batfoxkid View Post
There's no need to edit Menu Abilities to add compatibility as it already offers natives to use

Code:
/**
 * Sets up boss casting (make sure the boss has the menu manager ability)
 *
 * @param boss		Boss index
 * @param call		Call the MA_OnMakeBoss forwards
 *
 * @noreturn
 */
native void MA_MakeBoss(int boss, bool call=true);
Oh thanks, i didn't see that ! Go to remove and sorry.

Last edited by LeAlex14; 02-03-2021 at 12:09.
LeAlex14 is offline
LeAlex14
Member
Join Date: Jun 2020
Location: La France
Old 02-03-2021 , 12:24   Re: [Subplugin] Summon a boss
Reply With Quote #7

Quote:
Originally Posted by Batfoxkid View Post
There's no need to edit Menu Abilities to add compatibility as it already offers natives to use

Code:
/**
 * Sets up boss casting (make sure the boss has the menu manager ability)
 *
 * @param boss		Boss index
 * @param call		Call the MA_OnMakeBoss forwards
 *
 * @noreturn
 */
native void MA_MakeBoss(int boss, bool call=true);
Can you explain me how use this native please.

Last edited by LeAlex14; 02-03-2021 at 12:25.
LeAlex14 is offline
Batfoxkid
Senior Member
Join Date: Nov 2018
Location: ''On the map''
Old 02-03-2021 , 17:05   Re: [Subplugin] Summon a boss
Reply With Quote #8

Quote:
Originally Posted by LeAlex14 View Post
Can you explain me how use this native please.
After you use FF2_MakeBoss you can then use
Code:
if(FF2_HasAbility(boss, "ffbat_menu_abilities", "special_menu_manager"))
	MA_MakeBoss(boss);
__________________
Batfoxkid is offline
LeAlex14
Member
Join Date: Jun 2020
Location: La France
Old 02-05-2021 , 02:34   Re: [Subplugin] Summon a boss
Reply With Quote #9

Quote:
Originally Posted by Batfoxkid View Post
After you use FF2_MakeBoss you can then use
Code:
if(FF2_HasAbility(boss, "ffbat_menu_abilities", "special_menu_manager"))
	MA_MakeBoss(boss);

Ok so i tried to do that but when MA_MakeBoss (i also included ffbat_menu) that broke the entire plugin. Idk why but even the FF2_OnAbility didn't work.
LeAlex14 is offline
J0BL3SS
Senior Member
Join Date: Sep 2020
Location: Turkey/Istanbul
Old 02-05-2021 , 12:08   Re: [Subplugin] Summon a boss
Reply With Quote #10

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.
__________________
My Steam Profile
My Discord Name: J0BL3SS#5320 | j0bl3ss

I don't really look at steam or alliedmodders, contact me from discord if you need it.

Last edited by J0BL3SS; 02-05-2021 at 12:10.
J0BL3SS 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 06:00.


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