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-10-29 (original capture). Home · Forum · All archived topics · Downloads
Warcraft-Source.com - WCS mod for CSS
October 29, 2009, 10:32:09 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]   Go Down
  Print  
This topic has not yet been rated! You have not rated this topic. Select a rating:
Author Topic: My first race! thought i'd let u guys look at it....  (Read 112 times)
DanMister
Level 1 Trained Beginner
*
Offline Offline

United States United States

Posts: 21




sillokone
danmi5ter
« on: October 23, 2009, 01:04:26 PM »

please tell me what you think!


Code
GeSHi (python):
#########################
#   Import module
 
import es
import random
import gamethread
 
import wcs
from wcs import wcs
 
#########################
#   PUBLISH INFO
 
info = es.AddonInfo()
info.name = 'DanMister'
info.author = 'DanMister'
 
#########################
#   RACE INFO
 
RaceName = "Dan's test race"
   # Name the mod
race = wcs.Race(RaceName)
race.registerWeaponRestriction('allow only',(['AWP','knife','deagle']))
 
 
#########################
#   SKILL INFO
 
race.registerSkill('Dan destroy you!',1,5,'Critical shot!')
race.registerSkill('Sneaky Dan',1,5,'Hey, where did Dan go?')
race.registerSkill('Vroom Vroom Dan',1,5,'vvvvvrrrooooommmm!!!!')
race.registerSkill("Haha... I came back!",1,8,"HE'S BACK!! RUN!!!")
race.registerSkill("Dan gets his favorite weapon!",1,3,"Give's Dan an Awp")
 
 
#########################
#   ULTIMATE INFO
 
race.registerUltimate("Aderal Dan...",8,5,1'Calms down others around dan to the point of paralysis')
 
#########################
 
 
 
 
def player_spawn(ev):
   userid       = ev['userid']
   attacker     = ev['attacker']
   userteam     = ev['es_userteam']
   attackerteam = ev['es_attackerteam']
   player       = wcs.Command(userid)
 
if userteam != (attackerteam) and (attacker):
   # Player's are on opposite teams so we can do the critical strike...
critStrike = wcs.GetLevel(attacker, raceName, 'Dan destroy you!')
Invisibility = wcs.GetLevel(userid, raceName, 'Sneaky Dan')
Speedy = wcs.GetLevel(userid, raceName, 'Vroom Vroom Dan')
Weapon = wcs.GetLevel(userid, raceName, 'Dan gets his favorite weapon!')
chance = random.randint(1,10)
chance2 = random.randint(1,7)
chance3 = random.randint(1,5)
   # Chooses a random number
