gg_ffa v1.4

Area to post and download Alpha-build Custom Addons, as well as ask the author/users for help or support.

Re: gg_ffa v1.0

Postby LIn20Cible » Tue Dec 06, 2011 1:14 am

In fact, the call of SetBotEnemy is useless here. Since players are not in the same team when OnTakeDamage is fired, bots defend themselves. Now, to make it all more realistic, we can hook CCSBot::OnAudibleEvent and switch the player to the opposite team of the bot to get his attention on what happens. Here's the signature:
# void CCSBot::OnAudibleEvent(IGameEvent *, CBasePlayer *, float, PriorityType, bool, bool, Vector  const*)
[CCSBot::OnAudibleEvent]
"shortname" = "OnAudibleEvent"
"sig" = " 83 EC 18 53 8B 5C 24 24 85 DB 56 8B F1 0F 84 9E 02 00 00"
"symbol" = "_ZN6CCSBot14OnAudibleEventEP10IGameEventP11CBasePlayerf12PriorityTypebbPK6Vector"
"param" = "pppfibbp)v"
"convention" = "thiscall"
You only need to know two values here:
args[1] = the player's pointer
args[7] = the bot's pointer
But since this function is called on all the following events:
player_footstep
player_falldamage
weapon_zoom
weapon_fire
weapon_fire_on_empty
hegrenade_detonate
flashbang_detonate
smokegrenade_detonate
player_jump
I'm afraid that will take a lot of ressources if there are a lot of bots/players on the server. You can try, and lets me know. That said, this is sad that you never give credits where it is due in your codes but well, reals knows. ;)
LIn20Cible

Private
Private
User avatar
 
Posts: 14
Joined: Fri Nov 25, 2011 5:10 am
Location: Québec, Canada

Postby satoon101 » Tue Dec 06, 2011 1:38 am

I'll give that a shot and see what difference it can make.

About the credit, this is still an Alpha, and the entire discussion is held in this thread. Anyone who has downloaded it can easily see that you have been a tremendous help. I don't want you to feel that your help is unappreciated, so I will definitely add a line about your contributions in the script. Though, I really don't know how many people are looking at the actual code to see that.

Satoon
satoon101

Site Admin
Site Admin
 
Posts: 1055
Joined: Thu Oct 09, 2008 4:27 pm

PostThis post was deleted by LIn20Cible on Tue Dec 06, 2011 4:19 am.

Postby LIn20Cible » Tue Dec 06, 2011 4:20 am

In my opinion, it's more by moral principle to credit persons that contributed to something than anything else. But well, maybe it's only mine. :)

EDIT: (I removed my last post with the old code...)

Okay, so after some testings, the better way is to set the players as enemies when the bot is not attacking when the function is called. For that, we need to get that value from the following offset:
import es
import spe

is_attacking_offset = 7036 # Windows value, 7056 on Linux...

def load():
    spe.detourFunction('OnAudibleEvent', spe.HookType.Pre, PreOnAudibleEvent)
   
def PreOnAudibleEvent(args):
    if args[1]: # First, makes sure that we have a valid pointer...
        if es.getindexprop(spe.getEntityIndex(args[1]), 'CBaseEntity.m_iTeamNum') == es.getindexprop(spe.getEntityIndex(args[7]), 'CBaseEntity.m_iTeamNum'): # Makes sure they are in the same team...
            if not spe.getLocVal('i', args[7] + is_attacking_offset): # Makes sure the bot is not attacking...
                spe.call('SetBotEnemy', args[7], args[1]) # Sets the players as enemies...
    return (spe.HookAction.Continue, 0)
   
def unload():
    spe.undetourFunction('OnAudibleEvent', spe.HookType.Pre, PreOnAudibleEvent)
Or from the following signature:
[CCSBot:IsAttacking]
"shortname" = "IsAttacking"
"sig" = " 8A 81 7C 1B 00 00 C3"
"symbol" = "_ZNK6CCSBot11IsAttackingEv"
"param" = "p)b"
"convention" = "thiscall"
But since SPE doesn't return booleans yet, we need to replace "p)b" with "p)i" and check it like that:
if not spe.call('IsAttacking', args[7]) % 2:
So I guess the offset way is preferable. With that code, bots will automatically attack the player that make noise nearby them. :P
LIn20Cible

Private
Private
User avatar
 
Posts: 14
Joined: Fri Nov 25, 2011 5:10 am
Location: Québec, Canada

Postby satoon101 » Tue Dec 06, 2011 4:31 am

Cool. I'll test out myself when I get the chance. I'll probably add that offset to SPE Tools, as well, to make it easier to utilize.

I also "might" just make the Bot portion of this into a new gg_ffa_bots script. Actually, if you would like to do that, I can remove the current bot related stuff from gg_ffa once you release a version. I've been thinking a little bit today how we are going above and beyond what this script is designed for, and would like to break it out into it's own script.

I've also been wanting to write a gg_bot script that forces bots to use hegrenades when they are on hegrenade level and have one, but haven't gotten around to that as of yet.

Satoon
satoon101

Site Admin
Site Admin
 
