I'd like feedback please, im gonna enter this race for the race competition, so i'd like to optimize it before i enter it.
Does anyone have idea's to add maybe, or have you found a bug? Please let me know
Anyways, here's the race:
Code
Thanks in advance!GeSHi (python):'''
Firelord for WCSP, coded by Hawk. (The_Last_Ghost)
(Also my first race =D)
Alot of thanks to Joshtrav for all the testing he did!
'''
import es, wcs, gamethread, random
from wcs import wcs
RaceName = 'Firelord'
race = wcs.Race(RaceName)
race.registerMinLevel(50)
race.registerSkill('Soul Burn', 5, 2, 'Deal damage over time and slow victim.') #use ability to Soul Burn the enemy you're looking at, damaging and slowing the target. (Can i disable "ability" and "ultimate" for victim?)
race.registerSkill('Consuming Fire', 5, 2, 'Consume the enemy flesh by attacking them to feed your eternal fire. /n(Respawns you if you have gathered enough energy, once/round.)') #Save the damage you deal into a dictionary, if above 50 then respawn player on death, max 200 spawning hp.
race.registerSkill('Incinerate', 6, 2, 'Deal additional damage for every hit, and explode victim if you kill.') #deal a small amount of extra dmg every hit, if the victim dies, he explodes.
race.registerUltimate('Volcano', 8, 8, 2, 'Channel a volcano to damage and stun enemies around you (and a small chance to do instant-kill).') #Channel a volcano, damaging and stunning nearby enemies every 3 seconds for 15 seconds, small chance for instant kill.
def player_hurt(ev):
uid = int(ev['userid'])
aid = int(ev['attacker'])
playera = wcs.Command(aid)
playeru = wcs.Command(uid)
if ev['es_userteam'] != ev['es_attackerteam'] and aid:
ConFireOn = playera.ReturnDict('ConFireOn')
ConFire = wcs.GetLevel(aid, RaceName, 'Consuming Fire')
if ConFireOn and ConFire:
damage = int(ev['dmg_health'])
temp = playera.ReturnDict('ConFireValue')
damage = damage * 0.2 * ConFire
if (temp + damage) > 200:
damage = damage + temp - 200
playera.ModDict('ConFireValue', damage)
Incinerate = wcs.GetLevel(aid, RaceName, 'Incinerate')
if Incinerate:
damage = int(ev['dmg_health'])
damage = damage * 0.03 * Incinerate
playeru.Damage(damage, 32, aid)
wcs.Effect().Beam2(uid, aid, 0.3, 200, 27, 28)
if int(ev['es_userdead']):
erange = Incinerate * 25
edamage = Incinerate * 7.5
if int(ev['es_attackerteam']) == 2:
targets = '#ct'
elif int(ev['es_attackerteam']) == 3:
targets = '#t'
randsound = 'weapons/%s' % random.choice(['explode3.wav', 'explode4.wav', 'explode5.wav'])
es.emitsound(player, uid, randsound, 1.0, erange * 1.25)
wcs.Effect().Smoke(uid)
playeru.AreaDamage(targets, erange, edamage)
def player_death(ev):
uid = int(ev['userid'])
playeru = wcs.Command(uid)
ConFire = wcs.GetLevel(uid, RaceName, 'Consuming Fire')
ConFireOn = playeru.ReturnDict('ConFireOn')
if ConFireOn and ConFire:
ConFireValue = playeru.ReturnDict('ConFireValue')
if ConFireValue >= 50:
es.tell(uid, '#multi', "#lightgreenYour flame builds again, you respawn in 3 seconds.")
gamethread.delayedname(3, 'ConFireSpawn', playeru.Spawn)
gamethread.delayedname(3.2, 'ConFireSpawn', playeru.Health, ConFireValue)
gamethread.delayedname(3.3, 'ConFireSpawn', es.emitsound, (player, uid, 'ambient/fire/ignite.wav', 1.0, 200))
playeru.UpdateDict('ConFireOn', 0)
playeru.UpdateDict('ConFireValue', 0)
else:
es.tell(uid, '#multi', "#lightgreenYou didn't gather enough energy to respawn.")
def player_ability_on(ev):
uid = int(ev['userid'])
playeru = wcs.Command(uid)
cooldown = playeru.GetCoolDown('Soul Burn')
if not cooldown:
SoulBurn = wcs.GetLevel(uid, RaceName, 'Soul Burn')
if SoulBurn:
target = playeru.GetViewPlayer()
if target:
playert = wcs.Command(target)
targetteam = es.getplayerteam(target)
userteam = es.getplayerteam(uid)
if targetteam != userteam:
duration = SoulBurn * 2
slow = SoulBurn * -0.1
damage = SoulBurn * 3
playert.Drain(damage, 3, duration)
playert.SpeedAdd(slow)
playert.BlockUlti(duration)
playert.BlockAbil(duration)
gamethread.delayedname(duration, 'SoulBurnSpeed', playert.SpeedAdd, -slow)
playert.SetCoolDown('Soul Burn', 20)
else:
es.tell(uid, '#multi', '#lightgreenYou must be looking at an enemy target to use #greenSoul Burn!')
else:
es.tell(uid, '#multi', '#lightgreenYou must be looking at an enemy target to use #greenSoul Burn!')
def player_ultimate_on(ev):
uid = int(ev['userid'])
playeru = wcs.Command(uid)
volcano = wcs.GetLevel(uid, RaceName, 'Volcano')
cooldown = playeru.GetCoolDown('Volcano')
if volcano and not cooldown:
es.tell(uid, '#multi', "#lightgreenYou start channeling a #greenVolcano!")
es.setplayerprop(uid, 'CBasePlayer.m_fFlags', 32.0)
playeru.SetCoolDown('Volcano', 30)
vrange = volcano * 50
volcanoexec(uid, vrange)
playeru.UpdateDict('VolcanoOn', 1)
gamethread.delayedname(12, 'VolcanoOff', player_ultimate_off_force, uid)
def player_ultimate_off(ev):
uid = int(ev['userid'])
playeru = wcs.Command(uid)
volcano = wcs.GetLevel(uid, RaceName, 'Volcano')
if volcano:
player_ultimate_off_force(uid)
def player_ultimate_off_force(uid):
playeru = wcs.Command(uid)
es.cexec(uid, '-ultimate')
es.tell(uid, '#multi', "#lightgreenYou stop channeling the #greenVolcano!")
es.setplayerprop(uid, 'CBasePlayer.m_fFlags', 1.0)
playeru.UpdateDict('VolcanoOn', 0)
name = 'volcano_%s' % uid
gamethread.cancelDelayed(name)
gamethread.cancelDelayed('VolcanoOff')
def volcanoloop(uid, aid):
playeru = wcs.Command(uid)
playera = wcs.Command(aid)
volcano = wcs.GetLevel(aid, RaceName, 'Volcano')
damage = volcano * 4
stun = volcano * 0.2
instakill = volcano * 0.5
es.emitsound(player, uid, 'ambient/explosions/explode_8.wav', 1.0, volcano * 55)
wcs.Effect().Misc5(aid, 2, 3)
wcs.Effect().Smoke(aid)
if instakill > random.randint(1, 100):
health = es.gethealth(uid)
playeru.Damage(health, 32, aid)
es.tell(uid, '#multi', "#lightgreenYou have been killed by a volcano rock") #Better luck next time! hehe...
else:
playeru.Damage(damage, 32, aid)
playeru.Freeze(stun)
es.tell(uid, '#multi', "#lightgreenYou have taken #green%s damage #lightgreenand been #greenstunned for %s seconds #lightgreenby a volcano") % (str(damage), str(stun))
volcanoon = playera.ReturnDict('VolcanoOn')
if volcanoon:
name = 'volcano_%s' % aid
gamethread.delayedname(3, name, 'volcanoloop', (uid, aid))
def volcanoexec(uid, vrange):
playeru = wcs.Command(uid)
userteam = es.getplayerteam(uid)
if userteam == 2:
targetteam = '#ct'
elif userteam == 3:
targetteam = '#t'
playeru.Near(vrange, volcanoloop, targetteam)
def round_start(ev):
for uid in es.getUseridList():
wcs.Command(uid).UpdateDict('ConFireOn', 1)
def round_end(ev):
gamethread.cancelDelayed('SoulBurnSpeed')
gamethread.cancelDelayed('ConFireSpawn')
gamethread.cancelDelayed('VolcanoOff')
for uid in es.getUseridList():
VolcanoOn = wcs.Command(uid).ReturnDict('VolcanoOn')
if VolcanoOn:
player_ultimate_off_force(uid)
*Edit: Added minimum level.
**Edit: Just realized I'm missing effects, i'll add those later, goodnight for now...
***Edit: Gave the delayname a rather unique name.
Code updated: added a force stop for ultimate.... Added effects for incinerate, respawn and volcano.
I haven't tested this race, and i don't have a server i can test on... Could anyone test for me? Just PM me with eventual bugs or things that needs fix (Or let me know if it's OP, i have a feeling that Volcano is a bit too powerful, if it worked )
Hmm, i have looked at the issue with the ultimate, and found out why you are kept frozen, and so i've (hopefully) fixed that. Though i can't rly figure out why it keeps looping, do you keep getting the message that the volcano stops?






Denmark
Logged

United States

