Archived copy of warcraft-source.com, the Warcraft: Source (WCS) forum (2007–2011), rebuilt from the Internet Archive by wc3mods.net. This page was captured on 2011-09-18 (original capture). Home · Forum · All archived topics · Downloads

Author Topic: [Tutorial] How to use wcsgroup  (Read 1141 times)

Online La Muerte

  • Administrator
  • Level 7 Expert
  • *****
  • Posts: 1529
  • Country: be
  • Nuclear Dawn?!
    • Counterstrike Combat Crew
[Tutorial] How to use wcsgroup
« on: April 19, 2011, 10:54:35 AM »
Hi all,

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!
« Last Edit: April 19, 2011, 11:07:27 AM by La Muerte »
I've seen the ways of god, I'll take the devil any day.


Offline $Diablo$

  • Level 7 Expert
  • *****
  • Posts: 576
  • Country: au
Re: [Tutorial] How to use wcsgroup
« Reply #1 on: April 19, 2011, 11:34:13 AM »
Thanks La Muerte, very interesting tutorial

Online La Muerte

  • Administrator
  • Level 7 Expert
  • *****
  • Posts: 1529
  • Country: be
  • Nuclear Dawn?!
    • Counterstrike Combat Crew
Re: [Tutorial] How to use wcsgroup
« Reply #2 on: April 19, 2011, 05:17:18 PM »
Your welcome,
races can become a lot more interesting if you use wcsgroup on them.
I've seen the ways of god, I'll take the devil any day.

Offline RedNäck

  • Level 7 Expert
  • *****
  • Posts: 322
  • Country: us
  • My new WCS-Server is Coming: 188.138.84.147:28125
    • www.fallen-unit.com
Re: [Tutorial] How to use wcsgroup
« Reply #3 on: April 19, 2011, 06:39:20 PM »
very very nice, very good, explenations
Ok here is a usefull Code:

cmd = "if (Pi != 3.147) then es_tell event_var(userid) YOU ARE BETTER THAN CHUCK NORRIS"

Offline Aenima

  • Level 6 Experienced
  • *****
  • Posts: 125
  • Country:
  • Learn to Swim !
Re: [Tutorial] How to use wcsgroup
« Reply #4 on: April 21, 2011, 01:23:30 PM »
Thx again La Muerte ! thats very useful for newbs like me  :)

now i have a question :

i wanna set a wcsgroup variable (my_var) back to 0 when a player dies,
but i want to know what is best to do  (if either one is "Heavier" for the server) :

1) doing a check to see if the var was used by the race and THEN set it to 0 :
Code: [Select]
event player_death
{
es wcsgroup get my_var wcs_tmp event_var(userid)
if (server_var(wcs_tmp) > 0) do
{
es wcsgroup set my_var event_var(userid) 0
}
}

2) or just set the variable to 0 each time anyone dies even if the var is not used:
Code: [Select]
event player_death
{
es wcsgroup set my_var event_var(userid) 0
}

Offline Predz

  • Level 6 Experienced
  • *****
  • Posts: 120
  • Country:
  • Adding New Addons for Eventscripts.
Re: [Tutorial] How to use wcsgroup
« Reply #5 on: April 21, 2011, 01:36:41 PM »
The second one would work the best. And the most simple :D.

If you want to look at some uses of "wcsgroup", please modify my newest version of WCS Assists. It should be a good way to show some of you who want to learn how to use "wcsgroup" how to use it.

I have used it in multiple ways.
- To "get" variables to use in "es_tell" Commands.
- To "set" variables that have been edited by es_math, and es_mathparse.
- Something I learnt only today! This being "es_mathparse myvar "rint(myvar)".
- etc 

Offline tintinibar

  • Level 7 Expert
  • *****
  • Posts: 174
Re: [Tutorial] How to use wcsgroup
« Reply #6 on: May 03, 2011, 10:22:19 PM »
what is the difference between using this method and having more wcs_tmp's added to the mod and using them more spread out?

Offline MiB

  • Level 7 Expert
  • *****
  • Posts: 1604
  • Country: us
Re: [Tutorial] How to use wcsgroup
« Reply #7 on: May 04, 2011, 09:19:46 AM »
It would be more ideal to use these if you need per player data and not global, because for example lets say you make a skill which executes something every time a player jumps and you want to make it do something special. We would want it to only happen when that player has that key set to 1(or whatever on value you want) instead of checking if one global variable is on.

~MiB
Quote from: MiB
«₥ٱβ»: Pwned.
Tha Pwned: What?
«₥ٱβ»: Learn general herpies.... I mean general python lol.

