Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
G2O Client side bots
#1
Hi, it`s my simple bots module for G2O, it`s only working on client side and doesn`t have sync for all players. If you have some problem, please send me  a message.


Functions:

Code:
createNpc(name, instance);
destroyNpc(npc_pointer);

equipArmorNpc(npc_pointer, armor);
unEquipArmorNpc(npc_pointer);
equipItem(npc_pointer, item);
unEquipMeleeWeaponNpc(npc_pointer);
unEquipRangedWeaponNpc(npc_pointer);
setAdditionalVisualsNpc(npc_pointer, bodyModel, bodyTextueID, headTextureID);
setPositionNpc(npc_pointer, x, y, z);
setAngleNpc(npc_pointer, angle);
setWeaponModeNpc(npc_pointer, weapon_mode);
playAnimNpc(npc_pointer, anim);
stopAnimNpc(npc_pointer);
setAttributeNpc(npc_pointer, index, value);
setTalentNpc(npc_pointer, index, value);
setHitChanceNpc(npc_pointer, index, value);
selectSpellNpc(npc_pointer, spell);
useSpellNpc(npc_pointer, enemy_pointer);


Simple code: 

Code:
enum WeaponMode
{
    NPC_WEAPON_NONE,
    NPC_WEAPON_FIST,
    NPC_WEAPON_DAG,
    NPC_WEAPON_1HS,
    NPC_WEAPON_2HS,
    NPC_WEAPON_BOW,
    NPC_WEAPON_CBOW,
    NPC_WEAPON_MAG,
    NPC_WEAPON_MAX,
};

enum Attribute
{
    NPC_ATR_HITPOINTS,
    NPC_ATR_HITPOINTS_MAX,
    NPC_ATR_MANA,
    NPC_ATR_MANA_MAX,
    NPC_ATR_STRENGTH,
    NPC_ATR_DEXTERITY,
    NPC_ATR_REGENERATEHP,
    NPC_ATR_REGENERATEMANA,
    NPC_ATR_MAX
};

enum Hitchance
{
    NPC_HITCHANCE_1H,
    NPC_HITCHANCE_2H,
    NPC_HITCHANCE_BOW,
    NPC_HITCHANCE_CROSSBOW,
    NPC_HITCHANCE_MAX
};

local botOne;
local botTwo;

addEvent("onInit", function()
{
    enableDebugMode(true);
    setPosition(0, 200, 0);
    
    botOne = createNpc("Dragon 1", "DRAGON_FIRE");
    botTwo = createNpc("Dragon 2", "DRAGON_FIRE");
    
    setAttributeNpc(botOne, Attribute.NPC_ATR_MANA, 9999999999);
    setAttributeNpc(botOne, Attribute.NPC_ATR_MANA_MAX, 9999999999);
    setAttributeNpc(botTwo, Attribute.NPC_ATR_MANA, 9999999999);
    setAttributeNpc(botTwo, Attribute.NPC_ATR_MANA_MAX, 9999999999);    
    
    setPositionNpc(botOne, 0, 200, -1000);
});

function onKey(key, letter)
{
    if(key == KEY_V)
        selectSpellNpc(botOne, "itru_waterfist");
    else if(key == KEY_G)
        useSpellNpc(botOne, getNpcPointer("Dragon 2"));
};

Screens: 

[Image: 3rsqFnQ.jpg]

[Image: 0avkhjl.jpg]

[Image: ES9P5XA.jpg]

Download: 

http://speedy.sh/zca6q/clientBots.nut

http://www94.zippyshare.com/v/ttPown1T/file.html
Reply
#2
You wanna work on this project in future? Like add synch for all players etc? Really, great job and keep it up!
[Image: 2_1.png]
Reply
#3
Yep, is`s probably my plan for future
Reply
#4
In the future, bots will be built-in the core of G2O Wink
[Image: CPCFNwD.png]
Reply
#5
"In the future"
Code:
    createNpc(name, instance);
    destroyNpc(instance);
    setAdditionalVisualsNpc(npc_pointer, bodyModel, bodyTextureID, headModel, headTextureID);
    setPositionNpc(npc_pointer, x, y, z);
    setAngleNpc(npc_pointer, angle);

    setMagicLvlNpc(npc_instance, value);
    setWeaponSkillNpc(npc_instance, index, value);
    setStrengthNpc(npc_instance, value);
    setDexterityNpc(npc_instance, value);
    setHealthNpc(npc_instance, value);
    setMaxHealthNpc(npc_instance, value);
    setManaNpc(npc_instance, value);
    setMaxManaNpc(npc_instance, value);

    equipArmorNpc(npc_pointer, instance);
    sq_unEquipArmorNpc(npc_pointer);
    sq_equipMeleeWeaponNpc(npc_pointer, instance);
    sq_unEquipMeleeWeaponNpc(npc_pointer);
    sq_equipRangedWeaponNpc(npc_pointer, instance);
    sq_unEquipRangedWeaponNpc(npc_pointer);

    playAnimNpc(npc_pointer, anim);
    stopAnimNpc(npc_pointer);
    playFaceAnimNpc(npc_pointer, anim);
    stopFaceAnimNpc(npc_pointer);
    
    setWeaponModeNpc(npc_pointer, value);
    setEnemyNpc(npc_pointer, enemy_pointer);
    setSpellNpc(npc_pointer, spell);
    attackRangeWeaponNpc(npc_pointer);
    attackMeleeWeaponNpc(npc_pointer, combination);
    attackMagicNpc(npc_pointer);
    getPointerNpc(name);

    onHitNpc(npc_instance, damage); - callback


