Raised This Month: $51 Target: $400
 12% 

[FF2 Script Help] Forcing a client's boss


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Amatowarrior
Junior Member
Join Date: May 2012
Old 07-31-2013 , 22:40   [FF2 Script Help] Forcing a client's boss
Reply With Quote #1

Yet again, another FF2 development thread. This time i'm working on a plugin similar to the ff2_boss plugin.

My goal is to build a menu so that certain steam ID's can choose certain blocked bosses. I have the STEAMID menu working with all the choices set. With the current options I can execute my script as I like, though, that leads me to why I'm asking this here.

I would like to know how to actually set a boss over FF2 to be client-sided similar to the link above I made. I don't want to use ff2_special because that will set just the next boss, not if YOU are the next boss only.

If it helps explain my cause, I would like to stuff this function under a menu choice, like:

PHP Code:
if (StrEqual(item"first_choice_function_name"))
            {
                
//Code I don't know here
                
ReplyToCommand(param1"[Specials] Set your boss to Blah Blah");
            }
            else if (
StrEqual(item"another_choices_function_name"))
            {
                
//Code I don't know again
                
ReplyToCommand(param1"[Specials] Set your boss to Another Blah Blah");

etc, etc.



I believe that it has something to do with this function:

PHP Code:
Incoming[0] = i
and

PHP Code:
Incoming[param1] = param2 
PHP Code:
Incoming[client] = -1
So I believe it has to do with the Incoming function, though I may be wrong.

Here are the codes for both of the plugins set-boss functions.

Freak Fortress 2 Default (Determined by next queued boss)

Spoiler


ff2_boss (Is client dependant like I want, but uses an autogenerated menu, I would like to build mine)

Spoiler


I understand what I'm asking may not be well understood, but if I need to explain further I will.

Any help would be greatly appreciated, thanks in advance!
__________________


Amatowarrior is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 08-01-2013 , 01:46   Re: [FF2 Script Help] Forcing a client's boss
Reply With Quote #2

FF2 has a callback that can be used to override the boss for a specific person, which is how the ff2boss plugin works.

Specifically, it calls
Code:
public Action:FF2_OnSpecialSelected( index, &SpecialNum, String:SpecialName[])
index is the client. Newer versions of FF2 ignore SpecialNum, so you can get away with not setting it and just set SpecialName instead.

To use SpecialName, strcopy something to it. Specifically, the name of the boss config that you want them to be.

Remember to return Plugin_Changed if you change it or Plugin_Continue if you don't.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 08-01-2013 at 01:49.
Powerlord is offline
Amatowarrior
Junior Member
Join Date: May 2012
Old 08-01-2013 , 02:08   Re: [FF2 Script Help] Forcing a client's boss
Reply With Quote #3

Thanks for the reply Powerlord

As a noob to sourcemod, I have no idea how to go around doing that

PHP Code:
public Action:FF2_OnSpecialSelectedindex, &SpecialNumString:SpecialName[])
{
    new 
client=GetClientOfUserId(FF2_GetBossUserId(index));
    if (!
index && Incoming[client] != -1)
    {
        
strcopy(SpecialName,2,"BossNameHere/FileNameHere?");
        
SpecialNum Incoming[client];
        
Incoming[client] = -1;
        return 
Plugin_Changed;
    }
    return 
Plugin_Continue;

I would imagine something like that? But I would also like to know how I could like that to the menu choices themselves, I have the functions and choices working I just need to know what to throw in there.
__________________



Last edited by Amatowarrior; 08-01-2013 at 02:12.
Amatowarrior is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 08-01-2013 , 10:23   Re: [FF2 Script Help] Forcing a client's boss
Reply With Quote #4

btw, I think the latest version of the Boss Selection plugin is in this post.

Edit: Whoops, didn't mean to submit this yet... will add more stuff shortly.

My mistake, it's the name key that gets looked up rather than the config filename.

The reason that newer versions of FF2 ignore the SpecialNum in the callback is that boss sets change between maps, but this plugin doesn't handle that. Going by the name addresses this problem.

How the existing plugin works is that it basically starts at 0 and increments i forever until FF2_GetSpecialKV(i, true) returns false. In that loop, it checks if the boss is marked as blocked and if it isn't, it gets the boss name and adds it to a menu.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 08-01-2013 at 10:30.
Powerlord is offline
Amatowarrior
Junior Member
Join Date: May 2012
Old 08-01-2013 , 18:18   Re: [FF2 Script Help] Forcing a client's boss
Reply With Quote #5

Quote:
Originally Posted by Powerlord View Post
btw, I think the latest version of the Boss Selection plugin is in this post.

Edit: Whoops, didn't mean to submit this yet... will add more stuff shortly.

My mistake, it's the name key that gets looked up rather than the config filename.

The reason that newer versions of FF2 ignore the SpecialNum in the callback is that boss sets change between maps, but this plugin doesn't handle that. Going by the name addresses this problem.

How the existing plugin works is that it basically starts at 0 and increments i forever until FF2_GetSpecialKV(i, true) returns false. In that loop, it checks if the boss is marked as blocked and if it isn't, it gets the boss name and adds it to a menu.
I still can't seem to get it working, I tried using
PHP Code:
strcopy(Incoming[param1], sizeof(Incoming[]), "Boss_name_here"); 
But with no success, though I do get a successful ReplyToCommand with
PHP Code:
ReplyToCommand(param1"[FF2] Set your boss to %s"Incoming[param1]); 
I've also tried
PHP Code:
case MenuAction_Select:
        {
            
GetMenuItem(menuparam2Incoming[param1], sizeof(Incoming[]));
            
ReplyToCommand(param1"[FF2] Set your boss to %s"Incoming[param1]);
        } 
With no success either.

I have
PHP Code:
public Action:FF2_OnSpecialSelectedindex, &SpecialNumString:SpecialName[])
{
    new 
client=GetClientOfUserId(FF2_GetBossUserId(index));
    if (!
index && !StrEqual(Incoming[client], ""))
    {
        
strcopy(SpecialNamesizeof(Incoming[]), Incoming[client]);
        
Incoming[client] = "";
        
PrintToChatAll("Test Value");
        return 
Plugin_Changed;
    }
    return 
Plugin_Continue;

At the bottom of the code (I added the PrintToChatAll() to test and thats appearing on every round start when a boss is chosen, but no effect on which boss is spawned. If it makes a difference:

PHP Code:
AddMenuItem(menu"The Hidden""The Hidden"); 
Is my menu form. So yes, the menu and everything is working now (Thanks), but I still don't have the function to change the boss itself
__________________


Amatowarrior is offline
Reply



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 21:13.


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