Trying to Understand #define Macros values in War3TFT
1 Attachment(s)
I'm sorry for bother you , but what are these #define macro values , are there real values because there are not used in Race functions with like real values. For Example
PHP Code:
|
Re: Trying to Understand #define Macros values in War3TFT
during the compile the TASK_LIGHTNING is replaced with 960. it's essentially hardcoding a value, but with the added benefit of being able to replace all the values from 1 line
|
Re: Trying to Understand #define Macros values in War3TFT
Yes i know that TASK_LIGHTNING is replaced with 960 , but I don't know the set_task( 0.2, "_OR_ULT_ChainLightning", TASK_LIGHTNING + iTarget, parm, 5 );
is used for the range of lightning or what. I'm trying to code my own war3Tft for zombie biohazard mod. |
Re: Trying to Understand #define Macros values in War3TFT
Tasks are used to execute functions in a timely manner. You can schedule a function to be executed once, multiple times, or infinitely, while passing the required parameters. Check this link out for parameter descriptions https://www.amxmodx.org/api/amxmodx/set_task
In some cases, especially when you are executing a function that loops indefinitely and which is unique to each player (for example, a function that checks if you have been camping in the same place for too long), you can assign each task an ID related to each player (player 1 gets task 1, player 2 gets task 2...). You can do the same for multiple tasks, you can have multiple tasks with the same ID with no problem at all. The problem however, is that you cannot manage those tasks, say if you wanna remove them or check if they exist. Thus, for each task you wanna loop over players, one way to do it is to define base IDs (each macro you are asking about represent each functionality which should be looped over every player) for each function and offset them by 32 each, then you offset that base id by each player's id to get that player's task for that specific function. Tl;dr changing those values is totally useless, if not even harmful to the plugin's execution. You can change them, but make sure they are offset by at least 32 each, or a task assigned for function one player will conflict with another on another player. Sorry for the long explanation, this is not a beginner topic, I hope I made myself as clear as possible. |
Re: Trying to Understand #define Macros values in War3TFT
okay but why value of 960 i know set_task native function.
and other like #define TASK_UDELAY 3002 // Ultimate delay function these values 3002 i don't get it. THANKS for you time i will try to understand it. |
Re: Trying to Understand #define Macros values in War3TFT
Like I said above, each task needs a specific ID in order to check if it exists/remove it. If you define TASK_LIGHTING as 960, then tasks 961,962,963...992 will be the tasks responsible for creating lighting for players number 1,2,3...32. It's just an assigned ID, changing it won't affect the lighting or the function execution at all, as long as you make sure that no other constant is defined within 32 more or 32 less integers. Say you have another task defined at 950, then tasks 961(960+1)->982(950+32) will be shared between 2 functionalities. So when you try to remove lighting for a player, you accidentally remove say sound effects for another.
If it's still unclear at this point, just take my word for it and don't touch that file, best case scenario nothing will change, worst case you will break that plugin. |
Re: Trying to Understand #define Macros values in War3TFT
okay I understand but i'm trying to code my own war3Tft mod for zombie biohazard , because we used to play a lot 10 years ago with this mod but was for classic made not for zombie mod. So I want to code myself. THANKS SO MUCH i will look for TASK ID .
|
Re: Trying to Understand #define Macros values in War3TFT
Just one more thing PLEASE . about these values.
#define PB_ISCONNECTED 21 #define PB_LAST 32 Variable //// new bool:p_data_b[33][PB_LAST] // Contains player data of type boolean // Function will check to see if a user is stuck in a wall public _HU_ULT_BlinkStuck( parm[] ) { new id = parm[0] if ( !p_data_b[id][PB_ISCONNECTED] ) { return; } |
Re: Trying to Understand #define Macros values in War3TFT
I believe those are boolean (true/false) 2D arrays which manage player related data, 2D arrays are like a table with rows and columns, each player represents a row, and the required information on that player represents a column. So PB_ISCONNECTED=31 means that the 32nd (not 31st, since indices start from 0) column represents which players are connected, so when a player connects, you check his row in that column and enable it (set it to true), when he disconnects you set it to false, and when you want to check if he's connected at any point, you just check his field in that column. I believe PB_LAST is used to tell the plugin how many columns you wanna add, so it marks the last column. So if you wanna add another column, you increase PB_LAST by one, and you define that new column, say #define PB_IS_AFK 32, and PB_LAST 33
|
| All times are GMT -4. The time now is 15:39. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.