Page 1 of 3

gg_ffa v1.4

PostPosted: Fri Nov 25, 2011 3:35 am
by satoon101
WARNING!!! Even though this works on my machine, it requires the newest ALPHA version of SPE. Use at your own risk.

The script also disables the radar, so players will not be able use the radar to find teammates to kill.

You might want to use a skin changing script, so that you don't have people "thinking" they are on the same team. You should also set mp_playerid to 2 so that you do not see "team-mates" health.

Without further ado, GunGame Free For All:


NOW FEATURING: Free For All Bots by L'In20Cible!!!

    gg_ffa_bots_v1.1.zip
    (4.16 KiB) Downloaded 1358 times

      With this addon, bots will attack "anyone" on site!

      You will also want to change bot_chatter to off when using this script.

      The script was completely researched for and written by L'In20Cible.

Have fun and let me know of any other issues.

Satoon

PostPosted: Fri Nov 25, 2011 4:33 am
by daggerclan
WOOOOOT! I'm on it !

PostPosted: Fri Nov 25, 2011 3:27 pm
by LIn20Cible
To disable the radar for all players, you can install this code on your server: http://forums.eventscripts.com/viewtopi ... 48#p390348

PostPosted: Tue Nov 29, 2011 6:09 am
by satoon101
Awesome! Thank you for that, L'In20Cible. I will be adding that to future versions of gg_ffa.

Though, I really hope to be able to find a solution to remove the radar from dead players and specs at some point. I plan on releasing a custom addon that is a "helper" addon to allow FFA and Elimination to run together. Basically, it will stop the round from ending until there is exactly 1 living player remaining. For that to work properly, it would be best if the dead players could not see the radar as well.

Satoon

PostPosted: Tue Nov 29, 2011 4:41 pm
by satoon101
I have found that using mp_forcecamera 2 works ok for this. Players have a radar, but nothing shows up on it. So, I highly recommend using that setting or use mp_fadetoblack 1 , which makes a players screen go black when they die. This is not necessary in most cases of DeathMatch, since players respawn prior to the radar appearing.

Satoon

PostPosted: Wed Nov 30, 2011 5:42 pm
by satoon101
Updated the script to version 1.1. Now includes removing the radar for living players.

Satoon

Re:

PostPosted: Thu Dec 01, 2011 5:39 pm
by LIn20Cible
I tried to hook and override CCSPlayer::UpdateRadar:
[CCSPlayer::UpdateRadar]
"shortname" = "UpdateRadar"
"sig" = " 55 8B EC 83 EC 60 56 89 4D A0 8B 45 A0 D9 80"
"symbol" = "_ZN9CCSPlayer11UpdateRadarEv"
"param" = "p)v"
"convention" = "thiscall"
But that worked only 50% of the time. Sometime players stop moving on the radar sometime they just don't appear. I think this is controlled client-side and simulate a flashbang is the best we can do. Just so you know.

PostPosted: Fri Dec 02, 2011 2:38 am
by satoon101
Yeah, I have tried the same in the past. Unfortunately, as you have seen as well, it doesn't work well at all. I did notice, though, that using mp_fadetoblack 1 with mp_forcecamera 0 (I think it was set to 0) had a weird effect when I tested. The screen didn't stay black, but the dead player (me) did not have a radar. I need to do more testing with that, to be sure what fully happens.

Satoon

PostPosted: Sun Dec 04, 2011 4:43 pm
by daggerclan
Is there a way to get bots to kill their "team-mates" ?

PostPosted: Sun Dec 04, 2011 5:09 pm
by satoon101
Unfortunately, no. They will attack you, though, if you attack them first. The only way to get them to attack teammates would be to constantly change their team. However, this will almost assuredly lead to the server crashing, as that can easily happen when a player is not on the team they are "expected" to be on during certain events.

Satoon

PostPosted: Sun Dec 04, 2011 6:22 pm
by daggerclan
Yeah, I didn't think so. If anyone wants to test the new alpha addons before adding to your own server here is my test server:
70.114.56.143:27025 Daggerclan.net | StarWars for Gungame5.1 FFA - FREE FOR ALL

alpha addons running:
gg_ffa v1.2
gg_deathmatch_alpha v1.0
spe_version 1.6.0a r79

Re: gg_ffa v1.0

PostPosted: Mon Dec 05, 2011 1:01 am
by LIn20Cible
Maybe that the following signature can be usefull:
# void CCSBot::SetBotEnemy(CCSPlayer *pPlayer)
[CCSBot:SetBotEnemy]
"shortname" = "SetBotEnemy"
"sig" = " 56 57 8B F9 8B 87 2A 2A 2A 2A 83 F8 FF 74 21 8B 15 2A 2A 2A 2A 8B C8 81 E1 FF 0F 00 00 C1 E1 04 8D 4C 11 04 C1 E8 0C 39 41 04 75 04 8B 01 EB 02 33 C0 8B 74"
"symbol" = "_ZN6CCSBot11SetBotEnemyEP9CCSPlayer"
"param" = "pp)v"
"convention" = "thiscall"