Simple script:

Code:
enum oCNpc_WeaponMode
{
    NPC_WEAPON_NONE,
    NPC_WEAPON_FIST
    NPC_WEAPON_DAG,
    NPC_WEAPON_1HS,
    NPC_WEAPON_2HS,
    NPC_WEAPON_BOW,
    NPC_WEAPON_CBOW,
    NPC_WEAPON_MAG,
    NPC_WEAPON_MAX
};

/* Melee combination 1H/2H
6 - A
7 - ADAD
8 - WD
9 - ADA
10 - ADAD
11 - ADW
*/

local botOne;
local botTwo;
local botThree;

addEvent("onInit", function()
{
    enableDebugMode(true);
    setPosition(0, 200, 0);
    setHealth(1000000);
    setMaxHealth(1000000);
    
    setDexterity(10000);
    setStrength(10000);
    giveItem("ITRW_ARROW", 1000);
    giveItem("ITRW_BOW_H_02", 10)
    giveItem("ITMW_ZWEIHAENDER2", 10)
    
    botOne = createNpc("Dragon 1", "DRAGON_FIRE");
    botTwo = createNpc("Dragon 2", "DRAGON_FIRE");
    
    botThree = createNpc("HeroMan", "PC_HERO");
   setAdditionalVisualsNpc(botThree, "hum_body_Naked0", 2, "Hum_Head_Pony", 65);
    
    setStrengthNpc(botThree, 100000);
    setDexterityNpc(botThree, 1000);
    setManaNpc(botThree, 1000000000);
    setMagicLvlNpc(botOne, 6);
    
    setWeaponSkillNpc(botThree, 1, 100);    
    setWeaponSkillNpc(botThree, 3, 100);    
    
    equipArmorNpc(botThree, "ITAR_PAL_M");
    equipMeleeWeaponNpc(botThree, "ITMW_ZWEIHAENDER2");
    //equipMeleeWeaponNpc(botThree, "ITMW_ELBASTARDO");

    //equipRangedWeaponNpc(botThree, "ITRW_CROSSBOW_H_02");
    equipRangedWeaponNpc(botThree, "ITRW_BOW_H_03");
    
        
    //unEquipRangedWeaponNpc(botThree);
    
    playFaceAnimNpc(botThree, "T_HURT");
    
    setManaNpc(botOne, 9999999999);
    setManaNpc(botOne, 9999999999);
    setManaNpc(botTwo, 9999999999);
    setManaNpc(botTwo, 9999999999);    
    
    
    setPositionNpc(botOne, 0, 200, -1000);
    setEnemyNpc(botOne, getPointerNpc("Ja"));
    setEnemyNpc(botThree, getPointerNpc("Ja"));
    
    setSpellNpc(botOne, "ITRU_THUNDERBALL");
    setSpellNpc(botThree, "ITRU_ICECUBE");
        
    setWeaponModeNpc(botOne, 7);
    setWeaponModeNpc(botThree, 4);    
    setTimer(function()
    {
        attackMagicNpc(botOne);
        attackMeleeWeaponNpc(botThree, 10);
        //attackRangedWeaponNpc(botThree);
    }, 4000, true);    
    
});

function onHitNpc(a, b)
{
    print(a + "  " + b)
    setHealth(getHealth() - b);
};

function onAnimation(a)
{
    //print(getAnimationName(a));
};

function onHit(pid)
{
    return 1;
};

function onKey(key, letter)
{
    /*if(key == KEY_V)
        selectSpellNpc(botOne, "itru_waterfist");
    else if(key == KEY_G)
        useSpellNpc(botOne, getNpcPointer("Dragon 2"));
    else if(key == KEY_J)
        setWeaponModeNpc(botThree, WeaponMode.NPC_WEAPON_1HS);*/    
};


Links: http://speedy.sh/ajJCb/G2O-Bot.nud

It`s last public version.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [New G2O][Client-Side] LocalStorage Patrix 0 119 08.05.2020, 15:38
Last Post: Patrix
  [New G2O] Module example Patrix 4 3,279 17.05.2019, 00:30
Last Post: Patrix
  [New G2O][Client-Side] Clipboard Patrix 7 4,033 07.02.2019, 00:45
Last Post: Patrix
  [New G2O][Client-Side] Music Module Nubzior 3 2,299 24.05.2018, 07:07
Last Post: Nubzior
  G2O - Client Side Bots(0.0.4) KimiorV 16 7,093 16.01.2017, 09:47
Last Post: KimiorV
  [DEV] G2O Bot module Sative 64 24,705 25.11.2016, 19:13
Last Post: HammelGammel

Forum Jump:


Users browsing this thread: 1 Guest(s)