IPB

Welcome Guest ( Log In | Register )

> Adding More Weapons?
JRob
post Oct 6 2015, 10:24 AM
Post #1


Advanced Member
***

Group: Members
Posts: 52
Joined: 30-April 11
Member No.: 1,970



I have tried adding more weapons to bot_weapons.cpp and bot_weapons.h but to no success.

CODE

    {TF2_SLOT_PRMRY,TF2_WEAPON_HANDGUN_SCOUT_PRIMARY,        "tf_weapon_handgun_scout_primary",    WEAP_FL_KILLPIPEBOMBS|WEAP_FL_PRIM_ATTACK|WEAP_FL_UNDERWATER,0,800,1,3,0},
    {TF2_SLOT_PRMRY,TF2_WEAPON_SODA_POPPER,                    "tf_weapon_soda_popper",    WEAP_FL_KILLPIPEBOMBS|WEAP_FL_PRIM_ATTACK|WEAP_FL_UNDERWATER,0,800,1,3,0},
    {TF2_SLOT_PRMRY,TF2_WEAPON_PEP_BRAWLER_BLASTER,            "tf_weapon_pep_brawler_blaster",    WEAP_FL_KILLPIPEBOMBS|WEAP_FL_PRIM_ATTACK|WEAP_FL_UNDERWATER,0,800,1,3,0},
    {TF2_SLOT_SCNDR,TF2_WEAPON_JAR_MILK,                    "tf_weapon_jar_milk",    WEAP_FL_NONE,0,180,0,1,0},
    {TF2_SLOT_PRMRY,TF2_WEAPON_ROCKETLAUNCHER_AIRSTRIKE,    "tf_weapon_rocketlauncher_airstrike",    WEAP_FL_PRIM_ATTACK|WEAP_FL_EXPLOSIVE|WEAP_FL_UNDERWATER,BLAST_RADIUS*0.9,4096,1,3,TF2_ROCKETSPEED},
    {TF2_SLOT_SCNDR,TF2_WEAPON_FLAREGUN_REVENGE,             "tf_weapon_flaregun_revenge", WEAP_FL_PRIM_ATTACK, 0, 1600, 2, 2, TF2_GRENADESPEED * 1.5 },
    {TF2_SLOT_PRMRY,TF2_WEAPON_CANNON,                        "tf_weapon_cannon",   & nbsp;WEAP_FL_PROJECTILE|WEAP_FL_PRIM_ATTACK|WEAP_FL_EXPLOSIVE|WEAP_FL_UNDERWATER
,100,1200,1,2,TF2_GRENADESPEED*1.5},
    {TF2_SLOT_PRMRY,TF2_WEAPON_SHOTGUN_BUILDING_RESCUE,        "tf_weapon_shotgun_building_rescue",    WEAP_FL_KILLPIPEBOMBS|WEAP_FL_PRIM_ATTACK|WEAP_FL_UNDERWATER,0,800,1,2,0},

    // short circuit
    // wrangler
    {TF2_SLOT_MELEE,TF2_WEAPON_ROBOT_ARM,                    "tf_weapon_robot_arm",    WEAP_FL_PRIM_ATTACK|WEAP_FL_MELEE|WEAP_FL_UNDERWATER,0,180,3,1,0},

    {TF2_SLOT_PRMRY,TF2_WEAPON_SNIPERRIFLE_DECAP,            "tf_weapon_sniperrifle_decap",    WEAP_FL_SCOPE|WEAP_FL_PRIM_ATTACK,1000,4000,1,3,0},
    {TF2_SLOT_PRMRY,TF2_WEAPON_SNIPERRIFLE_CLASSIC,            "tf_weapon_sniperrifle_classic",    WEAP_FL_SCOPE|WEAP_FL_PRIM_ATTACK,1000,4000,1,3,0},

...

    TF2_WEAPON_HANDGUN_SCOUT_PRIMARY,
    TF2_WEAPON_SODA_POPPER,
    TF2_WEAPON_PEP_BRAWLER_BLASTER,
    TF2_WEAPON_JAR_MILK,
    TF2_WEAPON_ROCKETLAUNCHER_AIRSTRIKE,
    TF2_WEAPON_FLAREGUN_REVENGE,
    TF2_WEAPON_CANNON,
    TF2_WEAPON_SHOTGUN_BUILDING_RESCUE,
    TF2_WEAPON_ROBOT_ARM,
    TF2_WEAPON_SNIPERRIFLE_DECAP,
    TF2_WEAPON_SNIPERRIFLE_CLASSIC,


