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-25 (original capture). Home · Forum · All archived topics · Downloads
Warcraft-Source.com - WCS mod for CSS
February 26, 2009, 12:50:01 AM *
Welcome, Guest. Please login or register.
Login with username, password and session length
News: Races and Items added into Download section from our great Race Coders!
Such as... HOLLIDAY|NovaKiller|Stinkyfax|Frodo|TeacherCreature|Phat_Wizard
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 1418 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 #1 on: February 17, 2008, 07:09:30 AM »

Very Nice. My guess is if all wcs commands are done nicely no one should have any trouble making Races.
« Last Edit: February 17, 2008, 07:12:43 AM by Kevin002 » Logged
Jeff
WCS ESP Dev Team
Level 7 Expert

Offline Offline

United States United States

Posts: 458



WWW
beastrace91
« Reply #2 on: February 17, 2008, 07:32:22 AM »

Yep Dukes has been working hard at them Smiley here is a list of one we have included so far but have yet to be fully tested(Also this list will expand more over the next few dayz):

Custom Commands:
----------------------------------
UpdateDict(key,value)
ReturnDict(key)
ModDict(key)
Regen(Amount,Delay)
Damage(Amount,[Damage Type],[Atacker])
Color([color],[r,g,b],[a])
Freeze(time)
God(time)
Blind(Time,[alpha])
Burn(time)
ChangeGravity(+- amount)
SetGravity(amount)
Speed(amount)
SpeedAdd(+- amount)
Health(amount)
HealthAdd(amount)
Drain(amount,delay,time)
Drop()
Drug([time])
Drunk([time])
GetViewAngles() # Returns a list of 3
GetViewCoord() # Returns a list of 3
GetViewPlayer()
GetViewProp()
NearCoord([identifier],x-range,y-range,z-range,method to run)
Near([identifier],distance,method to run)
Shake(time,violence)
Model(path)
Spawn()
Push(x,y,z)
PushTo(x,y,z,force)
AreaRegen([identifier],distance,amount,delay)
AreaDamage([identifier],distance,amount)
GiveXp(amount,[reason])
GiveLevel(amount,[reason])

~J3ff
Logged

Kevin002
Level 3 Trained Apprentice
***
Offline Offline

Canada Canada

Posts: 61




Kevin002
« Reply #3 on: February 17, 2008, 08:42:03 AM »

with this list I was able to revamp the Undead Scourge in Python

from what I know it Should Work...  then again I am no expert

Edited****
Code
GeSHi (python):
GeSHi (python):
###################
# Import module
import es # Imports the main es code
import random # Import the random module
import gamethread # Import the gamethread function
 
import wcs # imports the main base code of wcs
from wcs import wcs # This just imports EVERYTHING from the base, to your code
 
###################
#    PUBLISH INFO
info = es.AddonInfo()
info.name = 'Undead Scourge'
info.author = 'Kevin002'
 
###################
#     RACE INFO
#
 
race = wcs.Race("Undead") #  This must be named exactly the same name as the .py file you will save it as
race.registerMinLevel(0) # The minimum total level before you can access this race
 
###################
#    SKILL INFO
# Syntax: registerSkill("skill name",<amount of levels>,<skill points to buy>,"description")
 
race.registerSkill('VampiricAura',8,8,"Draw Health From the Damage you do to Others")
race.registerSkill("UnholyAura",8,8,"Speed Boost")
race.registerSkill("Levition",8,8,"Lower Gravity")
 
##################
#     Ultimate Info
# Syntax: registerUltimate(ultiName, ultiRequiredLevel, ultiMaxLevel, ultiLevelInterval, ultiDescription)
 