Offline tintinibar

  • Level 7 Expert
  • *****
  • Posts: 174
Re: [Tutorial] How to use wcsgroup
« Reply #8 on: May 04, 2011, 10:16:25 PM »
I think I know what you are saying but would like to know how it is more specific than global. What does setting wcs_invis to 1, then running that extra check on event player_hurt do that you can't do with wcs_tmp, tmp1, tmp2, etc.?

Why not use wcs_tmp1 instead of a groupvar, and then use wcs_tmp2 to caputre and check the value against?

Offline Aenima

  • Level 6 Experienced
  • *****
  • Posts: 125
  • Country:
  • Learn to Swim !
Re: [Tutorial] How to use wcsgroup
« Reply #9 on: May 05, 2011, 12:32:07 AM »
wcsgroup is good to use in many different ways,
im still novice with it but among other things i find it useful to store a value to use later with es_delayed, cause if you do it with a server var it will mess ppl skills when 2 or more are playing the same race, and if you have a lot of races you will most likely have the predefined vars used by many skills at the same time

ex: i have a poison skill (x dmg/sec for Y seconds) and i dont want it to be able to apply again on a player (and stack) while its already active,
if i just set a server var (wcs_tmp) for Y seconds to prevent poison  then other ppl with the same race wont be able to poison anyone for that time (cause wcs_tmp is a server var set for the whole server) AND i wont be able to poison other different targets...
so instead i can use wcsgroup to set that check var to the victim only and still be able to use the skill on other targets



Offline HOLLIDAY

  • <Race Maker>
  • Moderator
  • Level 7 Expert
  • Posts: 2601
  • Country:
  • of all the things ive lost i miss my mind the most
    • http://holliday.clanservers.com
Re: [Tutorial] How to use wcsgroup
« Reply #10 on: June 26, 2011, 10:30:28 PM »
can i use wcsgroup get     to get a players skill levels?


so i can then say if skilllevel = 1 do
instead of setting and getting different keyvalues for each level of each skill

Online Kami

  • Moderator
  • Level 7 Expert
  • Posts: 587
  • Country: de
  • Pokemon Master!
Re: [Tutorial] How to use wcsgroup
« Reply #11 on: June 27, 2011, 01:20:45 AM »
currently there is no non-python way to get players skill lvl. I will try to add that command :>
Quote
12:17 - its dead#: You're like "Oh look mine is that long"
12:17 - Tha Pwned: ... lol.
12:17 - Tha Pwned: I need a new one
12:18 - Tha Pwned: Thinking about throwing it out of the window
Quote
21:42 - Kami: I sold races.
21:42 - Kami: U mad?
21:42 - Kami was blocked by Tha Pwned. Please contact Support for further information.
21:44 - Tha Pwned: Was brushing my teeth
21:45 - Tha Pwned: Cya tommorow

Offline HOLLIDAY

  • <Race Maker>
  • Moderator
  • Level 7 Expert
  • Posts: 2601
  • Country:
  • of all the things ive lost i miss my mind the most
    • http://holliday.clanservers.com
Re: [Tutorial] How to use wcsgroup
« Reply #12 on: June 28, 2011, 02:09:41 AM »
limitations......

i loved when races were in keygroups

but i think the onchange field might help in this case,

that command would be very useful
 
how hard would it be for a python script to get all the information from the races.ini and put it into a keygroup?


« Last Edit: June 28, 2011, 02:15:13 AM by HOLLIDAY »

Offline Jukeb0xi

  • Level 7 Expert
  • *****
  • Posts: 153
  • Country:
  • need help on effects
Re: [Tutorial] How to use wcsgroup
« Reply #13 on: July 01, 2011, 02:26:21 PM »
Okay so where is the part what teaches How make ultimate like click 1: Freeze my self Click 2:Unfreeze my self

And Kamiqawa sayed i need learn wcsgroup to my skill...
If you need help add the_nakkimakkara on steam

But not on every effect



















Add the_nakkimakkara
Or send me email to [email protected]

Offline PreDominance

  • Level 7 Expert
  • *****
  • Posts: 346
  • Country:
  • Creativity is your biggest restriction
    • ?WwT?
Re: [Tutorial] How to use wcsgroup
« Reply #14 on: July 01, 2011, 08:05:52 PM »
He is very much right.

I want you to try to code the skill yourself. Try and learn Wcsgroup on your own, then look at my skill below.
(click to show/hide)
Need help?

Steam:penumbra789                                      
Clan:?WwT? Wcs/Zm mod.                  
ClanWeb:wwt-clan.info


 


Powered by EzPortal