Hi all,
What is wcsgroup?
Well, wcsgroup is the modern version of es_keyget/set values.
It can be used to set or get values from spawncmd, or across multiple skills to create more unique races.
we use wcsgroup to get/set a value to a key.
=> the key can be anything, example below: myhitvalue.
=> the value can be any number or server_variable, below we use server_var(wcs_tmp) to math the key +1 on every attack.
Basically we can set the value to 0,1,2,3,...200 and do es_xmath to the value if we set the value as a server_variable.
In that case it's best for your server performance to use a predefined variable, e.g.: wcs_tmp
Note: using delays is not recommended unless you know what your doing, wcs_tmp is an universal variable and will most likely be called by another race during the delay time and set the value to whatever it is that the other races needs it to be. If you want to use delays, then get the variable from the key again, with "es wcsgroup get <value> <var> <userid>".
Example: of spawncmd + attacker + ultimate to create a stealth mode ultimate after doing enough hits
Explanation:
Spawncmd: We set the key value to 0 at the beginning of the round
Attacker skill: Every time we hit someone:
1. we get the current value from the key and give it to wcs_tmp
2. we math the value +1
3. we set the new value to the key again
Ultimate skill: If we press ultimate (10 sec cooldown), the server will:
1. get the value from the key and set give it to wcs_tmp.
2a. check if value greater then 10, and if so it will execute racealias_didmyhits.
2b. check if the value is smaller then 10, if so tell you did not enough hits for the ultimate,
which makes you will have to wait till cooldown is over and try to hit more enemies during the cooldown period.
3. if greater then 10, it will set player invisible for a certain amount of time, defined by a variable depending upon your level.
And it will set the value of the key to 0.
Note: This was just one example on how you could use wcsgroup, its just a bit of a brainstorm really.
You can make tons of unique races when you master how to use wcsgroup, all you need is a bit of imagination.
As you might have noticed there is also an optional team option to the syntax of wcsgroup, so you have plenty possibilities to play around with!
Good Luck!
In this tutorial I will attempt to explain to you how to use wcsgroup.
What is wcsgroup?
Well, wcsgroup is the modern version of es_keyget/set values.
It can be used to set or get values from spawncmd, or across multiple skills to create more unique races.
Code: [Select]
es wcsgroup get <key> <var> <userid> <[team]>
es wcsgroup set <key> <userid> <value> <[team]>we use wcsgroup to get/set a value to a key.
=> the key can be anything, example below: myhitvalue.
=> the value can be any number or server_variable, below we use server_var(wcs_tmp) to math the key +1 on every attack.
Basically we can set the value to 0,1,2,3,...200 and do es_xmath to the value if we set the value as a server_variable.
In that case it's best for your server performance to use a predefined variable, e.g.: wcs_tmp
Note: using delays is not recommended unless you know what your doing, wcs_tmp is an universal variable and will most likely be called by another race during the delay time and set the value to whatever it is that the other races needs it to be. If you want to use delays, then get the variable from the key again, with "es wcsgroup get <value> <var> <userid>".
Example: of spawncmd + attacker + ultimate to create a stealth mode ultimate after doing enough hits
Code: [Select]
spawncmd = "es wcsgroup set myhitvalue event_var(userid) 0"
[[skill1]] #attacker skill
setting = ""
cmd = "es wcsgroup get myhitvalue wcs_tmp event_var(attacker);es_xmath wcs_tmp + 1;es wcsgroup set myhitvalue event_var(attacker) server_var(wcs_tmp)"
sfx = ""
[[skill2]] #ultimate skill
setting = "es_xset wcs_time 5;es_xset wcs_time 7;es_xset wcs_time 10;es_xset wcs_time 12"
cmd = "es wcsgroup get myhitvalue wcs_tmp server_var(wcs_userid);if (server_var(wcs_tmp) >= 10) then wcs_xalias racealias_didmyhits;if (server_var(wcs_tmp) < 10) then es_xtell server_var(wcs_userid) #multi #green you have only done server_var(wcs_tmp) hits so far, #lightgreen return to the battlefield!"
racealias_didmyhits = "es_tell server_var(wcs_userid) #multi #green you have done server_var(wcs_tmp) hits, #lightgreen time for stealth mode;es wcs_color server_var(wcs_userid) 255 255 255 30 1;es_xdelayed server_var(wcs_time) wcs_color server_var(wcs_userid) 255 255 255 255 0;es wcsgroup set myhitvalue server_var(wcs_userid) 0"
sfx = ""
cooldown = "10"Explanation:
Spawncmd: We set the key value to 0 at the beginning of the round
Attacker skill: Every time we hit someone:
1. we get the current value from the key and give it to wcs_tmp
2. we math the value +1
3. we set the new value to the key again
Ultimate skill: If we press ultimate (10 sec cooldown), the server will:
1. get the value from the key and set give it to wcs_tmp.
2a. check if value greater then 10, and if so it will execute racealias_didmyhits.
2b. check if the value is smaller then 10, if so tell you did not enough hits for the ultimate,
which makes you will have to wait till cooldown is over and try to hit more enemies during the cooldown period.
3. if greater then 10, it will set player invisible for a certain amount of time, defined by a variable depending upon your level.
And it will set the value of the key to 0.
Note: This was just one example on how you could use wcsgroup, its just a bit of a brainstorm really.
You can make tons of unique races when you master how to use wcsgroup, all you need is a bit of imagination.
As you might have noticed there is also an optional team option to the syntax of wcsgroup, so you have plenty possibilities to play around with!
Good Luck!



Logged





.