Posts: 1055
Joined: Thu Oct 09, 2008 4:27 pm

Postby LIn20Cible » Tue Dec 06, 2011 5:25 am

I personally think that is preferable to directly make a script that supports bots rather than another one to complete it. That make no sense for me to split the bots and players into two different addons. The only reason I can see is to save the CPU usage but these functions will never execute if there's no bot on the server. :P Anyways, if you really want to create two scripts, you can write it yourself cause I'm not familiarized with the GunGame libraries. For the grenade thing, did you try to call the following function?
[CCSBot:EquipGrenade]
"shortname" = "EquipGrenade"
"sig" = " 56 8B F1 8B 06 8B 90 14 04 00 00 6A 00 FF D2"
"symbol" = "_ZN6CCSBot12EquipGrenadeEb"
"param" = "pb)v"
"convention" = "thiscall"
Not sure what the "b" is but it works on True or False so...
LIn20Cible

Private
Private
User avatar
 
Posts: 14
Joined: Fri Nov 25, 2011 5:10 am
Location: Québec, Canada

Postby satoon101 » Tue Dec 06, 2011 5:57 am

Ok, I'll break it out into another script then. It is more an "organization" thing than a CPU usage thing. FFA is just supposed to allow players to be able to hurt/kill "teammates". I think the radar part should still be a part of it, since it is an "essential" part of the script. Bot related code is not "essential" for the purpose of FFA. Code for that should remain separate. It is our plan that eventually gg_ffa will be added as an Included Addon. I would prefer that gg_ffa_bots remain a Custom Addon at that point.

I haven't really tried anything SPE related for forcing bots to use a grenade. I have a very, very old version of the script, but it has issues. I haven't tried updating it in quite some time. It is just on my list of things to do.

Satoon
satoon101

Site Admin
Site Admin
 
Posts: 1055
Joined: Thu Oct 09, 2008 4:27 pm

Re: gg_ffa v1.0

Postby LIn20Cible » Tue Dec 06, 2011 6:02 am

Seen like that, you're right. ^^

EDIT: In fact, we simply need to listen the value of gg_ffa to register/unregister our functions into gg_ffa_bots right? If so, I can write it if you prefer...
LIn20Cible

Private
Private
User avatar
 
Posts: 14
Joined: Fri Nov 25, 2011 5:10 am
Location: Québec, Canada

Postby satoon101 » Sun Dec 11, 2011 6:23 pm

Sorry, didn't notice your edit until just now.

I would love for you to write it!

You don't necessarily have to listen for gg_ffa, though. It would be preferred to just use the same way to load/unload gg_ffa_bots as it is for any Included/Custom addon. Make sure there are at least the following 3 files in the ../addons/eventscripts/gungame51/scripts/custom/gg_ffa_bots folder:

    __init__.py
      Just needs to be an empty file.
      We usually at least put the relative path in the file:
      # ../scripts/custom/gg_ffa_bots/__init__.py

    gg_ffa_bots.py
      Obviously the file that houses all related code to gg_ffa_bots

    gg_ffa_bots_config.py
      This file is used to create the ServerVar instance of gg_ffa_bots.
      We use server_cvar internally to listen for all Included/Custom addon base cvars to know whether to enable/disable the addon itself.
      Use it like the following:
      # ../scripts/custom/gg_ffa_bots/gg_ffa_bots_config.py

      # =============================================================================
      # >> IMPORTS
      # =============================================================================
      # Python Imports
      from __future__ import with_statement
      from path import path

      # GunGame Imports
      from gungame51.core.cfg.configs import ConfigContextManager


      # =============================================================================
      # >> LOAD & UNLOAD
      # =============================================================================
      def load():

          # Create the cfg file
          with ConfigContextManager(
            path(__file__).parent.split('scripts')[~0][1:]) as config:

              # Create the gg_ffa_bots instance
              with config.cfg_cvar('gg_ffa_bots') as cvar:

                  cvar.name = 'FREE FOR ALL BOTS'
                  cvar.description.append('BOTS will now attack "team-mates".')
                  cvar.options.append('0 = (Disabled) Do not load gg_ffa_bots.')
                  cvar.options.append('1 = (Enabled) Load gg_ffa_bots')
                  cvar.default = 0
                  cvar.text = 'Causes BOTS to attack "team-mates".'


Also, since it would not make sense to have this loaded if gg_ffa is not, add gg_ffa to the list of requirements for the addon (code within gg_ffa_bots.py):
# =============================================================================
# >> ADDON REGISTRATION/INFORMATION
# =============================================================================
info = AddonInfo()
info.name = 'gg_ffa_bots'
info.title = 'GG Free For All BOTS'
info.author = "L'In20Cible"
info.version = '1.0'
info.requires = ['gg_ffa']
This way, if gg_ffa is set to 0, but gg_ffa_bots is set to 1, GunGame automatically enables gg_ffa until gg_ffa_bots is set to 0.

Satoon
satoon101

Site Admin
Site Admin
 
Posts: 1055
Joined: Thu Oct 09, 2008 4:27 pm