PostPosted: Mon Dec 05, 2011 2:06 am
by satoon101
Interesting find. I'll have to test that out and see what happens.

Satoon

Re: gg_ffa v1.0

PostPosted: Mon Dec 05, 2011 3:23 am
by LIn20Cible
I found a better way. :D

Image

I need to do some testing and I will post the code later. ^^

PostPosted: Mon Dec 05, 2011 4:08 am
by LIn20Cible
Okay so, these signatures:
# void CCSBot::SetBotEnemy(CCSPlayer *pPlayer)
[CCSBot:SetBotEnemy]
"shortname" = "SetBotEnemy"
"sig" = " 56 57 8B F9 8B 87 2A 2A 2A 2A 83 F8 FF 74 21 8B 15 2A 2A 2A 2A 8B C8 81 E1 FF 0F 00 00 C1 E1 04 8D 4C 11 04 C1 E8 0C 39 41 04 75 04 8B 01 EB 02 33 C0 8B 74"
"symbol" = "_ZN6CCSBot11SetBotEnemyEP9CCSPlayer"
"param" = "pp)v"
"convention" = "thiscall"

# bool CBaseEntity::InSameTeam(CBaseEntity *pEntity)
[CBaseEntity::InSameTeam]
"shortname" = "InSameTeam"
"sig" = " 8B 44 24 04 85 C0 57 8B F9 75 06 32 C0 5F C2 04 00"
"symbol" = "_ZNK11CBaseEntity10InSameTeamEPS_"
# Should be pp)b but with "i" we can use it like that while booleans are not returned by SPE:
# if spe.call("InSameTeam", <pointer>, <pointer>) % 2:
#     es.msg("Players are in the same team!")
# Useless here since we hook the function but if someone want to use it now he can...
"param" = "pp)i"
"convention" = "thiscall"
Combined to this code:
import es
import spe

def load():
    spe.detourFunction("InSameTeam", spe.HookType.Pre, PreInSameTeam)
   
def PreInSameTeam(arguments):
    if arguments[0] != arguments[1]:
        userid = es.getuserid(es.gethandlefromindex(spe.getEntityIndex(arguments[0])))
        # If the player (not the "this" pointer) is a bot, that means the function is called by one of the
        # following functions:
        #  - CCSBot::GetImportantEnemy(bool)
        #  - FindNearbyRetreatSpot(CCSBot *,float)
        #  - BotMeme::Transmit(CCSBot *)
        #  - CCSBot::IsFrienInTheWay(Vector const&)
        #  - CCSBot::DebugOverlay(void)
        #  - CCSBot::TravelDistanceToAllPlayers(void)
        #  - CCSBot::FindMostDangerousThreat(void)
        #  - CCSBot::IsFriendlyInLineOfFire(void)
        #       So we can return False without any problem.
        #
        # There's only one function called with a bot as "this" pointer:
        #  - BotChatterInterface::GetActiveStatement(void)
        #       Called when a bot use his radio. We may want to return False in that case too but,
        #       I think this is better to simply use "bot_chatter off" into server.cfg.
        #
        # There are 2 functions called without bots and we want to lets the game decide in that case.
        # Here are the functions:
        #  - CVoiceGameMgrHelper::CanPlayerHearPlayer(CBasePlayer *,CBasePlayer *,bool &)
        #  - ForEachPlayer<FOVClearOfFriends>(FovClearOfFriends &)
        if es.isbot(userid):
            return spe.HookAction.Override, False
    return spe.HookAction.Continue, 0
   
def player_hurt(event_var):
    if event_var["es_userteam"] == event_var["attackerteam"]:
        userid = int(event_var["userid"])
        if es.isbot(userid):
            attacker = int(event_var["attacker"])
            if userid != attacker:
                # We need to manually set the bot enemy to his attacker cause he will not defend himself if
                # the attacker is not in his viewcone when they are in the same team.
                spe.call("SetBotEnemy", spe.getPlayer(userid), spe.getPlayer(attacker))
               
def unload():
    spe.undetourFunction("InSameTeam", spe.HookType.Pre, PreInSameTeam)
The bots becomes crazy..! 8-)

PostPosted: Mon Dec 05, 2011 5:40 am
by satoon101
Sweetness!! I'll look more into this when I get the chance. Though, one thing I notice is that with gg_ffa, player_hurt will never fire with es_userteam equaling es_attackerteam, so that event would be useless in this sense.

Satoon

PostPosted: Mon Dec 05, 2011 5:42 am
by LIn20Cible
You simply need to add the call of SetBotEnemy into your OnTakeDamage callback when the player is a bot and he didn't attack himself. :)

PostPosted: Mon Dec 05, 2011 6:51 am
by satoon101
Added both SetBotEnemy and InSameTeam to the code. Version 1.2 now available. Thanks again, L'In20Cible!!

Satoon

Re: gg_ffa v1.0

PostPosted: Mon Dec 05, 2011 7:41 am
by LIn20Cible
You are welcome. 8-)

PostPosted: Mon Dec 05, 2011 5:45 pm
by daggerclan
Wow, this is really awesome and works like a charm. Thanks guys. :)