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 2009-02-26 (original capture). Home · Forum · All archived topics · Downloads
Warcraft-Source.com - WCS mod for CSS
February 26, 2009, 02:10:30 AM *
Welcome, Guest. Please login or register.
Login with username, password and session length
News: Hall of Fame
Must Visit it
Google  
  Home   Forum   Help Search Login Register   *
Pages: 1 2 [3] 4   Go Down
  Print  
Current Topic Rating: ***** You have not rated this topic. Select a rating:
Author Topic: How to code your first Python Race...  (Read 1420 times)
freddukes
WCS ESP Dev Team
Level 7 Expert

Offline Offline

United Kingdom

Posts: 287



« on: February 17, 2008, 04:22:22 AM »

Right, python works by Local Variables... This means that all variables defined inside the script, will stay inside the script. Why you ask? Of course, to make it easier for the script to know where everything is, and save Huge amounts of speed. This also now means, that all your variables to not have to be unique... (Of course there are a few exceptions, which I'll tell you about later...)

If you don't know already, python uses things called 'methods' otherwise known function. They act VERY similarly to an Eventscript block... you define a method by calling the command 'def' e.g.

Code
GeSHi (python):
def MyMethod():
 

Now, note 2 different things here compared with ESS Blocks. The first being the brackets, I'll explain what these mean later, but for now, just ignore them. Look at the colon after the ()... A colon (Smiley means that the following line will be an indented line... You will only ever have a : at the end of certain lines: such as;

for X in X:
while X <condition> X:
if x <condition> x:
def x:

These are the most common... You can probably guess what each one does, so I not explain. Right, now lets go back to the brackets thing in myFunction... Now listen closely, this is one of the hardest things you'll EVER learn in python (truely, once you've got your head round this, you'll realise just how easy python is...)

now, I said all values are local right... Local  means that they are only recognised WITHIN THE FUNCTION YOU DECLARE THEM!!!... e.g.

Code
GeSHi (python):
def myFunction():
   msg = 'hello'
 
def mySecondFunction():
   es.msg(msg)
 

This code would bring up an error saying 'msg referenced before assignment'. This means that the variable hasn't been assigned yet, and this is true because when you declared msg, it 'scope' (how local/global the variable is) is only inside myFunction. This means I cannot call the variable made in myFunction to another function... That is, unless I tell it to. Now, there are 2 common ways of making a variable recognised in other functions, I will explain them now... Right, the first way, and the 'best' way, is to simply 'pass' the variable from one function to the next. This is useful, because the variable is still only recognised in 2 different functions, so it saves space Wink... Always try and keep the scope of the variables as low as possible. We pass the variable on from one function to the next, by using the brackets Smiley such as...

Code
GeSHi (python):
def myFunction():
   message = 'hello'
   mySecondFunction(message)
 
def mySecondFunction(msg):
   es.msg(msg)
 

Now.. You may think 'what the hell is he doing'... Right, well to do a method, you just simply type the method out. This is very similar to es_doblock scriptname/block... imagine that... Now to call the method, you just have to use the method name. Simple, yes... Now as you can see, this time, I've typed something inside the brackets. Inside the brackets, is my variable; message... On the sending function... (e.g. the one Passing the variable)... The variable HAS to be the same name as you originally declared it.. e.g. I declared 'hello' to the variable message, thus I must pass the variable name as message. However, on the receiving end, I can call the variable whatever I want... In this case, I've renamed message msg... This is (in my opinion) the hardest way to make a variable global, however, it's the best. When's the best time to use this sort of global variable? When you are simply going from one function to the next. However, if one function does not 'call' (call just means 'doblock'), then there is no way to pass the function, so we must use other means.

The second way, (and in my opinion the easier, but slower way..) is to call the command global at the top of the function before you set any variables... lets have a look at that method again, this time though, myMethod will not call mySecondMethod:

Code
GeSHi (python):
def myMethod():
   global message
   message = 'hello'
 
def mySecondMethod():
   es.msg(message)
 

Now as you can see, in this case, I cannot re-name the variable. This is because that variable has been made global to the script, so the value inside the variable will only be able to be recognised by the same variable name... e.g. if I define message to be hello, msg will contain nothing... The second thing many people get confused about, is when NOT to use a global... the global command will simply make a variable global, when a value inside the variable is changed/set... This means I can read the value, do whatever I want with the value, unless I don't change it, then I don't need a global.. e.g.

Code
GeSHi (python):
def myMethod():
   global message
   message = 'hello'
 
def mySecondMethod():
   if message == 'hello':
       es.msg(message)
 

As you can see, I haven't changed the value in any way shape or form in mySecondMethod, so I don't need a global... The general rule for if it needs a global or not is if it has a single "=" sign (note in python 2 "==" means 'equalto', whereas one "=" means equals... DONT get these 2 mixed up).

Now, so that's one of the hardest things you'll learn in python... not that hard is it ^_^...

The last thing I want to talk to you about is ways of grouping information together... Keygroups are slow ways of storing informations... The new ways are: lists, sets and dicts. (there are also keyvalues which act in the exact same way as keygroups, but they're a lot more complex... We'll leave those out for now, you don't need them.) Dicts, (short for dictionarys) are sooooooooo useful once you know how to use them correctly. It's how the information of the users will be stored on the server, it's just as fast as SQLite, (if not faster,) and they're easier to edit/change/save/do what you want to. Imagine dicts as keygroups... We'll say that a dict is the keygroup itself, and then a dict has a 'key'. However, this is where it get's cooler.. whereas a normal keygroup can only have a keygroup -> key -> keyvalue... dicts can have keygroup -> key -> key -> key -> key -> key -> keyvalue Smiley... It can contain as MANY keys as you want Smiley (This is useful to say store all of the WCS settings in, all your XP in, and each race etc...) with dicts, virtually all information can be kept inside the same dict... now, how do you create a dict? simple

Code
GeSHi (python):
my_dict = {}
 

That is it, you've just created your dict.. now who said python was tough Tongue... Okay, let's add things to the dict...

Code
GeSHi (python):
my_dict['my_key'] = 5
 

You've actualy just assigned a keyvalue to a key Smiley yet another thing we can do, we can have dicts as short or long as possible... Here, we've assigned the value of '5' to the root 'my_key'. To access the value again you just do

Code
GeSHi (python):
my_value = my_dict['my_key']
 

Yes, it really is that simple.. To add 2 keys to my_dict, you can just do this..

Code
GeSHi (python):
my_dict['my_key']['my_secondkey'] = 4
 

But note... You can only ADD another key on when you've added the PREVIOUS key on.. e.g.

Code
GeSHi (python):
my_dict = {}
my_dict['my_key']['my_secondkey'] = 4
# This is incorrect
 
my_dict = {}
my_dict['my_key'] = {}
my_dict['my_key']['my_secondkey'] = 4
# correct
 

As you can see, you have to build them up one at a time.. there is an advanced way to do it so you can do it in one line, but lets not confuse you yet Smiley... That's it for dicts really... As you can see, they are extremely handy for storing data...

The next way, is a list. Lists and sets really are both 'lists' and they virtually do the same thing. For this reason, we'll just teach you lists as they're easier to understand, and more useful to you. Okay, now like a dict, you have to first create your list.. to do this just type:

Code
GeSHi (python):
list = []
 

This will create a list Smiley... Yes it is that simple... Now, a list is only good for... well, holding a list of items.. for example, many people use lists to define the pistols list..

Code
GeSHi (python):
list = ["deagle","usp","glock","fiveseven","elite","p228"]
 

These are useful for 'for' and 'in' commands... This is a lot faster than saying

Code
GeSHi (python):
list = "deagleuspglockfivesevenelitep228"
 

as for example if we wanted to test if usp was in list in the second case.. it'd be...

usp == dea.. False
usp == eag.. False
usp == agl.. False
usp == gle.. False
usp == leu.. False
usp == lus... False
usp == usp.. True

Imagine if we was trying to test if if something was in p228, it'd take ages.. however, with a list the usp case would be

usp == deagle false
usp == usp true...

It tests each seperate item individually.. likewise for the for command..

Code
GeSHi (python):
for gun in pistols:
   es.msg("found %s"%gun)
 

I'll tell you what the %s does now... the %s is a substitute for any string... if you've used es_format or es_formatv before it is virtually the same, only instead of numbers, it's 's'.. Now at the end of the string (e.g. the end of the quotation mark" you have to define that the 'string replacement' starts there... so to define that, you put a %... Now anything that follows the % will be the variable to be replaced into the string... If you have more than one variable, they need to be inside brackets..
Code
GeSHi (python):
for gun in pistols:
   gun2 = 'weapon_%s'%gun
   es.msg("found %s : %s"%(gun,gun2))
   # displays found deagle: weapon_deagle
 

Now, lets begin to learn the syntax of creating your own race...

Code
GeSHi (python):
###################
# Import module
import es
import random
import gamethread
 
import wcs
from wcs import wcs
 
###################
#    PUBLISH INFO
info = es.AddonInfo()
info.name = 'My First Race'
info.author = 'Freddukes'
 
###################
#     RACE INFO
#
RaceName = 'first race'
# This is the name of the mod... We assign it to a global variable for easy reference
# It must be exactly the same name as the file name, including capital letters
race = wcs.Race(RaceName)
race.registerWeaponRestriction('allow only',(['knife','glock','usp']))
 
###################
#    SKILL INFO
# Syntax: registerSkill("skill name", <amount of levels>, <level interval>, "description")
 
race.registerSkill('My first skill',1,1,"A test to see if my skill works")
race.registerSkill("I am god",4,3,"Random chance to put you in god mode")
 
##################
#     Ultimate Info
# Syntax: registerUltimate("ultimate name", <required race level>, <max level>, <Level Interval>, "Description")
 
race.registerUltimate("I am ledgend",8,4,2,"Makes you turn red and everyones screen in a distance goes blury"
 
 
 
def player_spawn(event_var):
   userid = int(event_var['userid'])
   # This returns the integer of the userid... All events return as string, we want the userid as a number (integer)
 
   first_level = wcs.GetLevel(userid, RaceName, 'My first skill')
   # Returns the value of the level 'firstrace' and stores it in first_level
 
   if first_level:
# If first level is True, I.E a positive number
       es.tell(userid,'#green','Look, Your skill worked!'
 
   god_level = wcs.GetLevel(userid, RaceName, 'I am God')
   if god_level:
       wcs_rand = random.randint(1,5)
# gets a random number between 1 and 5
 
       if wcs_rand <= god_level:
           player = wcs.Command(userid)
# Register the player for a custom command skill
 
           player.God(30)
# Turn the player into god mode for 30 seconds
 
 
 
def player_ultimate(event_var):
   # Triggered whenever a user has used his ultimate and the ultimate counter is set to 0
 
   player = wcs.Command(userid)
# Register the player for a custom command skill
 
   player.SetCoolDown('I am ledgend',30)
# Registers the cooldown effect for 30 seconds for the I am ledgend ultimate.
 
   ledgend_level = wcs.GetLevel(userid, RaceName,"I am ledgend")
 
   player.Near(ledgend_level * 50, shake)
# The distance effected is the level multiplied by 50... Everyone inside this distance will now be passed through to the 'shake' function
 
 
 
def shake(userid, attacker):
# Attacker is the person to run the ultimate, userid is the victim who was close to him
 
   player = wcs.Command(userid)
# Register the player for custom comand skill
 
   player.Shake(5,10)
# Shake the victims screen for 5 seconds with a 'violence' of 10
 
   att = wcs.Command(attacker)
# register the attacker for custom command skill
 
   att.Color('red')
# Turn the attacker red
 
   gamethread.delayed(5,att.Color)
   # Reset the color of the user after 5 seconds
 

Hopefully you can understand how much freedom you've now got. This is just a small example, some libs (even though not useful) will let you send e-mails to people etc. Some Librarys will also let you browse the internet and open sites, download things. With python, the worlds the limit Wink

-freddukes
« Last Edit: March 03, 2008, 01:34:52 AM by freddukes » Logged

 
Kevin002
Level 3 Trained Apprentice
***
Offline Offline

Canada Canada

Posts: 61




Kevin002
« Reply #31 on: February 19, 2008, 05:01:33 AM »

yay wrapping it will makes thing SOOOO much easier to get cool effects. Thanks again. Smiley
Logged
freddukes
WCS ESP Dev Team
Level 7 Expert

Offline Offline

United Kingdom

Posts: 287



« Reply #32 on: February 19, 2008, 08:36:46 AM »

hey just a question, if i post a race here will you convert to python for me? kinda like a before and after kind of thing.. i think it will make things worlds easier.. if you see what i'm saying. so ya once i get my new race out of testing i will post it here and i would like to see it converted or i can just post one i already made but ya would you do it for me?

Well, if you post it, I'm sure someone in this community will help you Smiley I've seen lots of people coding python races already. If we get a spare moment, I may see what I can do, however, we're really busy coding etc.

-freddukes
Logged

Zero Skillz
Level 7 Expert
*****
Offline Offline

United States United States

Posts: 525




Zero Skillz (<-[SD]->madcow)
madcow767
« Reply #33 on: February 19, 2008, 01:09:51 PM »

Code:
[code=python]"0"
{
    "name"              "Soul Reaper"
    "author"            "Zero Skillz"
    "shortdescription"  "Come and will take your soul"
    "required_level"    "0"
    "maximum_level"     "0"
    "allow_only"        "<admins>"
    "teamlimit"         "0"
    "preloadcmd"        "0"
    "player_spawn_cmd"  "es es_xdelayed 1.0 est_RestrictAll event_var(userid);es es_xdelayed 1.4 est_unrestrict event_var(userid) weapon_knife;es es_xdelayed 1.5 est_unrestrict event_var(userid) weapon_c4;es es_xdelayed 1.5 est_unrestrict event_var(userid) weapon_deagle;es es_xdelayed 1.9 es_give event_var(userid) weapon_knife;es es_xdelayed 1.9 es_give event_var(userid) weapon_deagle;es_keysetvalue WCSuserdata event_var(userid) hitdmg 0"
    "round_start_cmd"   "0"
    "round_end_cmd"     "0"
    "numberofskills"    "4"
    "numberoflevels"    "5"
    "skillnames"        "Blood lust|Ultimate Vengence|You get very very very mad|Use the dark arts"
    "skilldescr"        "Exilerated by death but you use up alot of energy|Grab ahold of your enemy and pull him down with you|As you get hit you deal more damage|swap you hp with the enemy"
    "skillcfg"          "player_attacker|player_death|player_victim|player_ultimate"
   
    "skill1_setting"    "es_xset wcs_time 6|es_xset wcs_time 7|es_xset wcs_time 8|es_xset wcs_time 9|es_xset wcs_time 10"
    "skill1_cmd"        "es est_speed event_var(attacker) 2.0;es es_delayed server_var(wcs_time) es est_speed event_var(attacker) 0.5;es es_delayed 12 es est_speed event_var(attacker) 1"
    "skill1_sfx"        "0"

    "skill2_setting"    "es_xsetinfo wcs_chance 10|es_xsetinfo wcs_chance 15|es_xsetinfo wcs_chance 20|es_xsetinfo wcs_chance 25|es_xsetinfo wcs_chance 28"
    "skill2_cmd"        "es es_xif (server_var(wcs_dice) <= server_var(wcs_chance)) then racealias_zuv1"
    "racealias_zuv1"    "es es_xgetplayername wcs_name event_var(attacker);es_xgetplayername wcs_name event_var(userid);es es_xtell event_var(attacker) #multi #lightgreen server_var(wcs_name) will take his ultimate vengence;es es_xtell event_var(userid) #multi #lightgreenYou want vengence and you #lightgreenYou will have! #greenVengeance;racealias_zuv2"
    "racealias_zuv2"    "es wcs_dealdamage event_var(userid) event_var(attacker) 1000 1000"
    "skill2_sfx"        "es es_xif (server_var(wcs_dice) <= server_var(wcs_chance)) then es_xgetplayerlocation wcs_x1 wcs_y1 wcs_z1 event_var(attacker);es es_xif (server_var(wcs_dice) <= server_var(wcs_chance)) then es_xgetplayerlocation wcs_x2 wcs_y2 wcs_z2 event_var(userid);es_xmath wcs_z1 + 20;es_xmath wcs_z2 + 20;es es_xif (server_var(wcs_dice) <= server_var(wcs_chance)) then est_Effect 3 #a 0 sprites/tp_beam001.vmt server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) server_var(wcs_x2) server_var(wcs_y2) server_var(wcs_z2) 1 20 30 0 250 150 255"
   
    "skill3_setting" "es_xsetinfo wcs_dmg 10|es_xsetinfo wcs_dmg 20|es_xsetinfo wcs_dmg 30|es_xsetinfo wcs_dmg 40|es_xsetinfo wcs_dmg 50"
    "skill3_cmd"     "es_keygetvalue wcs_tmp WCSuserdata event_var(userid) hitdmg;if (server_var(wcs_tmp) != 0) then es_xset wcs_dmg server_var(wcs_tmp);es_xmath wcs_dmg + 10;es_keysetvalue WCSuserdata event_var(userid) hitdmg server_var(wcs_dmg);es est_modplayerweapon event_var(userid) deagle server_var(wcs_dmg);es es_xtell event_var(userid) #multi #Lightgreen : You are ANGRY!"
    "skill3_sfx"     "0"
 

    "skill4_setting"   "es_xset wcs_hp 10|es_xset wcs_hp 20|es_xset wcs_hp 30|es_xset wcs_hp 40|es_xset wcs_hp 50"
    "racealias_zu1" "es est_Fade server_var(wcs_userid) 0 1 1 10 150 5 80;es est_getviewplayer server_var(wcs_userid) wcs_targetid;es_exists wcs_exists2 userid server_var(wcs_targetid);es est_isalive wcs_alive2 server_var(wcs_targetid);es_getplayerteam wcs_team1 server_var(wcs_userid);es_getplayerteam wcs_team2 server_var(wcs_targetid);racealias_zu2"
    "racealias_zu2" "if (server_var(wcs_exists2) = 1) then if (server_var(wcs_alive2) = 1) then if (server_var(wcs_team1) != server_var(wcs_team2)) then racealias_zu3"
    "racealias_zu3" "es_xset wcs_wall 1;es_getplayerlocation wcs_x1 wcs_y1 wcs_z1 server_var(wcs_userid);es_getplayerlocation wcs_x2 wcs_y2 wcs_z2 server_var(wcs_targetid);es_xmath wcs_z1 + 50;es_xmath wcs_z2 + 50;es est_getwallbetween wcs_wall server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) server_var(wcs_x2) server_var(wcs_y2) server_var(wcs_z2);if (server_var(wcs_wall) = 0) then racealias_zu4"
    "racealias_zu4" "es_xset wcs_immunity 0;es_keygetvalue wcs_immunity WCSuserdata server_var(wcs_targetid) ulti_immunity;if (server_var(wcs_immunity) = 0) then racealias_zu6;if (server_var(wcs_immunity) != 0) then es_xtell server_var(wcs_userid) #multi server_var(wcs_lng_ulti_immunity_a);if (server_var(wcs_immunity) != 0) then es_xtell server_var(wcs_targetid) #multi server_var(wcs_lng_ulti_immunity_v)"
    "racealias_zu6" "es est_gethealth wcs_tmp server_var(wcs_userid);es est_gethealth wcs_tmp2 server_var(wcs_targetid);es est_sethealth server_var(wcs_userid) server_var(wcs_tmp2);es est_sethealth server_var(wcs_targetid) server_var(wcs_tmp); es est_GetHealth wcs_tmp1 server_var(wcs_userid);if (server_var(wcs_tmp1) < 50) then est_HealthAdd server_var(wcs_userid) server_var(wcs_hp);es_xmath wcs_counter + 1;es est_speed server_var(wcs_targetid) 0.6;es_delayed 2 wcs_removefx speed server_var(wcs_targetid);racealias_zu7"
    "racealias_zu7" "es_setinfo wcs_nametarget 0;es est_getname wcs_nametarget server_var(wcs_targetid);es_setinfo wcs_nameuserid 0;es est_getname wcs_nameuserid server_var(wcs_userid);es_tell server_var(wcs_userid) #multi #Lightgreen : your enemy, server_var(wcs_nametarget) 's health is now yours !! ;es_tell server_var(wcs_targetid) #multi #Lightgreen : your health has been swaped with #Green server_var(wcs_nameuserid) !! ;es_xset wcs_ultinotexec 0"
    "racealias_zu8" "if (server_var(wcs_ultinotexec) != 0) then es_xtell server_var(wcs_userid) #Lightgreen Ultimate failed theres no one where your pointing."
    "skill4_cmd"     "es_xset wcs_exists2 0;es_xset wcs_hptarget 0;es_xset wcs_ultinotexec 1;es_xset wcs_targetid 0;es_xset wcs_alive1 0;es_xset wcs_team1 0;es_xset wcs_team2 0;es_xset wcs_alive2 0;es est_isalive wcs_alive1 server_var(wcs_userid);if (server_var(wcs_alive1) = 1) then racealias_zu1;racealias_zu8"
    "skill4_sfx"        "0"
    "ultimate_cooldown" "10"
    }
enjoy i'll get something alooootttt more challenging for you guys in a few days but for now lets see you do this XD[/code]
Logged

WCA | Rasmus [DK]
<wcs race coder>
WCS Supporter
Level 7 Expert
*****
Offline Offline

Denmark Denmark

Posts: 1330




Rasmus4J
rasmus4j

myServer 85.190.17.115:27015
(Warning: click connects through Steam)
« Reply #34 on: February 19, 2008, 07:23:16 PM »

how do you do effects in python?
Logged

where would you put the comma in the following telegram from a wife, to her husband in the navy?
"Not getting any better hurry home!"
http://cache.www.gametracker.com/server_info/85.190.17.115:27015/b_560x95.png[/img][/url]
Jeff
WCS ESP Dev Team
Level 7 Expert

Offline Offline

United States United States

Posts: 458



WWW
beastrace91
« Reply #35 on: February 19, 2008, 07:43:49 PM »

Code:
[code=python]"0"
{
    "name"              "Soul Reaper"
    "author"            "Zero Skillz"
    "shortdescription"  "Come and will take your soul"
    "required_level"    "0"
    "maximum_level"     "0"
    "allow_only"        "<admins>"
    "teamlimit"         "0"
    "preloadcmd"        "0"
    "player_spawn_cmd"  "es es_xdelayed 1.0 est_RestrictAll event_var(userid);es es_xdelayed 1.4 est_unrestrict event_var(userid) weapon_knife;es es_xdelayed 1.5 est_unrestrict event_var(userid) weapon_c4;es es_xdelayed 1.5 est_unrestrict event_var(userid) weapon_deagle;es es_xdelayed 1.9 es_give event_var(userid) weapon_knife;es es_xdelayed 1.9 es_give event_var(userid) weapon_deagle;es_keysetvalue WCSuserdata event_var(userid) hitdmg 0"
    "round_start_cmd"   "0"
    "round_end_cmd"     "0"
    "numberofskills"    "4"
    "numberoflevels"    "5"
    "skillnames"        "Blood lust|Ultimate Vengence|You get very very very mad|Use the dark arts"
    "skilldescr"        "Exilerated by death but you use up alot of energy|Grab ahold of your enemy and pull him down with you|As you get hit you deal more damage|swap you hp with the enemy"
    "skillcfg"          "player_attacker|player_death|player_victim|player_ultimate"
   
    "skill1_setting"    "es_xset wcs_time 6|es_xset wcs_time 7|es_xset wcs_time 8|es_xset wcs_time 9|es_xset wcs_time 10"
    "skill1_cmd"        "es est_speed event_var(attacker) 2.0;es es_delayed server_var(wcs_time) es est_speed event_var(attacker) 0.5;es es_delayed 12 es est_speed event_var(attacker) 1"
    "skill1_sfx"        "0"

    "skill2_setting"    "es_xsetinfo wcs_chance 10|es_xsetinfo wcs_chance 15|es_xsetinfo wcs_chance 20|es_xsetinfo wcs_chance 25|es_xsetinfo wcs_chance 28"
    "skill2_cmd"        "es es_xif (server_var(wcs_dice) <= server_var(wcs_chance)) then racealias_zuv1"
    "racealias_zuv1"    "es es_xgetplayername wcs_name event_var(attacker);es_xgetplayername wcs_name event_var(userid);es es_xtell event_var(attacker) #multi #lightgreen server_var(wcs_name) will take his ultimate vengence;es es_xtell event_var(userid) #multi #lightgreenYou want vengence and you #lightgreenYou will have! #greenVengeance;racealias_zuv2"
    "racealias_zuv2"    "es wcs_dealdamage event_var(userid) event_var(attacker) 1000 1000"
    "skill2_sfx"        "es es_xif (server_var(wcs_dice) <= server_var(wcs_chance)) then es_xgetplayerlocation wcs_x1 wcs_y1 wcs_z1 event_var(attacker);es es_xif (server_var(wcs_dice) <= server_var(wcs_chance)) then es_xgetplayerlocation wcs_x2 wcs_y2 wcs_z2 event_var(userid);es_xmath wcs_z1 + 20;es_xmath wcs_z2 + 20;es es_xif (server_var(wcs_dice) <= server_var(wcs_chance)) then est_Effect 3 #a 0 sprites/tp_beam001.vmt server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) server_var(wcs_x2) server_var(wcs_y2) server_var(wcs_z2) 1 20 30 0 250 150 255"
   
    "skill3_setting" "es_xsetinfo wcs_dmg 10|es_xsetinfo wcs_dmg 20|es_xsetinfo wcs_dmg 30|es_xsetinfo wcs_dmg 40|es_xsetinfo wcs_dmg 50"
    "skill3_cmd"     "es_keygetvalue wcs_tmp WCSuserdata event_var(userid) hitdmg;if (server_var(wcs_tmp) != 0) then es_xset wcs_dmg server_var(wcs_tmp);es_xmath wcs_dmg + 10;es_keysetvalue WCSuserdata event_var(userid) hitdmg server_var(wcs_dmg);es est_modplayerweapon event_var(userid) deagle server_var(wcs_dmg);es es_xtell event_var(userid) #multi #Lightgreen : You are ANGRY!"
    "skill3_sfx"     "0"
 

    "skill4_setting"   "es_xset wcs_hp 10|es_xset wcs_hp 20|es_xset wcs_hp 30|es_xset wcs_hp 40|es_xset wcs_hp 50"
    "racealias_zu1" "es est_Fade server_var(wcs_userid) 0 1 1 10 150 5 80;es est_getviewplayer server_var(wcs_userid) wcs_targetid;es_exists wcs_exists2 userid server_var(wcs_targetid);es est_isalive wcs_alive2 server_var(wcs_targetid);es_getplayerteam wcs_team1 server_var(wcs_userid);es_getplayerteam wcs_team2 server_var(wcs_targetid);racealias_zu2"
    "racealias_zu2" "if (server_var(wcs_exists2) = 1) then if (server_var(wcs_alive2) = 1) then if (server_var(wcs_team1) != server_var(wcs_team2)) then racealias_zu3"
    "racealias_zu3" "es_xset wcs_wall 1;es_getplayerlocation wcs_x1 wcs_y1 wcs_z1 server_var(wcs_userid);es_getplayerlocation wcs_x2 wcs_y2 wcs_z2 server_var(wcs_targetid);es_xmath wcs_z1 + 50;es_xmath wcs_z2 + 50;es est_getwallbetween wcs_wall server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) server_var(wcs_x2) server_var(wcs_y2) server_var(wcs_z2);if (server_var(wcs_wall) = 0) then racealias_zu4"
    "racealias_zu4" "es_xset wcs_immunity 0;es_keygetvalue wcs_immunity WCSuserdata server_var(wcs_targetid) ulti_immunity;if (server_var(wcs_immunity) = 0) then racealias_zu6;if (server_var(wcs_immunity) != 0) then es_xtell server_var(wcs_userid) #multi server_var(wcs_lng_ulti_immunity_a);if (server_var(wcs_immunity) != 0) then es_xtell server_var(wcs_targetid) #multi server_var(wcs_lng_ulti_immunity_v)"
    "racealias_zu6" "es est_gethealth wcs_tmp server_var(wcs_userid);es est_gethealth wcs_tmp2 server_var(wcs_targetid);es est_sethealth server_var(wcs_userid) server_var(wcs_tmp2);es est_sethealth server_var(wcs_targetid) server_var(wcs_tmp); es est_GetHealth wcs_tmp1 server_var(wcs_userid);if (server_var(wcs_tmp1) < 50) then est_HealthAdd server_var(wcs_userid) server_var(wcs_hp);es_xmath wcs_counter + 1;es est_speed server_var(wcs_targetid) 0.6;es_delayed 2 wcs_removefx speed server_var(wcs_targetid);racealias_zu7"
    "racealias_zu7" "es_setinfo wcs_nametarget 0;es est_getname wcs_nametarget server_var(wcs_targetid);es_setinfo wcs_nameuserid 0;es est_getname wcs_nameuserid server_var(wcs_userid);es_tell server_var(wcs_userid) #multi #Lightgreen : your enemy, server_var(wcs_nametarget) 's health is now yours !! ;es_tell server_var(wcs_targetid) #multi #Lightgreen : your health has been swaped with #Green server_var(wcs_nameuserid) !! ;es_xset wcs_ultinotexec 0"
    "racealias_zu8" "if (server_var(wcs_ultinotexec) != 0) then es_xtell server_var(wcs_userid) #Lightgreen Ultimate failed theres no one where your pointing."
    "skill4_cmd"     "es_xset wcs_exists2 0;es_xset wcs_hptarget 0;es_xset wcs_ultinotexec 1;es_xset wcs_targetid 0;es_xset wcs_alive1 0;es_xset wcs_team1 0;es_xset wcs_team2 0;es_xset wcs_alive2 0;es est_isalive wcs_alive1 server_var(wcs_userid);if (server_var(wcs_alive1) = 1) then racealias_zu1;racealias_zu8"
    "skill4_sfx"        "0"
    "ultimate_cooldown" "10"
    }
enjoy i'll get something alooootttt more challenging for you guys in a few days but for now lets see you do this XD[/code]

I plan on making races actually based on WC3FT units for now...(As these will the kind released with the final copy)

Effects you can do with es.effect, effectlib(this is the method I use), or until our custom effects wrapper is finished you can use es.server.queuecmd to fire est_effect_XX

~J3ff
Logged

WCA | Rasmus [DK]
<wcs race coder>
WCS Supporter
Level 7 Expert
*****
Offline Offline

Denmark Denmark

Posts: 1330




Rasmus4J
rasmus4j

myServer 85.190.17.115:27015
(Warning: click connects through Steam)
« Reply #36 on: February 19, 2008, 09:46:53 PM »

ok...
Logged

where would you put the comma in the following telegram from a wife, to her husband in the navy?
"Not getting any better hurry home!"
http://cache.www.gametracker.com/server_info/85.190.17.115:27015/b_560x95.png[/img][/url]
Zero Skillz
Level 7 Expert
*****
Offline Offline

United States United States

Posts: 525




Zero Skillz (<-[SD]->madcow)
madcow767
« Reply #37 on: February 20, 2008, 12:28:53 AM »

i think u just cant do it XD lol
Logged

Jeff
WCS ESP Dev Team
Level 7 Expert

Offline Offline

United States United States

Posts: 458



WWW
beastrace91
« Reply #38 on: February 20, 2008, 12:54:58 AM »

i think u just cant do it XD lol

That that is it entirely... that is more basic than my Night Elf,(and about 1000 times less so than my Naga)

~J3ff
Logged

Zero Skillz
Level 7 Expert
*****
Offline Offline

United States United States

Posts: 525




Zero Skillz (<-[SD]->madcow)
madcow767
« Reply #39 on: February 20, 2008, 02:02:01 AM »

do the ultimate then.
Logged

Jeff
WCS ESP Dev Team
Level 7 Expert

Offline Offline

United States United States

Posts: 458



WWW
beastrace91
« Reply #40 on: February 20, 2008, 02:47:41 AM »

do the ultimate then.

Maybe if you explain what that jumbled pile of aliases does... I mean really have you looked at my project lists? If you think that race is beyond me you be little my code.

~j3ff
Logged

Kevin002
Level 3 Trained Apprentice
***
Offline Offline

Canada Canada

Posts: 61




Kevin002
« Reply #41 on: February 20, 2008, 12:23:39 PM »

the ultimate is just swicthing hp with and enemy it really isnt that hard

the one nick that could cause more trouble would be the the switch is done at the enemy your looking at

BUT!!!! all we need to use is getViewplayer and there ya go EASY!!!!

if I didnt have to get up in a few hours to go to school I would gladly code it right now Smiley

hell we could even make it cooler by making if you hold down the ultimate it would leach the Health from the guy and give it to you
« Last Edit: February 20, 2008, 12:27:11 PM by Kevin002 » Logged
The_Last_Ghost
Level 3 Trained Apprentice
***
Offline Offline

Denmark Denmark

Posts: 76




The_Last_Ghost
thelastkaas
« Reply #42 on: February 20, 2008, 02:51:30 PM »

do the ultimate then.

Maybe if you explain what that jumbled pile of aliases does... I mean really have you looked at my project lists? If you think that race is beyond me you be little my code.

~j3ff

True, true... Obviously you haven't seen j3ffs scripts Tongue

My personal favourite is the DnD script... it's 18189 lines (the ESS version)... You really think he can't code a mere race? After all, he's the one who coded how YOU would code the races  :roll:
Logged

- I will tell you what u want to hear, but not mean anything!
Zero Skillz
Level 7 Expert
*****
Offline Offline

United States United States

Posts: 525




Zero Skillz (<-[SD]->madcow)
madcow767
« Reply #43 on: February 20, 2008, 02:51:52 PM »

kevin sounds great but unless you have a slightly less picky way of targeting, mine has to be very umm precise where your aiming so it would be hard to constantly aim at someone if their moving... but i like the idea, but what if you made it so you could hold your ultimate, and then charges up a radius and then when you let go you steal life in that radius and the amount depends how close they are? that would be pretty cool Cheesy
Logged

Zero Skillz
Level 7 Expert
*****
Offline Offline

United States United States

Posts: 525




Zero Skillz (<-[SD]->madcow)
madcow767
« Reply #44 on: February 20, 2008, 02:55:48 PM »

ok last ghost, you can be the best coder ever, but doesnt mean that you can do anything, and expecially if he cant read what other poeple have already done... now to be honest i was just basically saying that becuase i wanted him to do it XD Cheesy but like i said i will make them something alot more interesting for them to make as soon as i can test it and get it out on the web site. I have to say though i'm likeing hte idea that its going to be very hard to C/P..
Logged

Jeff
WCS ESP Dev Team
Level 7 Expert

Offline Offline

United States United States

Posts: 458



WWW
beastrace91
« Reply #45 on: February 20, 2008, 03:22:36 PM »

Code
GeSHi (python):
import es, wcs, playerlib
from wcs import wcs
def player_ultimate_on(event_var):
userid = int(event_var['userid'])
point = wcs.Command(userid).GetViewPlayer()
if point:
health = playerlib.getPlayer(userid).get('health')
healthp = playerlib.getPlayer(point).get('health')
playerlib.getPlayer(userid).set('health', healthp)
playerlib.getPlayer(point).set('health', health)

There is you stupid skill, easy like I said. And look it is easy to read unlike the old WCS code. Of course you would need to add in one check to see if they have the skill but that is easy enough.

By have you seen my other scripts I meant have you seen what they do... my scripts are almost all RPG Based. Meaning if I can code and chain lightning, a fire ball, and a resurrection menu. I think I can handle swaping two player's health total when one looks at the other...

And then 18k line of D&D is getting rewritten in python over this summer Smiley

~J3ff
Logged

Pages: 1 2 [3] 4   Go Up
  Print  
 
Jump to:  

Last 7 Shouts:
Crowoner
February 25, 2009, 07:05:17 PM
lol i can't execute the program it gives me error CreateProcess Failed; Code 14001
February 25, 2009, 04:23:37 PM
or else test it on a ded and then do the same
February 25, 2009, 04:23:24 PM
download it and you can >.>
February 25, 2009, 04:21:37 PM
the server is rented i can't use hlsw
February 25, 2009, 04:09:53 PM
can you get the logs (with HLSW) when you say shopmenu2?
with eventscripts_debug 1 please :p
February 25, 2009, 04:04:15 PM
Yes it's all ok ... made es_load gold in autoexec all files are right as the tutorial of gold 0.4 says
no missing file I suppose as it's original
February 25, 2009, 04:01:04 PM
is it loaded well?
have you the "official" version?
no missing file? nothing else wrong?
Recent
[Today at 01:26:31 AM]

[Today at 01:24:52 AM]

[Today at 12:38:51 AM]

[Today at 12:34:28 AM]

[Today at 12:12:17 AM]

[February 25, 2009, 11:45:05 PM]

[February 25, 2009, 10:06:36 PM]

[February 25, 2009, 07:55:08 PM]

[February 25, 2009, 07:53:02 PM]

[February 25, 2009, 07:43:19 PM]
Theme switch

Powered by MySQL Powered by PHP Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC
TinyPortal v0.9.8 © Bloc
Valid XHTML 1.0! Valid CSS!
Page created in 0.202 seconds with 27 queries.