Raised This Month: $140 Target: $400
 35% 

[L4D/L4D2] Grenade Throwing Bots


Post New Thread Reply   
 
Thread Tools Display Modes
Author
cravenge
Veteran Member
Join Date: Nov 2015
Location: ♫ Harmony ♫
Plugin ID:
5596
Plugin Version:
1.6 (L4D), 1.7 (L4D2)
Plugin Category:
Gameplay
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Allows bots to throw grenades themselves.
    Old 04-13-2017 , 12:17   [L4D/L4D2] Grenade Throwing Bots
    Reply With Quote #1

    Wanna make the bots more useful? Do you want to watch them throw grenades like you wanted to? Did you expect them to...... Naaahh, you already get the point.

    No convars, commands, or anything unnecessary. Just simple drag and drop.

    Bugs:


    Notes:


    Changelog:
    Attached Files
    File Type: sp Get Plugin or Get Source (grenade_throwing_bots-l4d.sp - 837 views - 10.4 KB)
    File Type: sp Get Plugin or Get Source (grenade_throwing_bots-l4d2.sp - 617 views - 14.2 KB)
    File Type: smx grenade_throwing_bots-l4d2.smx (12.1 KB, 1228 views)
    __________________

    "Juunen go no watashi e, ima wa shiawase de shou ka?"

    Last edited by cravenge; 07-16-2017 at 19:39.
    cravenge is offline
    PepeZukas
    Member
    Join Date: Oct 2015
    Location: Brazil
    Old 04-14-2017 , 22:14   Re: [L4D/L4D2] Grenade Throwing Bots
    Reply With Quote #2

    Can bots get the throwaways by himself? Does not work here...


    Name:  20170414230524_1.jpg