race.registerUltimate("SuicideBomber",8,8,1,"Chance to Blow up On Death"
 
 
def load():
   es.msg('Undead Scourge loaded: Made by %s'%info.author)
 
def unload():
   es.msg('Undead Scourge unloaded: Made by %s'%info.author)
 
def player_Spawn(event_var):
   UnholyAura_level = wcs.GetLevel(userid,'Undead Scourge','UnholyAura')
   if UnholyAura_level:
       plevel = UnholyAura_level / 10 + 1
       player = wcs.Command(userid)
       player.Speed(plevel)
   Levitation_level = wcs.GetLevel(userid,'Undead Scourge','Levitation')
   if Levitation_level:
       depth = 1 - Levitation_level / 20
       player = wcs.Command(userid)
       player.SetGravity(depth)
 
def player_hurt(event_var['attacker']):
   VampiricAura_level = wcs.GetLevel(userid,'Undead Scourge','VampiricAura')
   if VampiricAura_level:
       wcs_rand = random.randint(1,10)
       if VampiricAura_level <= wcs.rand:
           player = wcs.Command(userid)
           player.HealthAdd(VampiricAura_level * 2)
 
def player_death(event_var['userid']):
   player = wcs.Command(userid)
   SuicideBomber_level = wcs.GetLevel(userid,"Undead Scourge","Suicide Bomber")
   player.AreaDamage(SuicideBomber_level * 10,SuicideBomber_level * 5 )
 
 

Edited*****
« Last Edit: February 17, 2008, 10:41:49 AM by Kevin002 » Logged
Jeff
WCS ESP Dev Team
Level 7 Expert

Offline Offline

United States United States

Posts: 458



WWW
beastrace91
« Reply #4 on: February 17, 2008, 08:59:45 AM »

That is a really good first stab at a python race! Glad to see people should be able to convert things over with out much trouble just want to point out a few things.

First is that if your min level is 0 and the team you are restricting to is 'all' then you do not need to put it in Smiley


Second since Duke's first posted I finalized the ulti registering method and it now has this syntax: registerUltimate(ultiName, ultiRequiredLevel, ultiMaxLevel, ultiLevelInterval, ultiDescription)

The only value in there that is brand new to WCS is LevelInterval(Or interval in the case of standard skills), basicly this is the number of levels you have to wait inbetween dumping more ranks into the skills. So like your base skills have a 8 in the interval meaning you would have to be level 9 to get the 2nd rank into any of those base skills, and then level 17 for the 3rd!

Lastly there is not an event player_attacker, this is just the custom cfg style WCS/WC CSS has always used. What you would want to use is the player_hurt event, and then call up the event_var['attacker'].

Full list of events can be found here.

Remember each race is like it's own script so we are no longer limitted to keygroups Smiley

~J3ff
Logged

Kevin002
Level 3 Trained Apprentice
***
Offline Offline

Canada Canada

Posts: 61




Kevin002
« Reply #5 on: February 17, 2008, 10:10:48 AM »

oh I see now at first I thought it was to "allow" for teams and not "restrict".

very cool for the level interval and thanks for the help/tips

race now updated****
« Last Edit: February 17, 2008, 10:20:35 AM by Kevin002 » Logged
freddukes
WCS ESP Dev Team
Level 7 Expert

Offline Offline

United Kingdom

Posts: 287



« Reply #6 on: February 17, 2008, 12:12:36 PM »

Wow thank you for the interest... We're not releasing a definite ETA, because we don't want you all dissapointed if we don't make it. This is a large project, and as hopefully lots of servers will change over to this, we need it to be bug free and testing. Most likely you'll see a private beat (those who want to join will send either me and jeff a PM when we're ready for it...) Then after the private beta, we want to release a public beta the for the whole community. After we've had enough feedback, we'll open it up as a stable copy. We're not sure how long this will take us, but as you can see, one day and we got a lot of the base stuff done Wink

edit: The only thing That would be incorecct, is you need to define userid. You don't necessary NEED to assign it, but it makes things a lot easier... To do this just use

userid = event_var['userid']

You could use...

player = wcs.Command(even_var['userid'])

but this is harder to read, and harder to understand, thus we assign event_var['userid'] to a local variable by simply making one equal another... Smiley Very nice, just looked over the script, and saw that it's virtually perfect Wink Great job...

Note to people:
-----------------------
We've added a 'heal' command..  Heal command is just like  HealthAdd except for one difference... HealthAdd does some crazy stuff to base dictionarys you don't need to know about, so it changes the Maximum health of users... Same with health... If you want to simply add some health to the user, without changing the maximum health value of the player, use the heal command. Hope this clear things up..

Health + HealthAdd - You'd use for example on player spawn when you want to raise the maximum health of the race.
Heal - You'd use for the skills that restore your health when you attack other people.

-freddukes
« Last Edit: February 17, 2008, 12:26:10 PM by freddukes » Logged

Frodo
WCS ESP Dev Team
Level 7 Expert

Offline Offline

Posts: 854


Actinosphaerium eichhorni


WWW
ckenduro
aulix
« Reply #7 on: February 17, 2008, 05:57:45 PM »

Undead Scourge. Max 10 levels, 3 skill interval, 3 levels per skill, 1 level for ultimate, activatable on death or command.


 Undead Scourge.py (2.36 KB - downloaded 10 times.)
Logged


Actually I found it as best Bux ever. Everything's automated!
freddukes
WCS ESP Dev Team
Level 7 Expert

Offline Offline

United Kingdom

Posts: 287



« Reply #8 on: February 17, 2008, 06:04:54 PM »

Oh and Kevin... I fixed you Undead Scourge race... I've tested it.. you had a few errors, look over it and tell me ^_^... Note to all, you CAN have spcaes in you race name and race skills... It makes it look cleaner, so pleas put spaces. Just make sure the name of the file is EXACTLY the same as the race name... e.g. in the case the race name is "Undead Scourge.py"...

Code
GeSHi (python):
###################
# Import module
import es # Imports the main es code
import random # Import the random module
import gamethread # Import the gamethread function
 
import wcs # imports the main base code of wcs
from wcs import wcs # This just imports EVERYTHING from the base, to your code
 
###################
#    PUBLISH INFO
info = es.AddonInfo()
info.name = 'Undead Scourge'
info.author = 'Kevin002'
 
###################
#     RACE INFO
#
 
race = wcs.Race("Undead Scourge") #  This must be named exactly the same name as the .py file you will save it as
 
###################
#    SKILL INFO
# Syntax: registerSkill("skill name", 'long name', <amount of levels>,<skill points to buy>,"description")
 
race.registerSkill('Vampiric Aura',8,1,"Draw Health From the Damage you do to Others")
race.registerSkill("Unholy Aura",8,1,"Speed Boost")
race.registerSkill("Levitation",8,1,"Lower Gravity")
 
##################
#     Ultimate Info
# Syntax: registerUltimate(ultiName, ultiLongName, ultiRequiredLevel, ultiMaxLevel, ultiLevelInterval, ultiDescription)
 
race.registerUltimate("Suicide Bomber",8,8,4,"Chance to Blow up On Death")
 
 
def load():
   es.msg('Undead Scourge loaded: Made by %s'%info.author)
 
def unload():
   es.msg('Undead Scourge unloaded: Made by %s'%info.author)
 
def player_spawn(event_var):
   es.dbgmsg(0,'Attempting to set levitation an unholy aura')
   userid = event_var['userid']
   UnholyAura_level = wcs.GetLevel(userid,'Undead Scourge','Unholy Aura')
   es.dbgmsg(0,'UnholyAura_level equals %s'%UnholyAura_level)
   if UnholyAura_level:
       plevel = UnholyAura_level / 10.0 + 1
       es.dbgmsg(0,'plevel equals %s'%plevel)
       player = wcs.Command(userid)
       player.Speed(plevel)
       es.dbgmsg(0,'Set the players speed to %s'%plevel)
   Levitation_level = wcs.GetLevel(userid,'Undead Scourge','Levitation')
   if Levitation_level:
       depth = 1 - Levitation_level / 20.0
       player = wcs.Command(userid)
       player.SetGravity(depth)
 
def player_hurt(event_var):
   attacker = event_var['atacker']
   VampiricAura_level = wcs.GetLevel(attacker,'Undead Scourge','Vampiric Aura')
   if VampiricAura_level:
       wcs_rand = random.randint(1,10)
       if VampiricAura_level <= wcs_rand:
           player = wcs.Command(attacker)
           player.Heal(VampiricAura_level * 2)
 
def player_death(event_var):
   userid = event_var['userid']
   player = wcs.Command(userid)
   SuicideBomber_level = wcs.GetLevel(userid,"Undead Scourge","Suicide Bomber")
   if int(event_var['es_userteam']) == 2:
    player.AreaDamage('#c',SuicideBomber_level * 10,SuicideBomber_level * 5 )
   else:
    player.AreaDamage('#t',SuicideBomber_level * 10,SuicideBomber_level * 5 )
 

And nice work jeff as well.... I've now got a base which we can test custom races on... The ultimates aren't fully worked out yet, but I'm coding that as we speak. All the skills now work great, and I can test them. The levels, skill info etc all work great... After I've got the ultimates working, I'll get a few extras like shopmenu, admin menu etc working, then we'll be ready for a private beta... Can't say an ETA, but hopefully it shall be soon... Smiley It'll be even faster when jeff wakes up Tongue *CALLS GET OUT OF BED YOU LAZY SOD!!!* =]

The dbgmsg's were just for me... We had an error in the base that weren't returning the correct value, so I debugged to fix it ^_^. That code helped me fix the base... We now have 2 working races.
« Last Edit: February 17, 2008, 06:15:42 PM by freddukes » 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 #9 on: February 17, 2008, 06:26:12 PM »

i still dont quite get it:( but i think, when i go through some races coded in .py then i will slowly get it...
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]
freddukes
WCS ESP Dev Team
Level 7 Expert

Offline Offline

United Kingdom

Posts: 287



« Reply #10 on: February 17, 2008, 06:35:13 PM »

By the end of tomorrow night, me and jeff should have coded the base 5 races that come default with WCS... We'll post these up, so you can get good ideas how to code them... I'll make one very easy, and one advanced one with some nifty stuff in, so the skill ranges can adhere to the quality that suits them best. Right now though... back to my business coursework *sigh*.
Logged

qenzoz
Level 7 Expert
*****
Offline Offline

Denmark Denmark

Posts: 161

Ehm..?



balulah_qenzoz

myServer 77.66.39.8:27029
(Warning: click connects through Steam)
« Reply #11 on: February 17, 2008, 10:55:53 PM »

Is there all the normal cfg's too? Or what to call it ehm like:

Player_spawn
Player_attacker
Player_victim
Player_say
Player_Ultimate

Since i see you use player_hurt on the vampiric aura Shocked
Logged

Frodo
WCS ESP Dev Team
Level 7 Expert

Offline Offline

Posts: 854


Actinosphaerium eichhorni


WWW
ckenduro
aulix
« Reply #12 on: February 17, 2008, 11:54:08 PM »

Player_victim & player_attacker are player_hurt. It will be the same coding style. So event_var['attacker'] will be still the attacker... If you ask about this....
Logged


Actually I found it as best Bux ever. Everything's automated!
qenzoz
Level 7 Expert
*****
Offline Offline

Denmark Denmark

Posts: 161

Ehm..?



balulah_qenzoz

myServer 77.66.39.8:27029
(Warning: click connects through Steam)
« Reply #13 on: February 18, 2008, 03:41:18 AM »

Yeah okay thanks Smiley
Logged

qenzoz
Level 7 Expert
*****
Offline Offline

Denmark Denmark

Posts: 161

Ehm..?



balulah_qenzoz

myServer 77.66.39.8:27029
(Warning: click connects through Steam)
« Reply #14 on: February 18, 2008, 06:11:04 AM »

Wow i would like to make an overpowered code with player_jump Tongue.
But i just made an skill ( mole ) well i don't know if it event works and it is not the best mole ever Tongue.
Code
GeSHi (python):
def player_spawn(userid, team):
   player = wcs.Command(userid)
   mole = wcs.getLevel(userid, 'Race Name', 'Mole')
   if team = 3: mole = 'player/t_phoenix'
   elif team = 2: mole = 'player/ct_urban'
       player.Model(mole)
 
And nice guide btw. Smiley
« Last Edit: February 18, 2008, 06:47:11 AM by qenzoz » 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 12:38:51 AM]

[Today at 12:34:28 AM]

[Today at 12:12:17 AM]

[Today at 12:09:47 AM]

[Today at 12:06:56 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.295 seconds with 26 queries.