![]() |
Re: Need some help for shield support
OK ; assuming your buy numbers are correct I see no problem with that array.
Can you post your buy function now ? Perhaps not the function, but the 15-20 lines that make the bot buy, at least. |
Re: Need some help for shield support
Quote:
|
Re: Need some help for shield support
I remember there is a problem with the "menuselect n" client commands in CS 1.6. It's not your fault; it's a CS bug. To make sure bots buy effectively what you tell them to buy you should make them buy using the new shortcuts (like "famas", "deagle", etc.) For this I advise you to change a bit your bot_weapon_select_t structure and change these
int iNewBuySelectT; int iNewBuySelectCT; into a char array where you will put the buy shortcut to use for each weapon. For example: char buy_shortcut[32]; You can then replace FakeClientCommand(pEdict, "menuselect",szMenuSelect, NULL); with FakeClientCommand(pEdict, pBot->pSelected_weapon->buy_shortcut, NULL, NULL); |
Re: Need some help for shield support
Ok, I do that think but I can't test the bots becorse the C++ compiler give me error masege :
error LNK2001: unresolved external symbol "void __cdecl FakeClientCommand(struct edict_s *,char const *,...)" (?FakeClientCommand@@YAXPAUedict_s@@PBDZZ) How to fix this problem. |
Re: Need some help for shield support
What compiler are you using?
Also, it looks like you didn't link some object in with your code. |
Re: Need some help for shield support
So, I done what you are say PMB but now the bots don't buy anythink. :'(
|
Re: Need some help for shield support
look at pbmm buy code...
you can't use it since it's GPLed but you can get the concept of what it does... |
Re: Need some help for shield support
It looks like you did things wrong. I suspect you made the modifications to the wrong place. Can you post your changes to your original buy function ?
|
Re: Need some help for shield support
OK, OK I think that I know where is the problem.
The function buy_shortcut must be declared somewere with the weapons that will be in that function, but where and how to declared the function. P.S. PMB I change only this that you tell me and added in the weapons ID menuselect function. So where to declare the another part of the function buy_shortcut??? I think that this function must be declared in some .cpp file not only in bot.h. I think that this is the problem. |
Re: Need some help for shield support
OUCH
I really think you need to take some C classes, friend :) Lesson #1. A function is something like void DoSomething (int parameter1, float parameter2) or int DoSomethingElse (Vector parameter1) in fact it can take any form you want, either it does not return a value - and then the type is "void" - or it returns a value after execution, and then the type is int, float, or any data type you want. When a function is called in the code, the computer branches the execution right into it, executes the function, and once the function is finished returns to the point from where it was called. Functions usually end up with the statement "return". When the function has a return type of "void", then "return" does not need to be called. The code will just exit the function as soon as the last closing brace } is reached. On functions that are required to return a value, though, the return value must be explicitly passed as a parameter of the "return" instruction. Example: return (-1); // this function will return -1 or return (my_variable); // this function will return the value of my_variable A data type is an identifier that tells what type of data you are allowed to put in a variable. Example: int variable_1; // in this variable you can put integer numbers only (like 1 or 2) float variable_2; // in this variable you are allowed to put floating-point numbers (like 0.5) char variable_3; // in this one you can put a character like 'a' or 'b' It's not that exact. In fact in "char" variables you are also allowed to put integer numbers, like in "int" variables you can put other forms of data, like pointers, etc. All comes down to the size the variable takes in memory. "int" variables eat up 4 bytes, hence 4*8=32 bit of data (32 times 0 and 1s). That's why you are also allowed to store pointers in them, since a pointer is usually 4 bytes large too. On the other hand, "char" variables eat just 1 byte, hence 8 bits. With only 8 bits to describe a number you cannot go above +/-127 (if you keep the last bit to describe the sign, thus the data will be said signed), or 255 (if you eat the whole 8 bits for your number, and then the data will be said unsigned and you will have only positive numbers in it). With so few you cannot store pointers which are big numbers, and usually go way above 255. You can also arrange your data in arrays. Arrays are just a set of variables of the same type put next to each other in memory. Example: char variable1[32]; // this is an array of "char" variables In this one you can put 32 characters, or 32 integer numbers provided each of them does not exceed 127 (since "char" means signed char). You can hence put characters char variable1[32] = "abcdef"; // like some text (you're not forced to eat up all the 32 slots) Or integer values char variable1[32] = {1,45,53,23,123,6,84,22}; // as long as they don't go above 127 Char, int, long, short, float, double, void, are standard C data types. But in his code, a programmer may need to use more complex forms of data. Like, for example, a vector. A vector must be described by 3 real (floating point) numbers, and that obviously cannot fit in one single variable. One could do this: float x_component; float y_component; float z_component; but that's not very practical. The C language provides much better mechanisms for describing more complex types of data. A struct (abbreviation for "structure") is when you tell the C compiler: "hey, from now on, I will make use of a new type of data that you don't know yet. It will be named XXXX and it will be composed of : this, that and that." Example: typedef struct { char variable1; // first member of my struct will be a "char" variable float variable2; // second member will be a floating point variable int variable3; // and the third slot will be occupied with an integer number. } my_struct; Here you say to the compiler: look, I am telling you of this new data type I am going to use. It's called "my_struct". In it you will find 1st - a char variable 2nd - a float variable 3rd and last - an int variable. And from then on, in your code, you can use this new struct, the compiler will know about it. For example, at the beginning of a function, you can declare: my_struct blablablah; just like you would declare float variable1; or any other form of data. Since your struct has been defined, the compiler will know about it. You will then be able to access your struct's members like this: blablablah.variable1 = 'a'; // put 'a' in the 1st member of my struct blablablah.variable2 = 0.5; // put 0.5 in the 2nd one (it's a float variable) blablablah.variable3 = 435264; // and so on. In the Half-Life SDK, the Vector data type can be seen as a custom struct, having members named x, y and z. You can do: Vector some_vector; // declare a new vector some_vector.x = 0.324; // access x component some_vector.y = 5643.546; // access y component some_vector.z = 32.3; // access z component (in fact it's a bit more complex. Vector is not only a struct, it's a class. A class can be seen like a struct, in which you put not only variables, but also functions, like Length() for example.) Now look at this: Code:
typedef struct A structure, obviously. Its name is bot_weapon_select_t and it has the aforementioned members. Question 2. What must buy_shortcut be ? buy_shortcut must be a member of the bot_weapon_select_t structure, so that you can use it in further declarations of bot_weapon_select_t variables. Question 3. How do you need to define buy_shortcut ? Simply by adding it to the list with the other members of the bot_weapon_select_t structure. If you answer these questions right, you will know enough to fix your problem. If you CANNOT answer them right, IMO it's too early for you to take on the development of a bot as complicated as podbot :( The answer is provided in clear text, btw :) |
All times are GMT +2. The time now is 18:37. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.