Apparently, there seems to be a MAX_WEAPONS defined to 48. I tried redefining this to TF2_WEAPON_MAX but it only results in random crashes. How are you supposed to add more than 48 weapons? There are obviously more than 48 weapon types in the game. I noticed that you have only been replacing unused entries to avoid this problem.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
 
Reply to this topicStart new topic
Replies
Cheeseh
post Oct 6 2015, 12:17 PM
Post #2


Admin
*****

Group: Admin
Posts: 3,066
Joined: 11-September 03
From: uk
Member No.: 1



the default weapons in weapons.cpp is no longer used if you have weapons.ini in the config folder
see: http://rcbot.bots-united.com/forums/index....ost&p=13465
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
JRob
post Oct 6 2015, 07:50 PM
Post #3


Advanced Member
***

Group: Members
Posts: 52
Joined: 30-April 11
Member No.: 1,970



I just updated and it still crashes when I try to add more weapons through weapons.ini.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Cheeseh
post Oct 7 2015, 01:53 PM
Post #4


Admin
*****

Group: Admin
Posts: 3,066
Joined: 11-September 03
From: uk
Member No.: 1



QUOTE(JRob @ Oct 6 2015, 08:50 PM) *

I just updated and it still crashes when I try to add more weapons through weapons.ini.


MAX_WEAPONS is how many weapons a player can carry, not the maximum number of weapons in the game, although the old rcbot code used this as a maximum for in the game for convenience sake.

Though if you want to add a new weapon without weapons .ini, you need to have this:

CODE

{0, 0, "\0", 0, 0, 0, 0, 0, 0}//signal last weapon


at the end of the WeaponsData_t [] weaponlist

I noticed this was omitted out of DODs and HL2DM so I've added this back in just in case.

Could you locate where in the code it is crashing due to changing weapons.ini file?
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
JRob
post Oct 7 2015, 11:38 PM
Post #5


Advanced Member
***

Group: Members
Posts: 52
Joined: 30-April 11
Member No.: 1,970



QUOTE(Cheeseh @ Oct 7 2015, 01:53 PM) *

MAX_WEAPONS is how many weapons a player can carry, not the maximum number of weapons in the game, although the old rcbot code used this as a maximum for in the game for convenience sake.

Though if you want to add a new weapon without weapons .ini, you need to have this:

CODE

{0, 0, "\0", 0, 0, 0, 0, 0, 0}//signal last weapon


at the end of the WeaponsData_t [] weaponlist

I noticed this was omitted out of DODs and HL2DM so I've added this back in just in case.

Could you locate where in the code it is crashing due to changing weapons.ini file?


Line numbers for bot_task.cpp might be a bit off since I have added crash fixes you haven't incorporated yet.

I am using weapons.ini now so it is not an issue with the old way of adding weapons.

This is one of the crashes I get. There is another one but I deleted it.

#0 0xebefc76c in CWeapon::getID (this=0x0) at bot_weapons.h:423
423 return m_iWeaponId;
#0 0xebefc76c in CWeapon::getID (this=0x0) at bot_weapons.h:423
#1 0xebefc7fe in CBotWeapon::getID (this=0x158f2bd8) at bot_weapons.h:602
#2 0xebf6083e in CBotUseLunchBoxDrink::execute (this=0x14ba1440, pBot=0xafaa140, pSchedule=0x131880a8) at bot_task.cpp:1489
#3 0xebf57a04 in CBotSchedule::execute (this=0x131880a8, pBot=0xafaa140) at bot_schedule.cpp:798
#4 0xebee2fe5 in CBotSchedules::execute (this=0xe2910b8, pBot=0xafaa140) at bot_schedule.h:246
#5 0xebed8d79 in CBot::think (this=0xafaa140) at bot.cpp:960
#6 0xebee1267 in CBots::botThink () at bot.cpp:3566
#7 0xebf4aef6 in RCBotPluginMeta::Hook_GameFrame (this=0xec017c98 <g_RCBotPluginMeta>, simulating=true) at bot_plugin_meta.cpp:1266

The maximum number of weapons a player can carry is really 48? That seems really high. And it is strange that your weapon array is also MAX_WEAPONS.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 16th June 2025 - 12:08 AM