Raised This Month: $51 Target: $400
 12% 

Trying to Understand #define Macros values in War3TFT


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wEr3
Junior Member
Join Date: Jun 2017
Old 09-02-2022 , 12:50   Trying to Understand #define Macros values in War3TFT
Reply With Quote #1

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:
#define    TASK_LIGHTNING 960 

// Initial Ultimate call
public OR_ULT_ChainLightningiCasteriTargetiBodyPart )
{

    
// Display the lightning effect
    
OR_ULT_ChainEffectiCasteriTargetCHAINLIGHTNING_LINEWIDTHCHAINLIGHTNING_DAMAGEiBodyPart );
    

    
// Now we need to search for the next "jump"
    
new parm[5];
    
parm[0] = iTarget;
    
parm[1] = CHAINLIGHTNING_DAMAGE;
    
parm[2] = CHAINLIGHTNING_LINEWIDTH;
    
parm[3] = iCaster;
    
parm[4] = iBodyPart;

    
set_task0.2"_OR_ULT_ChainLightning"TASK_LIGHTNING iTargetparm); 
Could you explain the TASK_LIGHTNING which is #define value of 960 .
Attached Thumbnails
Click image for larger version

Name:	valuemacros.jpg
Views:	52
Size:	94.7 KB
ID:	196632  
wEr3 is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 09-02-2022 , 13:47   Re: Trying to Understand #define Macros values in War3TFT
Reply With Quote #2

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
jimaway is offline
wEr3
Junior Member
Join Date: Jun 2017
Old 09-02-2022 , 14:01   Re: Trying to Understand #define Macros values in War3TFT
Reply With Quote #3

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.
wEr3 is offline
zXCaptainXz
Member
Join Date: May 2017
Old 09-02-2022 , 15:27   Re: Trying to Understand #define Macros values in War3TFT
Reply With Quote #4

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.
zXCaptainXz is offline
wEr3
Junior Member
Join Date: Jun 2017
Old 09-02-2022 , 15:41   Re: Trying to Understand #define Macros values in War3TFT
Reply With Quote #5

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.
wEr3 is offline
zXCaptainXz
Member
Join Date: May 2017
Old 09-02-2022 , 16:22   Re: Trying to Understand #define Macros values in War3TFT
Reply With Quote #6

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.
zXCaptainXz is offline
wEr3
Junior Member
Join Date: Jun 2017
Old 09-02-2022 , 17:36   Re: Trying to Understand #define Macros values in War3TFT
Reply With Quote #7

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 .

Last edited by wEr3; 09-02-2022 at 17:41.
wEr3 is offline
wEr3
Junior Member
Join Date: Jun 2017
Old 09-02-2022 , 21:04   Re: Trying to Understand #define Macros values in War3TFT
Reply With Quote #8

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;
}
wEr3 is offline
zXCaptainXz
Member
Join Date: May 2017
Old 09-03-2022 , 02:49   Re: Trying to Understand #define Macros values in War3TFT
Reply With Quote #9

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
zXCaptainXz is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:52.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode