.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   YaPB (http://forums.bots-united.com/forumdisplay.php?f=55)
-   -   [Suggestion] Amxmodx API for YaPB. (http://forums.bots-united.com/showthread.php?t=9996)

wbyokomo 04-11-2015 04:28

[Suggestion] Amxmodx API for YaPB.
 
Hi, i like this bot very much it works fine on server, but it has some issues on cs1.6 custom mod like ZombieMod, Biohazard and any other mods that use instant team changes.

Issues:
1. Team detection
- In Zombie Plague Mod when zombie(TR player) infect a human(CT player) the CT player will change team to TR, but this player won't attack any other CT player, it will still attacking the Zombie player(TR).

2. Knife attack distance
- This is known issue on podbot too, since we are running Zombie Plague Mod, the zombies only have 1 weapon (knife). So when it get close to Humans (CT), the humans will use knife too and start a knife battle lol.

My suggestions:
1. Implement a better way to set CS1.6 team, use m_iTeam (114) offset.
2. Create AmxModx API to set/get enemy target, knife attack distance. So with this API server owner can code a simple amxx plugin to make YaPB more compatible to any CS1.6 custom mods.

You can see this custom YaPB, it has AmxModx API features. :punk:

wbyokomo 04-11-2015 08:04

Re: [Suggestion] Amxmodx API for YaPB.
 
I see in bool Bot::LookupEnemy (void) you are using a var to retrieve player team.

PHP Code:

      // search the world for players...
      
for (int i 0GetMaxClients (); i++)
      {
         if (!(
g_clients[i].flags CF_USED) || !(g_clients[i].flags CF_ALIVE) || (g_clients[i].team == m_team) || (g_clients[i].ent == GetEntity ()))
            continue; 

It would be good if you add an API to get/set internal player team too.
Example:
yb_get_player_team(index)
yb_set_player_team(index, m_team)

jeefo 04-11-2015 10:48

Re: [Suggestion] Amxmodx API for YaPB.
 
Hello!

Offset is not used, to ensure that futures CS 1.6 updates (if any) will not break bot compatibility.

You can force bot to get valid TeamId by sending TeamInfo message manually, when needed.

About the API, you have found SyPB Bot. I'm not sure, that yapb needs this.

wbyokomo 04-11-2015 12:34

Re: [Suggestion] Amxmodx API for YaPB.
 
Quote:

Originally Posted by jeefo (Post 66343)
Hello!

Offset is not used, to ensure that futures CS 1.6 updates (if any) will not break bot compatibility.

You can force bot to get valid TeamId by sending TeamInfo message manually, when needed.

About the API, you have found SyPB Bot. I'm not sure, that yapb needs this.

Sad.. but that SyPB eat too much cpu usage. I prefer YaPB.

Krtola 04-11-2015 12:37

Re: [Suggestion] Amxmodx API for YaPB.
 
The same problem I noticed on my zombie mod(biohazard).

wbyokomo 04-11-2015 19:27

Re: [Suggestion] Amxmodx API for YaPB.
 
I found the reason why yapb failed to instantly detect team change, it because TeamInfo message cannot be read by any other metamod module.

I tried to send TeamInfo message via emessage_begin but it failed too.

So i found a silly method to fix this issue, but it need to modify our custom cs1.6 mod, example in Zombie Plague and Biohazard.

Here is an example of fix:
PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <fun>

#define PLUGIN "Silly Fix"
#define VERSION "0.0.1"
#define AUTHOR "wbyokomo"

new bool:bTeamChangeSpawn[33], iOrigin[33][3]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_Spawn"player""OnSpawnPost"1)
}

public 
client_putinserver(id)
{
    
bTeamChangeSpawn[id] = false //reset flag
}

public 
OnSpawnPost(id)
{
    
//stop here if changing team
    
if(bTeamChangeSpawn[id])
    {
        
bTeamChangeSpawn[id] = false
        
return;
    }
    
    
//our new post actions
    
if(!is_user_alive(id)) return;

    if(
cs_get_user_team(id) != CS_TEAM_CTSetPlayerTeam(idCS_TEAM_CT);
}

//silly team changer fix
SetPlayerTeam(idCsTeams:team)
{
    
bTeamChangeSpawn[id] = true //mark team change flag
    
get_user_origin(idiOrigin[id]) //get current origin
    
cs_set_user_team(idteamCS_NORESET//set our new team
    
ExecuteHam(Ham_CS_RoundRespawnid//call round respawn, in order to update TeamInfo, using emessage_begin is useless too. metamod still can't retrieve it. Use ExecuteHam not ExecuteHamB
    
set_user_origin(idiOrigin[id]) //set back our origin
    //you need to add unstuck code here sometime our origin will stuck.


I know this is not efficient but at least it working and bot instantly can detect new team changes. Fast target change is awesome :batman:

Krtola 28-02-2016 20:42

Re: [Suggestion] Amxmodx API for YaPB.
 
undefined symbol "CS_NORESET"

Whan to do now?

wbyokomo 07-05-2016 18:21

Re: [Suggestion] Amxmodx API for YaPB.
 
Fix for this issue:

Well this fix is for ZP4.3Fix5a.
On ZP50 just need to change emessage_begin(MSG_BROADCAST, g_msgScoreInfo) to emessage_begin(MSG_ALL, g_msgScoreInfo) in cs_teams_api.sma

Step by step:
1. Search for UpdateFrags(attacker, victim, frags, deaths, scoreboard) and disable ScoreInfo message for victim:
Code:

// Update Player Frags and Deaths
UpdateFrags(attacker, victim, frags, deaths, scoreboard)
{
    // Set attacker frags
    set_pev(attacker, pev_frags, float(pev(attacker, pev_frags) + frags))
   
    // Set victim deaths
    fm_cs_set_user_deaths(victim, cs_get_user_deaths(victim) + deaths)
   
    // Update scoreboard with attacker and victim info
    if (scoreboard)
    {
        message_begin(MSG_BROADCAST, g_msgScoreInfo)
        write_byte(attacker) // id
        write_short(pev(attacker, pev_frags)) // frags
        write_short(cs_get_user_deaths(attacker)) // deaths
        write_short(0) // class?
        write_short(fm_cs_get_user_team(attacker)) // team
        message_end()
       
        /*message_begin(MSG_BROADCAST, g_msgScoreInfo)
        write_byte(victim) // id
        write_short(pev(victim, pev_frags)) // frags
        write_short(cs_get_user_deaths(victim)) // deaths
        write_short(0) // class?
        write_short(fm_cs_get_user_team(victim)) // team
        message_end()*/
    }
}

2. Search for public fm_cs_set_user_team_msg(taskid) and send ScoreInfo message for target:
Code:

// Send User Team Message
public fm_cs_set_user_team_msg(taskid)
{
    // Note to self: this next message can now be received by other plugins
   
    // Set the switching team flag
    g_switchingteam = true
   
    // Tell everyone my new team
    emessage_begin(MSG_ALL, g_msgTeamInfo)
    ewrite_byte(ID_TEAM) // player
    ewrite_string(CS_TEAM_NAMES[fm_cs_get_user_team(ID_TEAM)]) // team
    emessage_end()
   
    // Fix for AMXX/CZ bots which update team paramater from ScoreInfo message
    emessage_begin(MSG_ALL, g_msgScoreInfo)
    ewrite_byte(ID_TEAM) // id
    ewrite_short(pev(ID_TEAM, pev_frags)) // frags
    ewrite_short(cs_get_user_deaths(ID_TEAM)) // deaths
    ewrite_short(0) // class?
    ewrite_short(fm_cs_get_user_team(ID_TEAM)) // team
    emessage_end()
   
    // Done switching team
    g_switchingteam = false
}

3. Compile your .sma and put in server see the instant team detection even faster than CSBot http://images.proboards.com/f/smiley/smiley.png


All times are GMT +2. The time now is 16:36.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.