Views: 6429
Size:  68.9 KB

    SourceMod (v1.8.0.5981)

    Left 4 Downtown 2 (v0.5.4.2)

    L4DToolz (v1.0.09r1)
    __________________
    PepeZukas is offline
    cravenge
    Veteran Member
    Join Date: Nov 2015
    Location: ♫ Harmony ♫
    Old 04-16-2017 , 08:37   Re: [L4D/L4D2] Grenade Throwing Bots
    Reply With Quote #3

    Update 1.1:

    - Made two different version for both games to prevent any harm.
    - Had some tweaks to prevent them from being stucked as the chosen thrower and some bug fixes.
    - Added a note for the needed extension.
    __________________

    "Juunen go no watashi e, ima wa shiawase de shou ka?"
    cravenge is offline
    PepeZukas
    Member
    Join Date: Oct 2015
    Location: Brazil
    Old 04-16-2017 , 11:17   Re: [L4D/L4D2] Grenade Throwing Bots
    Reply With Quote #4

    I am using the version of L4Downtown2 that you specified, and the bots can not catch the throws, and this error appears in the console.

    Code:
    L 04/16/2017 - 12:05:12: [SM] Exception reported: Entity 1 (1) is invalid
    L 04/16/2017 - 12:05:12: [SM] Blaming: grenade_throwing_bots-l4d2.smx
    L 04/16/2017 - 12:05:12: [SM] Call stack trace:
    L 04/16/2017 - 12:05:12: [SM]   [0] GetEntPropString
    L 04/16/2017 - 12:05:12: [SM]   [1] Line 748, C:\hcservers\L4D2 2.1.4.6\HMCoop\Normal\left4dead2\addons\sourcemod\scripting\include\entity.inc::GetEntityClassname
    L 04/16/2017 - 12:05:12: [SM]   [2] Line 101, grenade_throwing_bots-l4d2.sp::OnEntityDestroyed
    __________________

    Last edited by PepeZukas; 04-16-2017 at 11:47. Reason: Correcting my lousy English...
    PepeZukas is offline
    cravenge
    Veteran Member
    Join Date: Nov 2015
    Location: ♫ Harmony ♫
    Old 04-17-2017 , 02:16   Re: [L4D/L4D2] Grenade Throwing Bots
    Reply With Quote #5

    Update 1.2 (L4D2): Replaced clumsy checking with the appropriate one. Wew, I code plugins uglier when I'm drunk.
    __________________

    "Juunen go no watashi e, ima wa shiawase de shou ka?"
    cravenge is offline
    Lux
    Veteran Member
    Join Date: Jan 2015
    Location: Brexit
    Old 04-18-2017 , 05:51   Re: [L4D/L4D2] Grenade Throwing Bots
    Reply With Quote #6

    I suggest using my IsSurvivorThirdPerson()
    because that will catch most things that would stop you from throwing anything.

    Here i modded it abit so you could use it here, i'm not 100% sure.

    Code:
    
    static bool:IsSurvivorThirdPerson(iClient) 
    {
        if(GetEntPropEnt(iClient, Prop_Send, "m_isIncapacitated") > 0)
            return true;
        if(GetEntPropEnt(iClient, Prop_Send, "m_pummelAttacker") > 0)
            return true;
        if(GetEntPropEnt(iClient, Prop_Send, "m_carryAttacker") > 0)
            return true;
        if(GetEntPropEnt(iClient, Prop_Send, "m_pounceAttacker") > 0)
            return true;
        if(GetEntPropEnt(iClient, Prop_Send, "m_jockeyAttacker") > 0)
            return true; 
        if(GetEntProp(iClient, Prop_Send, "m_isHangingFromLedge") > 0)
            return true;
        if(GetEntPropEnt(iClient, Prop_Send, "m_reviveTarget") > 0)
            return true;  
        if(GetEntPropFloat(iClient, Prop_Send, "m_staggerTimer", 1) > -1.0)
            return true; 
        switch(GetEntProp(iClient, Prop_Send, "m_iCurrentUseAction"))
        {
            case 1:
            {
                static iTarget;
                iTarget = GetEntPropEnt(iClient, Prop_Send, "m_useActionTarget");
                
                if(iTarget == GetEntPropEnt(iClient, Prop_Send, "m_useActionOwner"))
                    return true;
                else if(iTarget != iClient)
                    return true;
            }
            case 4, 6, 7, 8, 9, 10:
                return true;
        }
        
        static String:sModel[31];
        GetEntPropString(iClient, Prop_Data, "m_ModelName", sModel, sizeof(sModel));
        
        switch(sModel[29])
        {
            case 'b'://nick
            {
                switch(GetEntProp(iClient, Prop_Send, "m_nSequence"))
                {
                    case 626, 625, 624, 623, 622, 621, 661, 662, 664, 665, 666, 667, 668, 670, 671, 672, 673, 674, 620, 680:
                        return true;
                }
            }
            case 'd'://rochelle
            {
                switch(GetEntProp(iClient, Prop_Send, "m_nSequence"))
                {
                    case 674, 678, 679, 630, 631, 632, 633, 634, 668, 677, 681, 680, 676, 675, 673, 672, 671, 670, 687, 629:
                        return true;
                }
            }
            case 'c'://coach
            {
                switch(GetEntProp(iClient, Prop_Send, "m_nSequence"))
                {
                    case 656, 622, 623, 624, 625, 626, 663, 662, 661, 660, 659, 658, 657, 654, 653, 652, 651, 621, 620, 669:
                        return true;
                }
            }
            case 'h'://ellis
            {
                switch(GetEntProp(iClient, Prop_Send, "m_nSequence"))
                {
                    case 625, 675, 626, 627, 628, 629, 630, 631, 678, 677, 676, 575, 674, 673, 672, 671, 670, 669, 668, 667, 666, 665, 684:
                        return true;
                }
            }
            case 'v'://bill
            {
                switch(GetEntProp(iClient, Prop_Send, "m_nSequence"))
                {
                    case 528, 759, 763, 764, 529, 530, 531, 532, 533, 534, 753, 676, 675, 761, 758, 757, 756, 755, 754, 527, 772, 762:
                        return true;
                }
            }
            case 'n'://zoey
            {
                switch(GetEntProp(iClient, Prop_Send, "m_nSequence"))
                {
                    case 537, 819, 823, 824, 538, 539, 540, 541, 542, 543, 813, 828, 825, 822, 821, 820, 818, 817, 816, 815, 814, 536, 809:
                        return true;
                }
            }
            case 'e'://francis
            {
                switch(GetEntProp(iClient, Prop_Send, "m_nSequence"))
                {
                    case 532, 533, 534, 535, 536, 537, 769, 768, 767, 766, 765, 764, 763, 762, 761, 760, 759, 758, 757, 756, 531, 530, 775:
                        return true;
                }
            }
            case 'a'://louis
            {
                switch(GetEntProp(iClient, Prop_Send, "m_nSequence"))
                {
                    case 529, 530, 531, 532, 533, 534, 766, 765, 764, 763, 762, 761, 760, 759, 758, 757, 756, 755, 754, 753, 527, 772, 528:
                        return true;
                }
            }
            case 'w'://adawong
            {
                switch(GetEntProp(iClient, Prop_Send, "m_nSequence"))
                {
                case 674, 678, 679, 630, 631, 632, 633, 634, 668, 677, 681, 680, 676, 675, 673, 672, 671, 670, 687, 629:
                        return true;
                }
            }
        }
        
        return false;
    }
    
    Also this has a check you missed
    if(GetEntPropEnt(iClient, Prop_Send, "m_carryAttacker") > 0)
    return true;

    is missing from your IsInShape()
    bool.

    Be sure to convert to new syntax if you dislike my old syntax code.

    enjoy


    EXTRA:

    GetEntPropEnt(client, Prop_Send, "m_tongueOwner") > 0

    I don't use this because you can still throw stuff while is
    m_tongueOwner > 0
    This will report back greater than 0 but you can still throw stuff, shoot and melee in the first second of being pulled, that is why i used sequences instead.

    and

    switch(GetEntProp(iClient, Prop_Send, "m_iCurrentUseAction"))

    can be used for bot plugins Example "my bots use upgrade packs and other stuff", that would interfere with the bot plugins I use,
    it's just a suggestion for compatibility with other plugins and more friendly to bots that are healing team mates
    __________________

    Last edited by Lux; 04-18-2017 at 06:03. Reason: Why i did not use m_tongueOwner
    Lux is offline
    cravenge
    Veteran Member
    Join Date: Nov 2015
    Location: ♫ Harmony ♫
    Old 04-19-2017 , 08:46   Re: [L4D/L4D2] Grenade Throwing Bots
    Reply With Quote #7

    Quote:
    Originally Posted by Lux View Post
    [...]
    Thanks Lux, I'll keep them for future updates.

    Hmm, there seems to be a problem with it on L4D1 but none on L4D2 as it works flawlessly. That doesn't prevent FF though, I need to check if the area around the target to be thrown is safe from other survivors.
    __________________

    "Juunen go no watashi e, ima wa shiawase de shou ka?"

    Last edited by cravenge; 04-19-2017 at 11:33.
    cravenge is offline
    Lux
    Veteran Member
    Join Date: Jan 2015
    Location: Brexit
    Old 04-19-2017 , 10:34   Re: [L4D/L4D2] Grenade Throwing Bots
    Reply With Quote #8

    Quote:
    Originally Posted by cravenge View Post
    Thanks Ludastar, I'll keep them for future updates.

    Hmm, there seems to be a problem with it on L4D1 but none on L4D2 as it works flawlessly. That doesn't prevent FF though, I need to check if the area around the target to be thrown is safe from other survivors.
    Bots don't damage team mates.
    L4D block damage that would of damage you when being shot, i would suggest doing the same thing with the pipebomb however, i'm my opinion for molotov i would block the damage from the fire for a few secs then start damaging survivors who are in it, should give people with even the slowest reaction time to move out of it.
    __________________
    Lux is offline
    cravenge
    Veteran Member
    Join Date: Nov 2015
    Location: ♫ Harmony ♫
    Old 04-19-2017 , 11:37   Re: [L4D/L4D2] Grenade Throwing Bots
    Reply With Quote #9

    Quote:
    Originally Posted by Lux View Post
    [...]
    That's actually a pretty good idea. Thanks again.
    __________________

    "Juunen go no watashi e, ima wa shiawase de shou ka?"
    cravenge is offline
    Edison1318
    Senior Member
    Join Date: Nov 2015
    Location: Peaceful place of the in
    Old 04-25-2017 , 02:49   Re: [L4D/L4D2] Grenade Throwing Bots
    Reply With Quote #10

    I really appreciated you improve the bots throwing grenade plugin.
    __________________
    EdisonGar
    Edison1318 is offline
    Send a message via Skype™ to Edison1318
    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 19:06.


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