Postby satoon101 » Sun Feb 26, 2012 7:54 pm

Ok, I updated the script to not include anything bot specific. It also requires the "newest" SPE version, since it utilizes some new functionality from SPE Tools that was only released recently. L'In20Cible has been working hard on getting gg_ffa_bots to be as good as it can be :)

Satoon
satoon101

Site Admin
Site Admin
 
Posts: 1055
Joined: Thu Oct 09, 2008 4:27 pm

Re: gg_ffa v1.3

Postby x-zempt » Tue Apr 10, 2012 2:38 pm

Hi,
I've been working on setting up a GG server the last few days for a LAN event this coming weekend and I'm wanting to have a FFA game but I'm having issues :x
I get GG functioning correctly (as far as I can tell) in a deathmatch mode and the like, but for the death of me I can't get the FFA working.
I've had very minimal experience setting up GG servers, but I set one up years ago with an early release of GG and I'm sure that was a FFA and I didn't have any issues with that!

If someone could point me in the right direction in terms of exactly what versions of scripts I need etc it would be greatly appreciated.

Regards

Edit: Main issue I have been having is that if I would shoot a bot on the same team as myself it would not level up, it would make my score a negative. I haven't had a chance to test server with anyone else in it so I'm not sure if its only with bots or everyone on the same team.
Again, if someone could verify exactly which versions of SPE and ES etc that I need that would be great!
Cause if I'm using the "Alpha" version of SPE, GG fails to load and says SPE is not installed on server.
x-zempt

Recruit
Recruit
 
Posts: 3
Joined: Tue Apr 10, 2012 2:33 pm

Postby satoon101 » Tue Apr 10, 2012 3:06 pm

You "must" use the Alpha version of SPE, otherwise the script will not work. It relies on functionality "only" available in the Alpha version of SPE.

What is the exact error you get when loading GunGame51 with the Alpha version of SPE installed? Copy/paste the entire error here.

Satoon
satoon101

Site Admin
Site Admin
 
Posts: 1055
Joined: Thu Oct 09, 2008 4:27 pm

Re: gg_ffa v1.3

Postby x-zempt » Tue Apr 10, 2012 3:07 pm

Actually, ignore the last post :D
Got it working. Just one more question though. How do I disable the timer so the game will keep going until final lvl reached?


Thanks guys! Great Addon!

edit: The issue was that I made a bit of a typo in a config file :D All Fixed now though.
x-zempt

Recruit
Recruit
 
Posts: 3
Joined: Tue Apr 10, 2012 2:33 pm

Postby satoon101 » Tue Apr 10, 2012 3:09 pm

To disable the round time (or at least keep the round from ending when it reaches 0), use this other wonderful addon:
viewtopic.php?f=79&t=2013

Satoon
satoon101

Site Admin
Site Admin
 
Posts: 1055
Joined: Thu Oct 09, 2008 4:27 pm

Re: gg_ffa v1.3

Postby x-zempt » Tue Apr 10, 2012 3:15 pm

Thankyou you very much!
Just making a backup of the server before I install that addon and the scoreboard one incase I accidentally mess that up :S

Thank you guys for your hard work, will be great at out LAN this weekend.
FYI I'm running this on Offline Orangebox CSS for use at LAN because we don't have internet access. Seems to be working very well!
x-zempt

Recruit
Recruit
 
Posts: 3
Joined: Tue Apr 10, 2012 2:33 pm

Postby satoon101 » Tue Apr 10, 2012 3:23 pm

Last time I used the scoreboard one, it had some issues. If you find that your's isn't working well either, you can always use the non-Alpha version:
viewtopic.php?f=74&t=1412

Once I get the chance, I'm going to figure out why the Alpha version isn't working properly.

Satoon
satoon101

Site Admin
Site Admin
 
Posts: 1055
Joined: Thu Oct 09, 2008 4:27 pm

Postby satoon101 » Tue Apr 10, 2012 8:57 pm

I updated the main post to include the new GunGame Free For All Bots script by L'In20Cible:
viewtopic.php?f=79&t=2006&st=0&sk=t&sd=a#p9249

If you want to run Free For All with bots, that script is a "must".

Satoon
satoon101

Site Admin
Site Admin
 
Posts: 1055
Joined: Thu Oct 09, 2008 4:27 pm

Postby satoon101 » Tue Apr 17, 2012 2:31 am

Updated script to make it more modular and fixed an issue with the radar.

Satoon
satoon101

Site Admin
Site Admin
 
Posts: 1055
Joined: Thu Oct 09, 2008 4:27 pm

Postby satoon101 » Fri Jun 01, 2012 4:31 am

Updated the gg_ffa_bots script to include the updated signatures. Thanks to L'In20Cible for helping to find the new signatures.

Satoon
satoon101

Site Admin
Site Admin
 
Posts: 1055
Joined: Thu Oct 09, 2008 4:27 pm

PostThis post was deleted by malik69 on Mon Jul 09, 2012 6:27 pm.

PreviousNext


Return to Alpha Scripts

Who is online

Users browsing this forum: No registered users and 3 guests

cron