if CritStrike >= chance:
   damage = critStrike * int(critStrikeDamage)
   wcs.Command(userid.Damage(damage, 32, attacker)
               tokens             = {}
               tokens['victim']   = ev['es_username']
               tokens['attacker'] = ev['es_attackername']
               tokens['damage']   = damage
               es.tell(userid,     '#multi', print('critical strike victim',  tokens, playerlib.getPlayer(userid).get("lang"))
               es.tell(attacker,   '#multi', print('critcal strike attacker', tokens, playerlib.getPlayer(attacker).get("lang"))
               wcs.effect.Beam2(attacker, userid, 3, 100, 255, 0)
                       # And that is Crit strike! : D
 
                       if Invisibility >= chance2
                       wcs.Command(userid.Color(alpha=400)
                                   # And thats invisibility! : D
 
                                   if Speedy >= chance:
       plevel = Speedy * int(unholyPercent) * .01
       player.SpeedAdd(plevel)
       es.tell(userid, '#multi', text('unholy aura', {'speed': plevel * 100}, playerlib.getPlayer(userid).get("lang") ) )
                   # And thats speed boost! : D
 
                       if Weapon >=chance3:
                           es.server.queuecmd('est_Give %s weapon_AWP'%event_var['userid'])
                           effect.Misc2(userid, 5, 1)
 
 
 
 
 
 
def player_death(ev):
   userid = ev['userid']
   rein   = wcs.GetLevel(userid, raceName, 'Haha... I came back!')
   if rein:
       rand = rand.randint(1,7)
       if rand <= rein * int(reinPercent):
           wcs.Command(userid).Delayed(1, spawnUserid, userid)
 
def spawnUserid(userid):
   if len(filter(lambda x: not es.getplayerprop(x, 'CBasePlayer.pl.deadflag') and es.getplayerteam(x) == es.getplayerteam(userid),es.getUseridList() ) ):
       # If team-mate is alive...
   wcs.Command(userid.Spawn()
   wcs.effect.Smoke(userid)
   es.tell(userid, '#multi', print('DAN IS BACK!', lang = playerlib.getPlayer(userid).get("lang") ) )
               # And thats respawn! : D
 
 
def player_ultimate_on(ev):
               userid = int(ev['userid'])
               freeze = wcs.GetLevel(userid, raceName, "Aderal Dan...")
               if freeze:
                   filter = '#ct' if ev['es_userteam'] == '2' else '#t'
                   wcs.Command(userid).Near(1000, stun, filter)
                   wcs.Command(userid).SetCoolDown('freeze', int(entangleCoolDown) )
 
def stun(userid, attacker):
   wcs.Command(userid.Freeze(wcs.GetLevel(attacker, raceName, 'Freeze') * int(entangeDuration) )
   wcs.effect.Beam2(attacker, userid, 1.5, 255, 255, 255)
   es.tell(userid, '#lightgreen', text('entangle', lang = playerlib.getPlayer(userid).get("lang") ) )
               # And thats Freeze ultimate! : D
 
 
 
               # AND I'M DONE! W00T!!!
 
#############################################################################################################################              
 
 
 
 
 



and there you have it.... please post your opinions and such!
Logged

When life gives'ya lemons, throw em at lifes face and be like "WTF! I hate fuckin' lemons!!!!
Minus
Level 1 Trained Beginner
*
Offline Offline

Denmark Denmark

Posts: 32



« Reply #1 on: October 23, 2009, 02:00:35 PM »

Sorry but what the hell is this? I'm confused.
Make a race using es_WCSraces_db.txt file.

Logged
DisturbeD
Level 4 Intermediate
****
Offline Offline

Germany Germany

Posts: 85



« Reply #2 on: October 23, 2009, 02:58:56 PM »

Its a python race ^^ it has nothing to do with es_WCSraces_db.txt since every race got an own file in python-wcs...
Eventscripts is based on Python.. tho python is a hundred times faster (dunno maybe over 1000x faster), thats why I never understood why there are so much more races in ES and that there is so much more support at Es-stuff than there is in Python Coding...
And I never understood why c++ shouldn be supported by Counterstrike.. Think Metamod is written in c++

Too much confusing things, so I just accepted Es  Wink

-> http://python.eventscripts.com/pages/Main_Page
-> http://forums.eventscripts.com/viewtopic.php?t=17861
« Last Edit: October 23, 2009, 03:05:12 PM by DisturbeD » Logged
Minus
Level 1 Trained Beginner
*
Offline Offline

Denmark Denmark

Posts: 32



« Reply #3 on: October 23, 2009, 03:53:30 PM »

If sorry then, it's just like a hole new thing i i couldn't understand it Grin
But then, sorry for my stupidity.
Logged
CA.Berettonawak
Le renommé méconnu...
Watchdogs
Level 7 Expert
*****
Offline Offline

France France

Posts: 2650


Big Berettonawak is watching you...


WWW
Bifkids
« Reply #4 on: October 23, 2009, 03:56:40 PM »

Well i don't know the exact syntax of wcs command, but i'd say about:
Quote
race.registerWeaponRestriction('allow only',(['AWP','knife','deagle']))
that you'd better use the tuple OR the list, and not both.

Quote
def player_spawn(ev):
    userid       = ev['userid']
    attacker     = ev['attacker']
    userteam     = ev['es_userteam']
    attackerteam = ev['es_attackerteam']
    player       = wcs.Command(userid)
About this one, there is no attacker on player_spawn event (check www.eventscripts.com/pages/Player_spawn for more infos about all event vars available on player_spawn).

Quote
if userteam != (attackerteam) and (attacker):
And this, i just really don't understand, it's outside of the player spawn block, but uses vars defined there.
Logged

Quote from: N0life
Beret, keep yourself focusing on 1 project. Be sure to memorize that down since it sounds good.
Quote from: myself
i love tuna juice Cheesy
Quote from: Pietro
=CA= Pietro: back
=CA= Pietro: sorry, was downstair sharing my chocolate with my cat
=CA= Pietro: you should see his face when he ate it xD
Quote from: myself
=CA= Berettonawak: just because you don't have hope doesn't mean we're doomed
DanMister
Level 1 Trained Beginner
*
Offline Offline

United States United States

Posts: 21




sillokone
danmi5ter
« Reply #5 on: October 23, 2009, 10:28:58 PM »

well can you explain what i should put on the first thing you wrote.

and on number two... I just typed what was typed on the "orchish horde race" and that was one of them.

some with the "userid !" one i just re typed the orchish horde on that... I try not to copy and paste so i can take in the information, but sometimes i just don't understand whats going on like this one... lol
Logged

When life gives'ya lemons, throw em at lifes face and be like "WTF! I hate fuckin' lemons!!!!
DanMister
Level 1 Trained Beginner
*
Offline Offline

United States United States

Posts: 21




sillokone
danmi5ter
« Reply #6 on: October 25, 2009, 02:36:02 AM »

bump
Logged

When life gives'ya lemons, throw em at lifes face and be like "WTF! I hate fuckin' lemons!!!!
CA.Berettonawak
Le renommé méconnu...
Watchdogs
Level 7 Expert
*****
Offline Offline

France France

Posts: 2650


Big Berettonawak is watching you...


WWW
Bifkids
« Reply #7 on: October 25, 2009, 10:16:15 AM »

About the first thing, i just told you what to do, but i guess you just can't understand it:
Quote
you'd better use the tuple OR the list, and not both.
A tuple is a list defined with parenthesis which cannot be re-written or edited, only read.
A list is a list defined with [ ] which can be read, written, re-written, edited.


The second thing, you just use player_hurt stuff inside a player_spawn block.
It just cannot work... Well, it will do like it works, but it will just use wrong values for attacker stuff (values of the last player_hurt/player_death event).

About the last thing, the only problem you got with it (apart from the fact it still calls player_hurt) is it is out of all blocks. It's in no block = it's executed only once, when the race is loaded.



My conclusion and definitive advice: Before you try not to C/P all, better learn coding.
I don't say it in a bad way, just meaning you have things to learn ^^
Logged

Quote from: N0life
Beret, keep yourself focusing on 1 project. Be sure to memorize that down since it sounds good.
Quote from: myself
i love tuna juice Cheesy
Quote from: Pietro
=CA= Pietro: back
=CA= Pietro: sorry, was downstair sharing my chocolate with my cat
=CA= Pietro: you should see his face when he ate it xD
Quote from: myself
=CA= Berettonawak: just because you don't have hope doesn't mean we're doomed
DanMister
Level 1 Trained Beginner
*
Offline Offline

United States United States

Posts: 21




sillokone
danmi5ter
« Reply #8 on: October 25, 2009, 06:46:29 PM »

ya, i know... I'm a beginner and this is my "first race"... so i'm still learning. I'll try to fix the problems and then repost the corrections.

thanks berettonawak for the help. I'll just use a tuple.  how should i fix the no attacker on spawn? should i just move the group of code to the "def player_hurt(ev)" block?

update: ok so heres what i did.
I changed the tuple problem so that i'm only using a tuple and not a list.
I removed the CritStrike ability out of the player spawn block.
I made a player_hurt block, and put everything for the crit strike in there.

the only question i have is. will this work?
Code
GeSHi (python):
def player_hurt(ev):
   userid = ev['userid']
   userteam = ev['es_userteam']
   attacker = ev['attacker']
   attackerteam = ev["es_attackerteam']
   CritStrke = wcs.GetLevel(userid, raceName, 'Dan destroy you!')
   chance = random.randint(1,10)
 
   if CritStrike >= chance and if userteam ! = attacker and attackerteam:
                     # user's are on opposite teams and the critstrike happened, so we can do the crit strike.
   damage = critStrike * int(critStrikeDamage)
   wcs.Command(userid.Damage(damage, 32, attacker)
               tokens             = {}
               tokens['victim']   = ev['es_username']
               tokens['attacker'] = ev['es_attackername']
               tokens['damage']   = damage
               es.tell(userid,     '#multi', print('critical strike victim',  tokens, playerlib.getPlayer(userid).get("
lang"))
               es.tell(attacker,   '#multi', print('critcal strike attacker', tokens, playerlib.getPlayer(attacker).get("
lang"))
               wcs.effect.Beam2(attacker, userid, 3, 100, 255, 0)
                       # And that is Crit strike! : D

thanks,
     -Dan-
« Last Edit: October 25, 2009, 07:07:41 PM by DanMister » Logged

When life gives'ya lemons, throw em at lifes face and be like "WTF! I hate fuckin' lemons!!!!
CA.Berettonawak
Le renommé méconnu...
Watchdogs
Level 7 Expert
*****
Offline Offline

France France

Posts: 2650


Big Berettonawak is watching you...


WWW
Bifkids
« Reply #9 on: October 25, 2009, 07:39:07 PM »

Two questions:
1. is print() within your script; if not, it won't work.
2. not a real question, but:
Quote
ev["es_attackerteam']
Guess what? Tongue
3. not a real question, but on line with wcs.Command, you just forgot a parenthesis after userid.
Quote
wcs.Command(userid.Damage(damage, 32, attacker)
==>
Code:
wcs.Command(userid).Damage(damage, 32, attacker)

EDIT: Else it seems fine, just post the whole race so i can see if there are other problems.
And cz for having done your first python race (with a bit of help, but still Tongue); if you wish to add me to your friends (steam or msn), feel free to (just check my profile to get more infos on how to contact me).
Logged

Quote from: N0life
Beret, keep yourself focusing on 1 project. Be sure to memorize that down since it sounds good.
Quote from: myself
i love tuna juice Cheesy
Quote from: Pietro
=CA= Pietro: back
=CA= Pietro: sorry, was downstair sharing my chocolate with my cat
=CA= Pietro: you should see his face when he ate it xD
Quote from: myself
=CA= Berettonawak: just because you don't have hope doesn't mean we're doomed
DanMister
Level 1 Trained Beginner
*
Offline Offline

United States United States

Posts: 21




sillokone
danmi5ter
« Reply #10 on: October 25, 2009, 08:08:40 PM »

alright i added you on steam, I'll fix some of those problems and post the whole thing.

btw, i would add you on msn, but my msn is bein weird..
Logged

When life gives'ya lemons, throw em at lifes face and be like "WTF! I hate fuckin' lemons!!!!
DanMister
Level 1 Trained Beginner
*
Offline Offline

United States United States

Posts: 21




sillokone
danmi5ter
« Reply #11 on: October 25, 2009, 08:38:29 PM »

Code
GeSHi (python):
#   Import module
 
import es
import random
import gamethread
 
import wcs
from wcs import wcs
 
#########################
#   PUBLISH INFO
 
info = es.AddonInfo()
info.name = 'DanMister'
info.author = 'DanMister'
 
#########################
#   RACE INFO
 
RaceName = "Dan's test race"
   # Name the mod
race = wcs.Race(RaceName)
race.registerWeaponRestriction('allow only',['AWP','knife','deagle'])
 
 
#########################
#   SKILL INFO
 
race.registerSkill('Dan destroy you!',1,5,'Critical shot!')
race.registerSkill('Sneaky Dan',1,5,'Hey, where did Dan go?')
race.registerSkill('Vroom Vroom Dan',1,5,'vvvvvrrrooooommmm!!!!')
race.registerSkill("Haha... I came back!",1,8,"HE'S BACK!! RUN!!!")
race.registerSkill("Dan gets his favorite weapon!",1,3,"Give's Dan an Awp")
 
 
#########################
#   ULTIMATE INFO
 
race.registerUltimate("Aderal Dan...",8,5,1'Calms down others around dan to the point of paralysis')
 
#########################
 
 
 
 
def player_spawn(ev):
   userid       = ev['userid']
   userteam     = ev['es_userteam']
   player       = wcs.Command(userid)
 
Invisibility = wcs.GetLevel(userid, raceName, 'Sneaky Dan')
Speedy = wcs.GetLevel(userid, raceName, 'Vroom Vroom Dan')
Weapon = wcs.GetLevel(userid, raceName, 'Dan gets his favorite weapon!')
chance2 = random.randint(1,7)
chance3 = random.randint(1,5)
   # Chooses a random number
 
                       if Invisibility >= chance2
                       wcs.Command(userid.Color(alpha=400)
                                   # And thats invisibility! : D
 
                                   if Speedy >= chance:
       plevel = Speedy * int(unholyPercent) * .01
       player.SpeedAdd(plevel)
       es.tell(userid, '#multi', text('Man, Dan is fast!', {'speed': plevel * 100}, playerlib.getPlayer(userid).get("lang") ) )
                   # And thats speed boost! : D
 
                       if Weapon >=chance3:
                           es.server.queuecmd('est_Give %s weapon_AWP'%event_var['userid'])
                           wcs.effect().Misc2(userid,3,3)
 
def player_hurt(ev):
   userid = ev['userid']
   userteam = ev['es_userteam']
   attacker = ev['attacker']
   attackerteam = ev['es_attackerteam']
   CritStrke = wcs.GetLevel(userid, raceName, 'Dan destroy you!')
   chance = random.randint(1,10)
 
   if CritStrike >= chance and if userteam ! = attacker and attackerteam:
                     # user's are on opposite teams and the critstrike happened, so we can do the crit strike.
   damage = critStrike * int(critStrikeDamage)
   wcs.Command(userid).Damage(damage, 32, attacker)
               tokens             = {}
               tokens['victim']   = ev['es_username']
               tokens['attacker'] = ev['es_attackername']
               tokens['damage']   = damage
               es.tell(userid,     '#multi', text('critical strike victim',  tokens, playerlib.getPlayer(userid).get("lang"))
               es.tell(attacker,   '#multi', text('critcal strike attacker', tokens, playerlib.getPlayer(attacker).get("lang"))
               wcs.effect.Beam2(attacker, userid, 3, 100, 255, 0)
                       # And that is Crit strike! : D
 
 
 
 
 
 
 
 
def player_death(ev):
   userid = ev['userid']
   rein   = wcs.GetLevel(userid, raceName, 'Haha... I came back!')
   if rein:
       rand = rand.randint(1,7)
       if rand <= rein * int(reinPercent):
           wcs.Command(userid).Delayed(1, spawnUserid, userid)
 
def spawnUserid(userid):
   if len(filter(lambda x: not es.getplayerprop(x, 'CBasePlayer.pl.deadflag') and es.getplayerteam(x) == es.getplayerteam(userid),es.getUseridList() ) ):
       # If team-mate is alive...
   wcs.Command(userid.Spawn()
   wcs.effect.Smoke(userid)
   es.tell(userid, '#multi', text('DAN IS BACK!', lang = playerlib.getPlayer(userid).get("lang") ) )
               # And thats respawn! : D
 
 
def player_ultimate_on(ev):
               userid = int(ev['userid'])
               freeze = wcs.GetLevel(userid, raceName, "Aderal Dan...")
               if freeze:
                   filter = '#ct' if ev['es_userteam'] == '2' else '#t'
                   wcs.Command(userid).Near(1000, stun, filter)
                   wcs.Command(userid).SetCoolDown('freeze', int(entangleCoolDown) )
 
def stun(userid, attacker):
   wcs.Command(userid.Freeze(wcs.GetLevel(attacker, raceName, 'Freeze') * int(entangeDuration) )
   wcs.effect.Beam2(attacker, userid, 1.5, 255, 255, 255)
   es.tell(userid, '#lightgreen', text('Time to take your medicine...', lang = playerlib.getPlayer(userid).get("lang") ) )
               # And thats Freeze ultimate! : D
 
 
 
               # AND I'M DONE! W00T!!!
 
#############################################################################################################################              
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Logged

When life gives'ya lemons, throw em at lifes face and be like "WTF! I hate fuckin' lemons!!!!
CA.Berettonawak
Le renommé méconnu...
Watchdogs
Level 7 Expert
*****
Offline Offline

France France

Posts: 2650


Big Berettonawak is watching you...


WWW
Bifkids
« Reply #12 on: October 26, 2009, 09:35:55 AM »

Ok, that's a lot better.
No more misplaced code Tongue
Now you'll have to fix the spaces.
Four spaces after each ":"
When you end the block, you remove four spaces.
Every code MUST have 4 spaces (at least) in front of it (else it will be executed on script load).
Logged

Quote from: N0life
Beret, keep yourself focusing on 1 project. Be sure to memorize that down since it sounds good.
Quote from: myself
i love tuna juice Cheesy
Quote from: Pietro
=CA= Pietro: back
=CA= Pietro: sorry, was downstair sharing my chocolate with my cat
=CA= Pietro: you should see his face when he ate it xD
Quote from: myself
=CA= Berettonawak: just because you don't have hope doesn't mean we're doomed
DanMister
Level 1 Trained Beginner
*
Offline Offline

United States United States

Posts: 21




sillokone
danmi5ter
« Reply #13 on: October 26, 2009, 12:59:34 PM »

Aight,ill get on that when i get home later today...
Logged

When life gives'ya lemons, throw em at lifes face and be like "WTF! I hate fuckin' lemons!!!!
Pages: [1]   Go Up
  Print  
 
Jump to:  

Last 7 Shouts:
Today at 09:19:00 AM
lol Tongue
still awake though in the USA?
no work today?
Today at 09:15:34 AM
wtf woah... i didnt see that you guys talking about me.... but its k idk what you guys talking about..so im in good mood right now lol
Today at 09:12:55 AM
lol zawmb, sorry it was really dissing (if my dictionnary gave me the right meaning about this word)... chuck is a nice guy and i didn't say it bad, but still... it wasn't a random sentence i made Tongue
October 28, 2009, 07:43:27 PM
can anyone check this out....http://www.youtube.com/user/vadik24
October 28, 2009, 06:42:52 PM
Zoras, don't diss someone you aren't educated enough to "diss".  Berett said he only watched stargate for the past year and stargate alone and asked if anyone else had done the same.  He did not 'diss' chuck in any way.
October 28, 2009, 06:26:24 PM
What section should I post my set of races? Mah friend shut down his server, so I figure I'll just make 'em public.
October 28, 2009, 12:03:53 PM
Dont diss my homie Chuck ;]
Recent
[Today at 09:32:16 AM]

[Today at 09:29:45 AM]

[Today at 09:18:21 AM]

[Today at 09:14:35 AM]

[Today at 08:53:39 AM]

[Today at 05:41:49 AM]

[Today at 03:34:21 AM]

[Today at 03:33:46 AM]

[Today at 03:25:46 AM]

[Today at 02:04:47 AM]
Theme switch

Powered by MySQL Powered by PHP Powered by SMF 1.1.10 | SMF © 2006-2009, Simple Machines LLC
TinyPortal v0.9.8 © Bloc
Valid XHTML 1.0! Valid CSS!
Page created in 0.544 seconds with 22 queries.