import es, wcs, gamethread, random, playerlib, popuplib from wcs import wcs RaceName = 'Strider Hiryu' race = wcs.Race(RaceName) race.registerSkill('Flying Dragon',4,4,'Bind a key to +ability key to fly. Hold it to fly, let it go to fall.') race.registerSkill('Advanced High Jump',4,2,'Chance to Advance your High Jump Skill one level per kill') race.registerSkill('Kayakujutsu',5,2,'The art of using fire and explosives,Bind a key to +ability') race.registerUltimate('Portal',10,1,1,'Press ultimate to save your location, press ultimate again to teleport to your saved location') strider_dict = {} def load(): popuplib.create('strider_ability') popuplib.create('strider_portal') es.ServerVar('strider_hiryu',1.0,'Strider Hiryu Race Python - Re-vamped by freddukes, originally created by Holiday').makepublic() def player_spawn(ev): userid = int(ev['userid']) if wcs.GetRace(userid) == RaceName: x,y,z = es.getplayerlocation(userid) wcs.Effect().MiscCustom('#a',0,'effects/strider_bulge_dudv_dx60.vmt',x,y,z,5,5,255) strider_dict[userid] = {'primary':0,'secondary':0,'flying':0,'x':0,'y':0,'z':0} def player_disconnect(ev): if strider_dict.has_key(ev['userid']): del strider_dict[ev['userid']] def player_ability_on(ev): userid = int(ev['userid']) fd = wcs.GetLevel(userid, RaceName, 'Flying Dragon') k = wcs.GetLevel(userid, RaceName, 'Kayakujutsu') cd = wcs.Command(userid).GetCoolDown('Kayakujutsu') if fd and not k or (fd and k and cd): Fly(userid) elif k and not fd and not cd: Kayak(userid) elif k and fd and not cd: UpdatePopup(userid) elif not fd and k and cd: es.tell(userid,'#multi','#greenKayakujutsu #default- #lightgreenYou\'re still recovering from the last practice! Wait %s seconds.'%cd) def player_ability_off(ev): userid = int(ev['userid']) popuplib.unsendname('strider_ability', userid) fd = wcs.GetLevel(userid, RaceName, 'Flying Dragon') a = wcs.Command(userid) if strider_dict[userid]['flying'] and fd: strider_dict[userid]['flying'] = 0 es.server.queuecmd('est_Jetpack %s 0'%userid) wcs.Command(userid).Fade(255,5) wcs.Command(userid).SpeedAdd(fd * -1 + 1) x,y,z = es.getplayerlocation(userid) e = wcs.Effect() e.MiscCustom('#a',0,'sprites/fire.vmt',x,y,z+15,2, 0.5 * fd ,255) e.MiscCustom('#a',0,'sprites/fire.vmt',x,y+50,z+15,2, 0.5 * fd ,255) es.emitsound('player',userid,'weapons/mortar/mortar_explode3.wav',1.0,0.0) pwep = strider_dict[userid]['primary'] swep = strider_dict[userid]['secondary'] if pwep != '0': es.server.queuecmd('est_give %s weapon_%s'%(userid,pwep)) if swep != '0': es.server.queuecmd('est_give %s weapon_%s'%(userid,swep)) def UpdatePopup(userid): p = popuplib.create('strider_ability') pl = p.addline pl('Strider Hiryu\'s abilities!') pl('-----------------------') pl(' ') pl('->1. Fly!') pl(' ') pl('->2. Kayakujutsu') pl(' ') pl('-----------------------') pl('Let go of the +ability key') pl('to close this popup!') p.menuselect = PopupMenuSelect p.send(userid) def PopupMenuSelect(userid, choice, popupid): if choice < 3: if choice == 1: Fly(userid) else: Kayak(userid) def Fly(userid): fd = wcs.GetLevel(userid, RaceName, 'Flying Dragon') if fd: strider_dict[userid]['flying'] = 1 es.server.queuecmd('est_jetpack %s 1'%userid) p = wcs.Command(userid) p.SpeedAdd(fd - 1) x,y,z = es.getplayerlocation(userid) e = wcs.Effect() e.MiscCustom('#a',0,'sprites/fire.vmt',x,y,z+15,2, 0.5 * fd ,255) e.MiscCustom('#a',0,'sprites/fire.vmt',x,y+50,z+15,2, 0.5 * fd ,255) es.emitsound('player',userid,'weapons/mortar/mortar_explode3.wav',1.0,0.0) if fd == 1: alpha = 155 elif fd == 2: alpha = 55 elif fd == 3: alpha = 25 else: alpha = 5 p.Fade(alpha,5) player = playerlib.getPlayer(userid) strider_dict[userid]['primary'] = player.get('primary') strider_dict[userid]['secondary'] = player.get('secondary') es.server.queuecmd('est_removeweapon %s 1'%userid) es.server.queuecmd('est_removeweapon %s 2'%userid) def Kayak(userid): k = wcs.GetLevel(userid, RaceName, 'Kayakujutsu') if k: time = 12 if k > 1: time = 14 radius = 200 + k * 20 x,y,z = es.getplayerlocation(userid) wcs.Effect().RingCustom('#a',0,"effects/strider_bulge_dudv_dx60.vmt",x,y,z,radius,5,time,5,5,1,255,250,70,10,10) wcs.Effect().BeamCustom('#a',0,"sprites/lgtning.vmt",x,y,z+80,x,y,z,time,20,20,10,50,255,170) wcs.Effect().MiscCustom('#a',0,"effects/strider_bulge_dudv_dx60.vmt",x,y,z + 80,time,1,50) team = '#t' if es.getplayerteam(userid) == 2: team ='#ct' wcs.Command(userid).Near(radius, RunKayak, team) es.tell(userid,'#multi','#greenKayakujutsu #default- #lightgreenYou have practiced the art of Kayakujutsu') wcs.Command(userid).SetCoolDown('Kayakujutsu',15) def RunKayak(userid, attacker): k = wcs.GetLevel(attacker, RaceName, 'Kayakujutsu') if k: damage = 10 + k * 2 if not wcs.Command(attacker).GetWallBetween(userid): x,y,z = es.getplayerlocation(attacker) xx,yy,zz = es.getplayerlocation(userid) wcs.Command(userid).Burn(2) wcs.Command(userid).Damage(damage) wcs.Effect().BeamCustom('#a',0,'effects/strider_bulge_dudv_dx60.vmt',x,y,z+40,xx,yy,zz+40,0.5,3,6,255,255,225,255) wcs.Effect().Smoke(userid) wcs.Effect().MiscCustom('#a',0,'sprites/smoke.vmt',xx,yy,zz,1,1,255) es.tell(userid,'#multi','#greenYou have been hit by Kayakujutsu') def player_death(ev): attacker = int(ev['attacker']) userid = int(ev['userid']) ahj = wcs.GetLevel(attacker, RaceName, 'Advanced High Jump') if ahj and random.randint(1,10) < ahj and ev['es_attackerteam'] != ev['es_userteam']: wcs.Command(attacker).ChangeGravity(-0.2) es.tell(attacker,'#multi','#greenAdvanced High Jump #default- #lightgreenYour savage kill gave you extra jumping power') x,y,z = es.getplayerlocation(attacker) xx,yy,zz = es.getplayerlocation(userid) e = wcs.Effect() e.RingCustom('#a',0,'sprites/steam1.vmt',x,y,z+50,90,150,3,20,5,2,15,20,255,200,1) e.BeamCustom('#a',0,'effects/strider_bulge_dudv_dx60.vmt',x,y,z+50,xx,yy,zz+30,3,3,3,155,155,155,255) def player_ultimate_on(ev): userid = int(ev['userid']) if wcs.GetLevel(userid, RaceName, 'Portal'): strider_dict[userid]['portal_loop'] = 0 UpdateUltimatePopup(userid) def UpdateUltimatePopup(userid): a = strider_dict[userid] p = popuplib.create('strider_portal') pp = p.addline pp('Strider Hiryu\'s Teleports!') pp('---------------------------') pp('Current teleports:') pp(' ') pp('X Co-ordinate: %s'%(int(a['x']))) pp('Y Co-ordinate: %s'%(int(a['y']))) pp('Z Co-ordinate: %s'%(int(a['z']))) pp(' ') pp('->1. Set Current Position') pp(' ') pp('->2. Teleport! (hold down the ultimate key still)') pp(' ') pp('---------------------------') pp('Let go of the +ultimate key') pp('to close this popup!') p.menuselect = PortalSelect p.send(userid) def PortalSelect(userid, choice, popupid): if choice < 3: a = strider_dict[userid] if choice == 1: x,y,z = es.getplayerlocation(userid) a['x'] = x a['y'] = y a['z'] = z + 20 es.tell(userid,'#multi','#greenPortal #default- #lightgreenPosition Saved!') UpdateUltimatePopup(userid) else: x = a['x'] y = a['y'] z = a['z'] if wcs.Command(userid).GetTeleSafe(x,y,z): es.tell(userid,'#multi','#greenPortal #default- #lightgreenTeleport... Please wait!') PortalLoop(userid) else: es.tell(userid,'#multi','#greenPortal #default- #lightgreenThat position is too close to walls. Please save another!') def PortalLoop(userid): es.usermsg("create", "portal_loop", "HintText") es.usermsg("write","short","portal_loop",-1) a = strider_dict[userid]['portal_loop'] format = "Teleporting... Please Wait!!!:\n-----------------------\n" if a < 5: es.emitsound('player',userid,'buttons/blip2.wav',0.5,0.5) strider_dict[userid]['portal_loop'] += 1 while a >= 0: a -= 1 format += "[ ] " delay_name = 'portal_%s'%userid gamethread.delayedname(1,delay_name,PortalLoop,userid) else: format += "* TELEPORTING! *" es.cexec(userid,'-ultimate') es.usermsg("write","string","portal_loop",format) es.usermsg("send","portal_loop",userid,0) es.usermsg("delete","portal_loop") def player_ultimate_off(ev): userid = int(ev['userid']) gamethread.cancelDelayed('portal_%s'%userid) if wcs.GetLevel(userid, RaceName, 'Portal'): popuplib.unsendname('strider_portal', userid) a = strider_dict[userid] if a['portal_loop'] >= 5: x = a['x'] y = a['y'] z = a['z'] es.server.queuecmd('est_Teleport %s %s %s %s'%(userid,x,y,z)) es.tell(userid,'#multi','#greenPortal #default- #lightgreenYou have successfully teleported to your saved position.') a['portal_loop'] = 0