| 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
 United States
Posts: 21
sillokonedanmi5ter
|
 |
« on: October 23, 2009, 01:04:26 PM » |
|
please tell me what you think! 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
 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
|
 |
« 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  -> 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
 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  But then, sorry for my stupidity.
|
|
|
|
|
Logged
|
|
|
|
|
CA.Berettonawak
|
 |
« 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: race.registerWeaponRestriction('allow only',(['AWP','knife','deagle'])) that you'd better use the tuple OR the list, and not both. 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). 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
|
Beret, keep yourself focusing on 1 project. Be sure to memorize that down since it sounds good. i love tuna juice  =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 =CA= Berettonawak: just because you don't have hope doesn't mean we're doomed
|
|
|
DanMister
Level 1 Trained Beginner
Offline
 United States
Posts: 21
sillokonedanmi5ter
|
 |
« 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
 United States
Posts: 21
sillokonedanmi5ter
|
 |
« 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
|
 |
« 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: 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
|
Beret, keep yourself focusing on 1 project. Be sure to memorize that down since it sounds good. i love tuna juice  =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 =CA= Berettonawak: just because you don't have hope doesn't mean we're doomed
|
|
|
DanMister
Level 1 Trained Beginner
Offline
 United States
Posts: 21
sillokonedanmi5ter
|
 |
« 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? 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
|
 |
« 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: ev["es_attackerteam'] Guess what?  3. not a real question, but on line with wcs.Command, you just forgot a parenthesis after userid. wcs.Command(userid.Damage(damage, 32, attacker) ==> 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  ); 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
|
Beret, keep yourself focusing on 1 project. Be sure to memorize that down since it sounds good. i love tuna juice  =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 =CA= Berettonawak: just because you don't have hope doesn't mean we're doomed
|
|
|
DanMister
Level 1 Trained Beginner
Offline
 United States
Posts: 21
sillokonedanmi5ter
|
 |
« 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
 United States
Posts: 21
sillokonedanmi5ter
|
 |
« Reply #11 on: October 25, 2009, 08:38:29 PM » |
|
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
|
 |
« Reply #12 on: October 26, 2009, 09:35:55 AM » |
|
Ok, that's a lot better. No more misplaced code  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
|
Beret, keep yourself focusing on 1 project. Be sure to memorize that down since it sounds good. i love tuna juice  =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 =CA= Berettonawak: just because you don't have hope doesn't mean we're doomed
|
|
|
DanMister
Level 1 Trained Beginner
Offline
 United States
Posts: 21
sillokonedanmi5ter
|
 |
« 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!!!!
|
|
|
|
|
|