Shuvit game master repo. http://shuvit.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

controller2.py 175KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286
  1. #shuvit.org
  2. # control script
  3. def main():
  4. #scale = .3
  5. #action layers
  6. #0-14 rolling
  7. #grablay = 400
  8. #fliplay = 500
  9. #grindlay = 700
  10. os = 'Windows'
  11. from sys import platform
  12. if platform != "win32":
  13. os = 'Linux'
  14. def onWindows():
  15. return os == 'Windows'
  16. from mathutils import Vector
  17. import bge
  18. import GameLogic
  19. import ctypes
  20. import math
  21. #import bpy
  22. #build global dict (move this to separate script that runs once)
  23. scene = bge.logic.getCurrentScene()
  24. objList = scene.objects
  25. try:
  26. GameLogic.DictObjects
  27. init=1
  28. except:
  29. init=0
  30. if init:
  31. cont.GameLogic.getCurrentController()
  32. own = cont.getOwner()
  33. name = own.getName()
  34. if not GameLogic.DictObjects.has_key(name):
  35. GameLogic.DictObjects[name]=cont
  36. own.init=0
  37. #reduction = 400000
  38. #axisTh = 0.03
  39. #initialize quadrant variables
  40. q1on = 0
  41. q2on = 0
  42. q3on = 0
  43. q4on = 0
  44. q5on = 0
  45. q6on = 0
  46. q7on = 0
  47. q8on = 0
  48. lq1on = 0
  49. lq2on = 0
  50. lq3on = 0
  51. lq4on = 0
  52. lq5on = 0
  53. lq6on = 0
  54. lq7on = 0
  55. lq8on = 0
  56. #number of frames / length of the location timers
  57. countdown = 20
  58. cont = GameLogic.getCurrentController()
  59. obj = bge.logic.getCurrentScene().objects
  60. char = bge.constraints.getCharacter
  61. own = cont.owner
  62. dict = bge.logic.globalDict #Get the global dictionary
  63. #dict['trick_string'] = ''
  64. #last frame stuff
  65. lGRAB_ON = own["lGRAB_ON"]
  66. lastgrab = own["lastGrab"]
  67. lastpump = own["lastPump"]
  68. lf_ground = own["lF_ground"]
  69. lastopos = own["last_Opos"]
  70. lastnopos = own["last_nOpos"]
  71. LAST_STANCE = own["last_stance"]
  72. LAST_GROUND = own["last_ground"]
  73. lastStop = own["lastStop"]
  74. LAST_LEFT = own["LAST_LEFT"]
  75. last_trick_string = dict.get('last_trick_sting')
  76. lasta = own["lasta"]
  77. lastx = own["lastx"]
  78. lastaf = own["lastaf"]
  79. lastxf = own["lastxf"]
  80. lgf = own['last_grind_frame']
  81. frame = own['framenum']
  82. frames_since_grinding = frame - lgf
  83. own['last_footplant'] = own['footplant_on']
  84. lastaBut_ground = own['lastaBut_ground']
  85. lastxBut_ground = own['lastxBut_ground']
  86. aBut_ground = own['aBut_ground']
  87. xBut_ground = own['xBut_ground']
  88. own['last_manual_v2'] = own['manual_v2']
  89. #current frame stuff
  90. GRAB_ON = own["GRAB_ON"]
  91. pumpon = own["Pump"]
  92. vib_countdown = own["vib_Countdown"]
  93. grindold = own['grindOld']
  94. #grindHit = own["LAST_GRIND"]
  95. LAST_GRIND = own["LAST_GRIND"]
  96. #grindTouch = cont.sensors['grindCol']
  97. grindTouch = cont.sensors['grindCol_bottom']
  98. touched = grindTouch.triggered
  99. leftgrabon = own["Leftgrabon"]
  100. rightgrabon = own["Rightgrabon"]
  101. linvel = own.getLinearVelocity
  102. zvel = own.worldLinearVelocity.z
  103. own["Zvel"] = zvel
  104. r_ground = cont.sensors["r_Ground"]
  105. trigger = r_ground.triggered
  106. STANCE = own["stance"]
  107. motion = cont.actuators['MotionPump']
  108. linVelocity = own.getLinearVelocity(True)
  109. countdown = own['countdown']
  110. jump_timer = own['jump_timer']
  111. pos = own.localPosition
  112. rot = own.getAxisVect( [0.0, 0.0, 1.0])
  113. gray = cont.sensors["gRay"]
  114. #airconst = cont.actuators["airConst"]
  115. pop = cont.actuators["pop"]
  116. grindHit = own["grindHit"]
  117. grindCement = cont.actuators["grind_cement"]
  118. grindRail = cont.actuators["grind_rail"]
  119. grindSound = own["grindSound"]
  120. skater = scene.objects["Char4"]
  121. deck = scene.objects["deck"]
  122. trucks = scene.objects["trucks"]
  123. wheel1 = scene.objects["rollen.000"]
  124. wheel2 = scene.objects["rollen.001"]
  125. wheel3 = scene.objects["rollen.002"]
  126. wheel4 = scene.objects["rollen.003"]
  127. turnsens = .04
  128. turnsens2 = .06 #air_turn_boost
  129. grindDar = own["grindDar_hit"]
  130. grindEmpty = scene.objects["grindEmpty"]
  131. grindDar2 = grindEmpty.sensors["grindDar2"]
  132. #invertCol = cont.sensors["invertCol"]
  133. cam = scene.objects["Camera.003"]
  134. freecam = scene.objects["freecam"]
  135. followcam = scene.objects["followcam"]
  136. coping_on = own["coping"]
  137. invert_on = own['invert_on']
  138. grab_type = own['grab_type']
  139. c_ground = cont.sensors['c_ground']
  140. #
  141. control_bottom = scene.objects['control_bottom']
  142. invertTouch = control_bottom.sensors['grindCol_bottom']
  143. wallride = own["wallride"]
  144. wallride_col = cont.sensors['wallride']
  145. wallrideL = cont.sensors['wallrideL']
  146. wallrideR = cont.sensors['wallrideR']
  147. wallrideconstL = cont.actuators['wallrideconstL']
  148. wallrideconstR = cont.actuators['wallrideconstR']
  149. if r_ground.triggered: own['wallride_off'] = 0
  150. own['pop_sound'] = 0
  151. own['land_sound'] = 0
  152. #own['fall'] = 0
  153. #joystick location timers
  154. q1oncd = own["Q1oncd"]
  155. q2oncd = own["Q2oncd"]
  156. q3oncd = own["Q3oncd"]
  157. q4oncd = own["Q4oncd"]
  158. q5oncd = own["Q5oncd"]
  159. q6oncd = own["Q6oncd"]
  160. q7oncd = own["Q7oncd"]
  161. q8oncd = own["Q8oncd"]
  162. q1oncdl = own["Q1oncdl"]
  163. q2oncdl = own["Q2oncdl"]
  164. q3oncdl = own["Q3oncdl"]
  165. q4oncdl = own["Q4oncdl"]
  166. q5oncdl = own["Q5oncdl"]
  167. q6oncdl = own["Q6oncdl"]
  168. q7oncdl = own["Q7oncdl"]
  169. q8oncdl = own["Q8oncdl"]
  170. #setable
  171. grablay = 600 #this plus 1
  172. fliplay = 470
  173. MAX_VEL = 6.7
  174. SPEEDUP = .055
  175. SPEEDPUMP = .12 #.09
  176. SPEEDPUMPFAST = .14 #.13
  177. PUMP_SPEED_SENS = .4
  178. PUMP_SENS = .98
  179. ACCEL = 10
  180. CRUISE = 9
  181. COUNTDOWN = 20 #pump and speed stuff
  182. JUMPHEIGHT = 800 #775#750
  183. JUMPSTRENGTH = 0
  184. own['flip_manual_stance'] = 0
  185. #CAVEMAN_SPEED = .75
  186. LAND_LAYER = 100
  187. LAND_END = 20
  188. lLR = dict['lLR']
  189. lUD = dict['lUD']
  190. rLR = dict['rLR']
  191. rUD = dict['rUD']
  192. lTrig = dict['lTrig']
  193. rTrig = dict['rTrig']
  194. aBut = dict['aBut']
  195. bBut = dict['bBut']
  196. xBut = dict['xBut']
  197. yBut = dict['yBut']
  198. lBump = dict['lBump']
  199. rBump = dict['rBump']
  200. bkBut = dict['bkBut']
  201. stBut = dict['stBut']
  202. xbBut = dict['xbBut']
  203. ltsBut = dict['ltsBut']
  204. rtsBut = dict['rtsBut']
  205. ldPad = dict['ldPad']
  206. rdPad = dict['rdPad']
  207. udPad = dict['udPad']
  208. ddPad = dict['ddPad']
  209. #fliptricks after manuals
  210. if (frame - own['last_manual_frame']) < 25:
  211. flip_start_lay = 8
  212. flipspeed = .4
  213. own['flipspeed'] = .4
  214. own['flip_start_lay'] = 8
  215. #print("chopping flip start")
  216. else:
  217. flip_start_lay = 1
  218. own['flip_start_lay'] = 1
  219. flipspeed = .6
  220. own['flipspeed'] = .6
  221. def printplaying():
  222. splaying_layers = "S: "
  223. playing_layers = "D: "
  224. tplaying_layers = "T: "
  225. for x in range(9900):
  226. if skater.isPlayingAction(x):
  227. #if trucks.isPlayingAction(x):
  228. #if skater.isPlayingAction(x):
  229. splaying_layers += str(x)
  230. splaying_layers += " "
  231. if deck.isPlayingAction(x):
  232. #if trucks.isPlayingAction(x):
  233. #if skater.isPlayingAction(x):
  234. playing_layers += str(x)
  235. playing_layers += " "
  236. if trucks.isPlayingAction(x):
  237. #if trucks.isPlayingAction(x):
  238. #if skater.isPlayingAction(x):
  239. tplaying_layers += str(x)
  240. tplaying_layers += " "
  241. print(splaying_layers, playing_layers, tplaying_layers)
  242. if aBut == True and lasta == False and r_ground.triggered:
  243. aBut_ground = True
  244. own['aBut_ground'] = True
  245. #else:
  246. if aBut == False:
  247. aBut_ground = False
  248. own['aBut_ground'] = False
  249. if xBut == True and lastx == False and r_ground.triggered:
  250. xBut_ground = True
  251. own['xBut_ground'] = True
  252. #else:
  253. if xBut == False:
  254. xBut_ground = False
  255. own['xBut_ground'] = False
  256. def killact(layer):
  257. if skater.isPlayingAction(layer):
  258. skater.stopAction(layer)
  259. if deck.isPlayingAction(layer):
  260. deck.stopAction(layer)
  261. if trucks.isPlayingAction(layer):
  262. trucks.stopAction(layer)
  263. def killall():
  264. for x in range(9000):
  265. skater.stopAction(x)
  266. deck.stopAction(x)
  267. trucks.stopAction(x)
  268. def reset_rtimers():
  269. own["Q1oncd"] = 0
  270. own["Q2oncd"] = 0
  271. own["Q3oncd"] = 0
  272. own["Q4oncd"] = 0
  273. own["Q5oncd"] = 0
  274. own["Q6oncd"] = 0
  275. own["Q7oncd"] = 0
  276. own["Q8oncd"] = 0
  277. q1oncd = 0
  278. q2oncd = 0
  279. q3oncd = 0
  280. q4oncd = 0
  281. q5oncd = 0
  282. q6oncd = 0
  283. q7oncd = 0
  284. q8oncd = 0
  285. def check_fall():
  286. playing_frame = 20
  287. if skater.isPlayingAction(fliplay):
  288. playing_frame = skater.getActionFrame(fliplay)
  289. if r_ground.triggered == True and skater.isPlayingAction(fliplay) and own['jump_timer'] < 40 and playing_frame < 14 and playing_frame > 3:
  290. own['fall'] = 1
  291. print("fall: ", playing_frame, own['jump_timer'])
  292. check_fall()
  293. def check_landing():
  294. lf_ground = own["lF_ground"]
  295. STANCE = own["stance"]
  296. playing_action_frame = skater.getActionFrame(LAND_LAYER)
  297. if lf_ground == False and r_ground.triggered == True:
  298. own['jump_from_trans'] = 0
  299. nearestObject = None
  300. minDist = None
  301. detectedObjects = grindDar2.hitObjectList
  302. if grindDar == 0:
  303. lastheight = own["air_height"]
  304. pos = own.worldPosition.z
  305. dist = lastheight - pos
  306. dist = dist * 2
  307. if dist > 1:
  308. dist = 1
  309. own.actuators["land"].volume = dist
  310. sact = own.actuators["land"]
  311. sact.stopSound()
  312. cont.activate(own.actuators["land"])
  313. own['land_sound'] = 1
  314. if grindDar == 1:
  315. pass
  316. own["vib_Countdown"] = 14
  317. cont.activate(own.actuators["Vibration"])
  318. if own['manual_v2'] == 0 and grindDar == 0:
  319. if STANCE == 0:
  320. own['requestAction'] = 'reg_land'
  321. elif STANCE == 1:
  322. own['requestAction'] = 'fak_land'
  323. killact(2)
  324. killact(3)
  325. killact(4)
  326. killact(5)
  327. lf_ground = r_ground.triggered
  328. own["lF_ground"] = lf_ground
  329. vib_countdown = own["vib_Countdown"]
  330. if vib_countdown > 0:
  331. vib_countdown = vib_countdown - 1
  332. own["vib_Countdown"] = vib_countdown
  333. if vib_countdown == 1:
  334. stopAnims()
  335. stance()
  336. #air anim
  337. if r_ground.triggered == False:
  338. if STANCE == 0:
  339. own['requestAction'] = 'reg_air'
  340. if STANCE == 1:
  341. own['requestAction'] = 'fak_air'
  342. else:
  343. if STANCE == 0:
  344. own['requestAction'] = 'reg_roll'
  345. if STANCE == 1:
  346. own['requestAction'] = 'fak_roll'
  347. #check manual_v2
  348. if (rUD > .03 and rUD < .08) or (rUD < -.03 and rUD > -.08):
  349. #if (rUD > .04 and rUD < .07):
  350. #print("zoned")
  351. timer = own['manual_v2_timer']
  352. timer = timer + 1
  353. if timer > 20:
  354. own['manual_v2'] = 1
  355. own['manual_v2_timer'] = timer
  356. if rUD < .04 and rUD > -.04:
  357. own['manual_v2_timer'] = 0
  358. own['manual_v2'] = 0
  359. own['manual_v2_type'] = None
  360. if own['manual_v2'] == 1:
  361. if own['last_manual_v2'] == 0:
  362. if STANCE == 0:
  363. if rUD > .04 and rUD < .07:
  364. #print("reg manual")
  365. own['manual_v2_type'] = 'reg manual'
  366. own['requestAction'] = 'reg_manual'
  367. if rUD < -.04 and rUD > -.07:
  368. #print("reg nose manual")
  369. own['manual_v2_type'] = 'reg nose manual'
  370. own['requestAction'] = 'reg_nose_manual'
  371. if STANCE == 1:
  372. if rUD > .04 and rUD < .07:
  373. #print("fak manual")
  374. own['manual_v2_type'] = 'fak manual'
  375. own['requestAction'] = 'fak_manual'
  376. if rUD < -.04 and rUD > -.07:
  377. #print("fak nose manual")
  378. own['manual_v2_type'] = 'fak nose manual'
  379. own['requestAction'] = 'fak_nose_manual'
  380. else:
  381. #print("flip stance")
  382. if STANCE == 0:
  383. if own['manual_v2_type'] == 'fak manual':
  384. own['manual_v2_type'] = 'reg nose manual'
  385. if own['manual_v2_type'] == 'fak nose manual':
  386. own['manual_v2_type'] = 'reg manual'
  387. if STANCE == 1:
  388. if own['manual_v2_type'] == 'reg manual':
  389. own['manual_v2_type'] = 'fak nose manual'
  390. if own['manual_v2_type'] == 'reg nose manual':
  391. own['manual_v2_type'] = 'fak manual'
  392. #check manual
  393. ####
  394. #reg
  395. if rUD > .03 and rUD < .08 and STANCE == 0 and rLR < .035 and rLR > -.035:
  396. timer = own["reg_manual_timer"]
  397. timer = timer + 1
  398. own["reg_manual_timer"] = timer
  399. if timer > 20 and rUD < .04:
  400. own["reg_manual"] = 0
  401. #print("reg_man off")
  402. if rUD <= .03 and (STANCE == 1 or STANCE == 0) and rUD >= -.04:
  403. own["reg_manual_timer"] = 0
  404. own["reg_manual"] = 0
  405. #print("reg_man off2")
  406. #####
  407. if own["reg_manual_timer"] > 10 and own["fak_manual"] == 0 and own['reg_nmanual'] == 0:
  408. own["reg_manual"] = 1
  409. ######
  410. if own["reg_manual_timer"] == 0:
  411. own["reg_manual"] = 0
  412. if own['last_reg_manual'] == 1 and own['reg_manual'] == 0:
  413. #killall()
  414. pass
  415. ####
  416. #fak
  417. if rUD > .03 and rUD < .08 and STANCE == 1 and rLR < .035 and rLR > -.035:
  418. timer = own["fak_manual_timer"]
  419. timer = timer + 1
  420. own["fak_manual_timer"] = timer
  421. if timer > 20:
  422. own["fak_manual"] = 0
  423. if rUD <= .03 and (STANCE == 1 or STANCE == 0) and rUD >= -.04:
  424. own["fak_manual_timer"] = 0
  425. own["fak_manual"] = 0
  426. if own["fak_manual_timer"] > 10 and own["reg_manual"] == 0:
  427. own["fak_manual"] = 1
  428. if own["fak_manual_timer"] == 0:
  429. own["fak_manual"] = 0
  430. if own['last_fak_manual'] == 1 and own['fak_manual'] == 0:
  431. #killall()
  432. pass
  433. #print(own["reg_manual"], own["fak_manual"])
  434. #####
  435. #reg nmanual
  436. if rUD < -.03 and rUD > -.08 and STANCE == 0 and rLR < .035 and rLR > -.035:
  437. timer = own["reg_nmanual_timer"]
  438. timer = timer + 1
  439. own["reg_nmanual_timer"] = timer
  440. if timer > 20:
  441. own["reg_nmanual"] = 0
  442. if rUD >= -.03 and (STANCE == 1 or STANCE == 0) and rUD <= .04:
  443. own["reg_nmanual_timer"] = 0
  444. own["reg_nmanual"] = 0
  445. if own["reg_nmanual_timer"] > 10 and own["fak_nmanual"] == 0 and own['reg_manual'] == 0 and own['fak_manual'] == 0:
  446. if own['last_fak_manual'] == False and own['last_reg_manual'] == False and own['last_fak_manual'] == False:
  447. own["reg_nmanual"] = 1
  448. #print("baaad", own['reg_manual'], own['last_reg_manual'])
  449. if own["reg_nmanual_timer"] == 0:
  450. own["reg_nmanual"] = 0
  451. if own['last_reg_nmanual'] == 1 and own['reg_nmanual'] == 0:
  452. pass
  453. #killall()
  454. #####
  455. #fak nmanual
  456. #print (rUD)
  457. if rUD < -.03 and rUD > -.08 and STANCE == 1 and rLR < .035 and rLR > -.035:
  458. timer = own["fak_nmanual_timer"]
  459. timer = timer + 1
  460. own["fak_nmanual_timer"] = timer
  461. if timer > 20:
  462. own["fak_nmanual"] = 0
  463. if rUD >= -.03 and (STANCE == 1 or STANCE == 0) and rUD <= .04:
  464. own["fak_nmanual_timer"] = 0
  465. own["fak_nmanual"] = 0
  466. #print('@@@@@@@@@fak_man_off_1')
  467. if own["fak_nmanual_timer"] > 10 and own["reg_nmanual"] == 0 and own['fak_manual'] == 0 and own ['reg_manual'] == 0:
  468. own["fak_nmanual"] = 1
  469. if own["fak_nmanual_timer"] == 0 and own['reg_manual'] == 0:
  470. #if own['flip_manual_stance'] == 0:
  471. own["fak_nmanual"] = 0
  472. if own['last_fak_nmanual'] == 1 and own['fak_nmanual'] == 0:
  473. pass
  474. def reg_stance_left_off():
  475. LAST_LEFT = own["LAST_LEFT"]
  476. own["LAST_LEFT"] = 0
  477. def reg_stance_right_off():
  478. LAST_RIGHT = own["LAST_RIGHT"]
  479. own["LAST_RIGHT"] = 0
  480. def reg_stance_on():
  481. #revert_timer
  482. playing = deck.isPlayingAction(40)
  483. if own["revert_timer"] < 1 and own['manual_v2'] == 0 and playing == 0:
  484. own['requestAction'] = 'reg_roll'
  485. def reg_stance_off():
  486. killact(2)
  487. def reg_manual_on():
  488. own['requestAction'] = 'reg_manual'
  489. if own["reg_manual_timer"] == 41:
  490. killact(3000)
  491. killact(3001)
  492. killact(3002)
  493. def reg_manual_off():
  494. killact(222)
  495. killact(223)
  496. killact(224)
  497. killact(3000)
  498. killact(3001)
  499. killact(3002)
  500. killact(10)
  501. killact(32)
  502. killact(11)
  503. killact(34)
  504. def fak_manual_on():
  505. #killall()
  506. own['requestAction'] = 'fak_manual'
  507. if own["fak_manual_timer"] == 41:
  508. killact(3000)
  509. killact(3001)
  510. killact(3002)
  511. def fak_manual_off():
  512. killact(222)
  513. killact(223)
  514. killact(224)
  515. killact(3000)
  516. killact(3001)
  517. killact(3002)
  518. killact(10)
  519. killact(32)
  520. killact(11)
  521. killact(34)
  522. #######
  523. #######
  524. #######
  525. #######
  526. def reg_nmanual_on():
  527. own['requestAction'] = 'reg_nmanual'
  528. if own["reg_nmanual_timer"] == 41:
  529. killact(3000)
  530. killact(3001)
  531. killact(3002)
  532. def reg_nmanual_off():
  533. killact(222)
  534. killact(223)
  535. killact(224)
  536. killact(3000)
  537. killact(3001)
  538. killact(3002)
  539. killact(10)
  540. killact(32)
  541. killact(11)
  542. killact(34)
  543. def fak_nmanual_on():
  544. own['requestAction'] = 'fak_nmanual'
  545. if own["fak_nmanual_timer"] == 41:
  546. killact(3000)
  547. killact(3001)
  548. killact(3002)
  549. def fak_nmanual_off():
  550. killact(222)
  551. killact(223)
  552. killact(224)
  553. killact(3000)
  554. killact(3001)
  555. killact(3002)
  556. killact(10)
  557. killact(32)
  558. killact(11)
  559. killact(34)
  560. ###########
  561. def reg_stanceinc_on():
  562. skater.playAction("nreg", 1,60, layer=3, blendin=2, layer_weight=0, play_mode=1, speed=.5)
  563. deck.playAction("a_reg", 1,40, layer=3, blendin=0, blend_mode=0, play_mode=1, speed=.5)
  564. trucks.playAction("a_reg", 1,40, layer=3, blendin=2, layer_weight=0, play_mode=1, speed=.5)
  565. def reg_stanceinc_off():
  566. killact(3)
  567. def reg_stance_left_on():
  568. if own['manual_v2'] == 0 and own["revert_timer"] < 1 and own['gt_cd2'] < 1:
  569. own['requestAction'] = 'reg_turnLeft'
  570. LAST_LEFT = own["LAST_LEFT"]
  571. playing_action_frame = skater.getActionFrame(LAND_LAYER)
  572. if LAST_LEFT == 0 or (playing_action_frame > (LAND_END - 2) and playing_action_frame < (LAND_END - 1)):
  573. LAST_LEFT = 1
  574. own["LAST_LEFT"] = 1
  575. def reg_stance_right_on():
  576. if own['manual_v2'] == 0 and own["revert_timer"] < 1 and own['gt_cd2'] < 1:
  577. own['requestAction'] = 'reg_turnRight'
  578. LAST_RIGHT = own["LAST_RIGHT"]
  579. playing_action_frame = skater.getActionFrame(LAND_LAYER)
  580. if LAST_RIGHT == 0 or (playing_action_frame > (LAND_END - 2) and playing_action_frame < (LAND_END - 1)):
  581. LAST_RIGHT = 1
  582. own["LAST_RIGHT"] = 1
  583. def fak_stance_on():
  584. playing = deck.isPlayingAction(40)
  585. if own['manual_v2'] == 0 and own["revert_timer"] < 1 and playing == 0 and own['gt_cd2'] < 1:
  586. own['requestAction'] = 'fak_roll'
  587. def fak_stance_off():
  588. killact(3)
  589. def fak_stance_left_on():
  590. if own['manual_v2'] == 0 and own["revert_timer"] < 1 and own['gt_cd2'] < 1:
  591. own['requestAction'] = 'fak_turnLeft'
  592. LAST_LEFT_FAK = own["LAST_LEFT_FAK"]
  593. playing_action_frame = skater.getActionFrame(LAND_LAYER)
  594. if LAST_LEFT_FAK == 0 or (playing_action_frame > (LAND_END - 2) and playing_action_frame < (LAND_END - 1)):
  595. LAST_LEFT_FAK = 1
  596. own["LAST_LEFT_FAK"] = 1
  597. def fak_stance_left_off():
  598. killact(12)
  599. killact(36)
  600. LAST_LEFT_FAK = own["LAST_LEFT_FAK"]
  601. own["LAST_LEFT_FAK"] = 0
  602. def fak_stance_right_on():
  603. if own['manual_v2'] == 0 and own["revert_timer"] < 1 and own['gt_cd2'] < 1:
  604. own['requestAction'] = 'fak_turnRight'
  605. LAST_RIGHT_FAK = own["LAST_RIGHT_FAK"]
  606. own["LAST_RIGHT_FAK"] = 1
  607. def fak_stance_right_off():
  608. killact(13)
  609. killact(37)
  610. LAST_RIGHT_FAK = own["LAST_RIGHT_FAK"]
  611. own["LAST_RIGHT_FAK"] = 0
  612. def reg_air_on():
  613. playing = deck.isPlayingAction(fliplay)
  614. if playing == False:
  615. own['requestAction'] = 'reg_air'
  616. def reg_air_off():
  617. killact(4)
  618. def fak_air_on():
  619. flipping = skater.isPlayingAction(fliplay)
  620. if flipping == False:
  621. own['requestAction'] = 'fak_air'
  622. def fak_air_off():
  623. killact(5)
  624. #$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
  625. def stance():
  626. # turnsens = .04
  627. # turnblend = 10
  628. rotation = .96
  629. turnsens = 0.06
  630. if rot.z < .9: inc = 1
  631. else: inc = 0
  632. flipping = skater.isPlayingAction(500)
  633. #print(flipping)
  634. #ground
  635. ground_since = own["framenum"] - own['lF_air_frame']
  636. #if r_ground.triggered == True and grindHit == False and flipping == False and own["wallride"] == None and own['revert_timer'] < 2 and ground_since > 40:
  637. if r_ground.triggered == True and grindHit == False and flipping == False and own["wallride"] == None and own['revert_timer'] < 2:
  638. if STANCE == 0:
  639. reg_manual = own['reg_manual']
  640. fak_manual = own["fak_manual"]
  641. reg_nmanual = own['reg_nmanual']
  642. fak_nmanual = own["fak_nmanual"]
  643. if LAST_STANCE != STANCE or LAST_GROUND != r_ground.triggered:
  644. fak_stance_off()
  645. reg_air_off()
  646. fak_air_off()
  647. if reg_manual == 0 and fak_manual == 0:
  648. last_manual = own['last_reg_manual']
  649. if last_manual == 1:
  650. reg_manual_off()
  651. fak_manual_off()
  652. reg_stance_on()
  653. if own['manual_v2_type'] == 'reg manual':
  654. reg_manual_on()
  655. elif own['manual_v2_type'] == 'reg nose manual':
  656. reg_nmanual_on()
  657. elif own['manual_v2_type'] == 'fak manual':
  658. fak_manual_on()
  659. elif own['manual_v2_type'] == 'fak nose manual':
  660. fak_nmanual_on()
  661. if STANCE == 1:
  662. reg_manual = own['reg_manual']
  663. fak_manual = own["fak_manual"]
  664. reg_nmanual = own['reg_nmanual']
  665. fak_nmanual = own["fak_nmanual"]
  666. if LAST_STANCE != STANCE or LAST_GROUND != r_ground.triggered:
  667. reg_stance_off()
  668. reg_air_off()
  669. fak_air_off
  670. if fak_manual == 0:
  671. last_manual = own['last_fak_manual']
  672. if last_manual == 1:
  673. fak_manual_off()
  674. reg_manual_off()
  675. fak_stance_on()
  676. if own['manual_v2_type'] == 'fak manual':
  677. fak_manual_on()
  678. elif own['manual_v2_type'] == 'fak nose manual':
  679. fak_nmanual_on()
  680. elif own['manual_v2_type'] == 'reg manual':
  681. reg_manual_on()
  682. elif own['manual_v2_type'] == 'reg nose manual':
  683. reg_nmanual_on()
  684. if own["Pump"] == False:
  685. if lLR < -turnsens and STANCE == 0:
  686. reg_stance_left_on()
  687. if lLR > -turnsens or LAST_GRIND != grindHit:
  688. reg_stance_left_off()
  689. if lLR > turnsens and STANCE == 0:
  690. reg_stance_right_on()
  691. if lLR < turnsens or LAST_GRIND != grindHit:
  692. reg_stance_right_off()
  693. if lLR < -turnsens and STANCE == 1:
  694. fak_stance_left_on()
  695. if lLR > -turnsens or LAST_GRIND != grindHit:
  696. fak_stance_left_off()
  697. if lLR > turnsens and STANCE == 1:
  698. fak_stance_right_on()
  699. if lLR < turnsens or LAST_GRIND != grindHit:
  700. fak_stance_right_off()
  701. #air
  702. playing = deck.isPlayingAction(fliplay)
  703. if r_ground.triggered == False and playing == False and flipping == False:
  704. if STANCE == 0:
  705. if LAST_STANCE != STANCE or LAST_GROUND != r_ground.triggered:
  706. fak_air_off()
  707. reg_stance_off()
  708. fak_stance_off()
  709. reg_stance_left_off()
  710. reg_stance_right_off()
  711. fak_stance_left_off()
  712. fak_stance_right_off()
  713. reg_air_on()
  714. if STANCE == 1:
  715. if LAST_STANCE != STANCE or LAST_GROUND != r_ground.triggered:
  716. reg_air_off()
  717. reg_stance_off()
  718. fak_stance_off()
  719. reg_stance_left_off()
  720. reg_stance_right_off()
  721. fak_stance_left_off()
  722. fak_stance_right_off()
  723. fak_air_on()
  724. if grindHit == True:
  725. reg_stance_off()
  726. fak_stance_off()
  727. ###################
  728. #trick definitions#
  729. ###################
  730. def jump():
  731. #print("jump funct")
  732. jump_timer = own['jump_timer']
  733. reg_manual_off()
  734. fak_manual_off()
  735. reg_nmanual_off()
  736. fak_nmanual_off()
  737. cont.deactivate(wallrideconstL)
  738. cont.deactivate(wallrideconstR)
  739. if JUMPSTRENGTH != 0:
  740. height = JUMPSTRENGTH * JUMPHEIGHT
  741. else:
  742. height = JUMPHEIGHT
  743. #if jump_timer == 0:
  744. if jump_timer < 50:
  745. jump_timer = 60
  746. own['jump_timer'] = jump_timer
  747. if zvel < 7 and jump_timer == 60:
  748. cont.activate(own.actuators["pop"])
  749. own['pop_sound'] = 1
  750. print("jump")
  751. #
  752. posx = own.worldPosition[0]
  753. posy = own.worldPosition[1]
  754. posz = own.worldPosition[2]
  755. jumppos = Vector((posx, posy, posz))
  756. own['jumpPos'] = jumppos
  757. force = [ 0.0, 0.0, height]
  758. # use local axis
  759. local = False
  760. # apply force
  761. try:
  762. if 'trans' in r_ground.hitObject:
  763. print('jump from trans')
  764. own['jump_from_trans'] = 1
  765. own['trans_jump_obj'] = r_ground.hitObject
  766. except:
  767. print('trans jump broke')
  768. if grindHit == False:
  769. own.applyForce(force, local)
  770. force2 = [0.0, 0, 150]
  771. own.applyForce(force2, True)
  772. #print("apply jump force1")
  773. if grindHit == True:
  774. linvelloc = own.getLinearVelocity(True)
  775. own.applyForce(force, True)
  776. force2 = [0.0, 0, 150]
  777. own.applyForce(force2, True)
  778. linvelloc2 = own.getLinearVelocity(True)
  779. force = (linvelloc.x, linvelloc.y, linvelloc2.z)
  780. own.setLinearVelocity(force, True)
  781. #print("apply jump force2 grindHit")
  782. own['jump_stance'] = STANCE
  783. if STANCE == True:
  784. own["jump_stance"] = 1
  785. if STANCE == False:
  786. own["jump_stance"] = 0
  787. own["jump_stance"] = own["stance"]
  788. if grindHit == True:
  789. own['grind_jump'] = 1
  790. if lLR > turnsens or lLR < -turnsens or lUD > turnsens or lUD < -turnsens:
  791. own['grindjumpturn'] = True
  792. #print("turn on grindjumpturn")
  793. num = 1
  794. if num ==1:
  795. rString = "R"
  796. lString = "L"
  797. cont.deactivate(wallrideconstL)
  798. cont.deactivate(wallrideconstR)
  799. #print("deactivating constraints")
  800. if own["wallride"] == "R":
  801. force = [0,170,0]
  802. own.applyForce(force, True)
  803. print("****walljumpforce R")
  804. cont.activate(own.actuators["pop2"])
  805. jump_timer = 60
  806. own['jump_timer'] = jump_timer
  807. if own["wallride"] == "L":
  808. force = [0,-170,0] #325
  809. own.applyForce(force, True)
  810. print("****walljumpforce L")
  811. cont.activate(own.actuators["pop2"])
  812. jump_timer = 60
  813. own['jump_timer'] = jump_timer
  814. own["Q1oncd"] = 0
  815. own["Q2oncd"] = 0
  816. own["Q3oncd"] = 0
  817. own["Q4oncd"] = 0
  818. own["Q5oncd"] = 0
  819. own["Q6oncd"] = 0
  820. own["Q7oncd"] = 0
  821. own["Q8oncd"] = 0
  822. if own['jump_timer'] == 60:
  823. own['jump_timer'] = 59
  824. def jump_Timer():
  825. jump_timer = own['jump_timer']
  826. if jump_timer > 0:
  827. jump_timer = jump_timer - 1
  828. own['jump_timer'] = jump_timer
  829. if own['grindjumpturn'] == True:
  830. jump_timer = 30
  831. own['jump_timer'] = jump_timer
  832. def pump():
  833. velocity = own['velocity']
  834. #regular
  835. local = True
  836. downforce = -.1
  837. lF_air_frame = own['lF_air_frame']
  838. frames_since_ground = own['framenum'] - own['lF_air_frame']
  839. if linVelocity.x < MAX_VEL and linVelocity.x >= -0 and STANCE == 1 and grindHit == False and frames_since_ground > 10:
  840. countdown = COUNTDOWN
  841. yvel = linVelocity.x + SPEEDPUMP
  842. yvel2 = linVelocity.x + SPEEDPUMPFAST
  843. own['countdown'] = countdown
  844. force = [(yvel), 0, linVelocity.z + downforce]
  845. force2 = [(yvel2), 0, linVelocity.z + downforce]
  846. if rot.z < PUMP_SENS and rot.z > PUMP_SPEED_SENS:
  847. own.setLinearVelocity(force, local)
  848. if rot.z < PUMP_SENS and rot.z <= PUMP_SPEED_SENS:
  849. own.setLinearVelocity(force2, local)
  850. own['requestAction'] = 'fak_pump'
  851. #switch
  852. if linVelocity.x > -MAX_VEL and linVelocity.x <= 0 and STANCE == 0 and grindHit == False and frames_since_ground > 10:
  853. countdown = COUNTDOWN
  854. yvel = linVelocity.x - SPEEDPUMP
  855. yvel2 = linVelocity.x - SPEEDPUMPFAST
  856. own['countdown'] = countdown
  857. force = [(yvel), 0, linVelocity.z + downforce]
  858. force2 = [(yvel2), 0, linVelocity.z + downforce]
  859. if rot.z < PUMP_SENS and rot.z > PUMP_SPEED_SENS:
  860. own.setLinearVelocity(force, local)
  861. if rot.z < PUMP_SENS and rot.z <= PUMP_SPEED_SENS:
  862. own.setLinearVelocity(force2, local)
  863. own['requestAction'] = 'reg_pump'
  864. own["Pump"] = True
  865. own["lastPump"] = True
  866. def roll():
  867. if r_ground.triggered == 1:
  868. pass
  869. def stop():
  870. if linVelocity.x < .05 and linVelocity.x > -.05:
  871. can_stop = 0
  872. own["lastStop"] = True
  873. else:
  874. can_stop = 1
  875. if r_ground.triggered == 1 and STANCE == False and can_stop == 1:
  876. own['requestAction'] = 'reg_stop'
  877. yvel = linVelocity.x * .985
  878. force = [(yvel), 0, linVelocity.z]
  879. own.setLinearVelocity(force, True)
  880. elif r_ground.triggered == 1 and STANCE == True and can_stop == 1:
  881. own['requestAction'] = 'fak_stop'
  882. yvel = linVelocity.x * .985
  883. force = [(yvel), 0, linVelocity.z]
  884. own.setLinearVelocity(force, True)
  885. if linVelocity.x < .05 and linVelocity.x > -.05 and own["lastStop"] == True:
  886. own["lastStop"] == False
  887. def oposin():
  888. if skater.isPlayingAction(30) or skater.isPlayingAction(31):
  889. landing = 1
  890. else:
  891. landing = 0
  892. if (r_ground.triggered == 1) and STANCE == False and landing == 0 and own['manual'] == 0:
  893. if grindold == 0:
  894. own['requestAction'] = 'reg_opos'
  895. elif (r_ground.triggered == 1) and STANCE == True and own['manual'] == 0:
  896. if grindold == 0:
  897. own['requestAction'] = 'fak_opos'
  898. else:
  899. killact(65)
  900. killact(66)
  901. killact(67)
  902. killact(68)
  903. own["last_Opos"] = True
  904. def noposin():
  905. if skater.isPlayingAction(30) or skater.isPlayingAction(31):
  906. landing = 1
  907. else:
  908. landing = 0
  909. if (r_ground.triggered == 1) and STANCE == False and landing == 0 and own['manual'] == 0:
  910. if grindold == 0:
  911. own['requestAction'] = 'reg_nopos'
  912. elif (r_ground.triggered == 1) and STANCE == True and own['manual'] == 0:
  913. if grindold == 0:
  914. own['requestAction'] = 'fak_nopos'
  915. else:
  916. killact(71)
  917. killact(72)
  918. killact(73)
  919. killact(74)
  920. own["last_nOpos"] = True
  921. def aollie():
  922. print("ollie")
  923. dict['trick_string'] = 'Ollie'
  924. r_ground = cont.sensors["r_Ground"]
  925. trigger = r_ground.triggered
  926. STANCE = own["stance"]
  927. wallride = own["wallride"]
  928. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  929. own["wallride_off"] = 1
  930. own['requestAction'] = 'reg_ollie'
  931. jump()
  932. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  933. own["wallride_off"] = 1
  934. own['requestAction'] = 'fak_ollie'
  935. jump()
  936. def nollie():
  937. print("nollie")
  938. dict['trick_string'] = 'Nollie'
  939. r_ground = cont.sensors["r_Ground"]
  940. trigger = r_ground.triggered
  941. STANCE = own["stance"]
  942. if (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  943. own['requestAction'] = 'fak_nollie'
  944. own["wallride_off"] = 1
  945. jump()
  946. elif (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  947. own["wallride_off"] = 1
  948. own['requestAction'] = 'reg_nollie'
  949. jump()
  950. def kickflip():
  951. print("kickflip")
  952. dict['trick_string'] = 'Kickflip'
  953. STANCE = own["stance"]
  954. print(flip_start_lay)
  955. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  956. own["wallride_off"] = 1
  957. own['requestAction'] = 'reg_kickflip'
  958. jump()
  959. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  960. own["wallride_off"] = 1
  961. own['requestAction'] = 'fak_kickflip'
  962. jump()
  963. if own["wallride"] !=1: jump()
  964. if r_ground.triggered == 0 and STANCE == False:
  965. own["wallride_off"] = 1
  966. own['requestAction'] = 'reg_kickflip'
  967. if own["wallride"] != None:
  968. jump()
  969. elif r_ground.triggered == 0 and STANCE == True:
  970. own["wallride_off"] = 1
  971. own['requestAction'] = 'fak_kickflip'
  972. if own["wallride"] != None:
  973. jump()
  974. def varial_kickflip():
  975. print("varial kickflip")
  976. dict['trick_string'] = 'Varial Kickflip'
  977. STANCE = own["stance"]
  978. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  979. own["wallride_off"] = 1
  980. own['requestAction'] = 'reg_varial_kickflip'
  981. jump()
  982. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  983. own["wallride_off"] = 1
  984. own['requestAction'] = 'fak_varial_kickflip'
  985. jump()
  986. if r_ground.triggered == 0 and STANCE == False:
  987. own["wallride_off"] = 1
  988. if own["wallride"] != None:
  989. jump()
  990. elif r_ground.triggered == 0 and STANCE == True:
  991. own["wallride_off"] = 1
  992. if own["wallride"] != None:
  993. jump()
  994. def nollie_varial_kickflip():
  995. print("nollie varial kickflip")
  996. dict['trick_string'] = 'Nollie Varial Kickflip'
  997. STANCE = own["stance"]
  998. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  999. own["wallride_off"] = 1
  1000. own['requestAction'] = 'reg_nollie_varial_kickflip'
  1001. jump()
  1002. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1003. own["wallride_off"] = 1
  1004. own['requestAction'] = 'fak_nollie_varial_kickflip'
  1005. jump()
  1006. if r_ground.triggered == 0 and STANCE == False:
  1007. own["wallride_off"] = 1
  1008. if own["wallride"] != None:
  1009. jump()
  1010. elif r_ground.triggered == 0 and STANCE == True:
  1011. own["wallride_off"] = 1
  1012. if own["wallride"] != None:
  1013. jump()
  1014. def nollie_varial_heelflip():
  1015. print("nollie varial heelflip")
  1016. dict['trick_string'] = 'Nollie Varial Heelflip'
  1017. STANCE = own["stance"]
  1018. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1019. own["wallride_off"] = 1
  1020. own['requestAction'] = 'reg_nollie_varial_heelflip'
  1021. jump()
  1022. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1023. own["wallride_off"] = 1
  1024. own['requestAction'] = 'fak_nollie_varial_heelflip'
  1025. jump()
  1026. if r_ground.triggered == 0 and STANCE == False:
  1027. own["wallride_off"] = 1
  1028. if own["wallride"] != None:
  1029. jump()
  1030. elif r_ground.triggered == 0 and STANCE == True:
  1031. own["wallride_off"] = 1
  1032. if own["wallride"] != None:
  1033. jump()
  1034. def varial_heelflip():
  1035. print("varial heelflip")
  1036. dict['trick_string'] = 'Varial Heelflip'
  1037. STANCE = own["stance"]
  1038. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1039. own["wallride_off"] = 1
  1040. own['requestAction'] = 'reg_varial_heelflip'
  1041. jump()
  1042. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1043. own["wallride_off"] = 1
  1044. own['requestAction'] = 'fak_varial_heelflip'
  1045. jump()
  1046. if r_ground.triggered == 0 and STANCE == False:
  1047. own["wallride_off"] = 1
  1048. if own["wallride"] != None:
  1049. jump()
  1050. elif r_ground.triggered == 0 and STANCE == True:
  1051. own["wallride_off"] = 1
  1052. if own["wallride"] != None:
  1053. jump()
  1054. def nollie_kickflip():
  1055. print("kickflip")
  1056. STANCE = own["stance"]
  1057. dict['trick_string'] = 'Nollie Kickflip'
  1058. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1059. own["wallride_off"] = 1
  1060. own['requestAction'] = 'reg_nollie_kickflip'
  1061. jump()
  1062. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1063. own["wallride_off"] = 1
  1064. own['requestAction'] = 'fak_nollie_kickflip'
  1065. jump()
  1066. if r_ground.triggered == 0 and STANCE == False:
  1067. own["wallride_off"] = 1
  1068. if own["wallride"] != None:
  1069. print("wall out trick")
  1070. #jump()
  1071. elif r_ground.triggered == 0 and STANCE == True:
  1072. own["wallride_off"] = 1
  1073. if own["wallride"] != None:
  1074. print("wall out trick")
  1075. #jump()
  1076. def heelflip():
  1077. print("heelflip")
  1078. dict['trick_string'] = 'Heelflip'
  1079. STANCE = own["stance"]
  1080. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1081. own["wallride_off"] = 1
  1082. own['requestAction'] = 'reg_heelflip'
  1083. jump()
  1084. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1085. own["wallride_off"] = 1
  1086. own['requestAction'] = 'fak_heelflip'
  1087. jump()
  1088. if r_ground.triggered == 0 and STANCE == False:
  1089. own["wallride_off"] = 1
  1090. if own["wallride"] != None:
  1091. print("wall out trick")
  1092. #jump()
  1093. elif r_ground.triggered == 0 and STANCE == True:
  1094. own["wallride_off"] = 1
  1095. if own["wallride"] != None:
  1096. print("wall out trick")
  1097. #jump()
  1098. def nollie_heelflip():
  1099. print("heelflip")
  1100. dict['trick_string'] = 'Nollie Heelflip'
  1101. STANCE = own["stance"]
  1102. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1103. own["wallride_off"] = 1
  1104. own['requestAction'] = 'reg_nollie_heelflip'
  1105. jump()
  1106. elif (r_ground.triggered == 1 and STANCE == True) or (grindHit == True and STANCE == True):
  1107. own["wallride_off"] = 1
  1108. own['requestAction'] = 'fak_nollie_heelflip'
  1109. jump()
  1110. if r_ground.triggered == 0 and STANCE == False:
  1111. own["wallride_off"] = 1
  1112. if own["wallride"] != None:
  1113. jump()
  1114. elif r_ground.triggered == 0 and STANCE == True:
  1115. own["wallride_off"] = 1
  1116. if own["wallride"] != None:
  1117. jump()
  1118. def shovit():
  1119. print("shovit")
  1120. dict['trick_string'] = 'Shovit'
  1121. STANCE = own["stance"]
  1122. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1123. own["wallride_off"] = 1
  1124. own['requestAction'] = 'reg_shovit'
  1125. jump()
  1126. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1127. own["wallride_off"] = 1
  1128. own['requestAction'] = 'fak_shovit'
  1129. jump()
  1130. if r_ground.triggered == 0 and STANCE == False:
  1131. if own["wallride"] != None:
  1132. jump()
  1133. elif r_ground.triggered == 0 and STANCE == True:
  1134. own["wallride_off"] = 1
  1135. if own["wallride"] != None:
  1136. jump()
  1137. def shovit360():
  1138. print("360shovit")
  1139. dict['trick_string'] = '360 Shovit'
  1140. STANCE = own["stance"]
  1141. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1142. own["wallride_off"] = 1
  1143. own['requestAction'] = 'reg_shovit360'
  1144. jump()
  1145. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1146. own["wallride_off"] = 1
  1147. own['requestAction'] = 'fak_shovit360'
  1148. jump()
  1149. if r_ground.triggered == 0 and STANCE == False:
  1150. own["wallride_off"] = 1
  1151. if own["wallride"] != None:
  1152. jump()
  1153. elif r_ground.triggered == 0 and STANCE == True:
  1154. own["wallride_off"] = 1
  1155. if own["wallride"] != None:
  1156. jump()
  1157. def fsshovit360():
  1158. print("360shovit")
  1159. dict['trick_string'] = '360 Shovit'
  1160. STANCE = own["stance"]
  1161. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1162. own["wallride_off"] = 1
  1163. own['requestAction'] = 'reg_fsshovit360'
  1164. jump()
  1165. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1166. own["wallride_off"] = 1
  1167. own['requestAction'] = 'fak_fsshovit360'
  1168. jump()
  1169. if r_ground.triggered == 0 and STANCE == False:
  1170. own["wallride_off"] = 1
  1171. if own["wallride"] != None:
  1172. jump()
  1173. elif r_ground.triggered == 0 and STANCE == True:
  1174. own["wallride_off"] = 1
  1175. if own["wallride"] != None:
  1176. jump()
  1177. def nollie_shovit():
  1178. print("shovit")
  1179. dict['trick_string'] = 'Nollie Shovit'
  1180. STANCE = own["stance"]
  1181. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1182. own["wallride_off"] = 1
  1183. own['requestAction'] = 'reg_nollie_shovit'
  1184. jump()
  1185. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1186. own["wallride_off"] = 1
  1187. own['requestAction'] = 'fak_nollie_shovit'
  1188. jump()
  1189. if r_ground.triggered == 0 and STANCE == False:
  1190. own["wallride_off"] = 1
  1191. if own["wallride"] != None:
  1192. jump()
  1193. elif r_ground.triggered == 0 and STANCE == True:
  1194. own["wallride_off"] = 1
  1195. if own["wallride"] != None:
  1196. jump()
  1197. def fsshovit():
  1198. dict['trick_string'] = 'Frontside Shovit'
  1199. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1200. own["wallride_off"] = 1
  1201. own['requestAction'] = 'reg_fsshovit'
  1202. jump()
  1203. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1204. own["wallride_off"] = 1
  1205. own['requestAction'] = 'fak_fsshovit'
  1206. jump()
  1207. if r_ground.triggered == 0 and STANCE == False:
  1208. own["wallride_off"] = 1
  1209. if own["wallride"] != None:
  1210. jump()
  1211. elif r_ground.triggered == 0 and STANCE == True:
  1212. own["wallride_off"] = 1
  1213. if own["wallride"] != None:
  1214. jump()
  1215. def nollie_fsshovit():
  1216. dict['trick_string'] = 'Nollie Frontside Shovit'
  1217. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1218. own["wallride_off"] = 1
  1219. own['requestAction'] = 'reg_nollie_fsshovit'
  1220. jump()
  1221. elif (r_ground.triggered == 1 and STANCE == True) or (grindHit == True and STANCE == True):
  1222. own["wallride_off"] = 1
  1223. own['requestAction'] = 'fak_nollie_fsshovit'
  1224. jump()
  1225. if r_ground.triggered == 0 and STANCE == False:
  1226. own["wallride_off"] = 1
  1227. if own["wallride"] != None:
  1228. jump()
  1229. elif r_ground.triggered == 0 and STANCE == True:
  1230. own["wallride_off"] = 1
  1231. if own["wallride"] != None:
  1232. jump()
  1233. #nollie_shovit360()
  1234. def nollie_shovit360():
  1235. dict['trick_string'] = 'Nollie Frontside Shovit 360'
  1236. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1237. own["wallride_off"] = 1
  1238. own['requestAction'] = 'reg_nollie_shovit360'
  1239. jump()
  1240. elif (r_ground.triggered == 1 and STANCE == True) or (grindHit == True and STANCE == True):
  1241. own["wallride_off"] = 1
  1242. own['requestAction'] = 'fak_nollie_shovit360'
  1243. jump()
  1244. if r_ground.triggered == 0 and STANCE == False:
  1245. own["wallride_off"] = 1
  1246. if own["wallride"] != None:
  1247. jump()
  1248. elif r_ground.triggered == 0 and STANCE == True:
  1249. own["wallride_off"] = 1
  1250. if own["wallride"] != None:
  1251. jump()
  1252. #nollie_fsshovit360()
  1253. def nollie_fsshovit360():
  1254. dict['trick_string'] = 'Nollie Frontside Shovit'
  1255. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1256. own["wallride_off"] = 1
  1257. own['requestAction'] = 'reg_nollie_fsshovit'
  1258. jump()
  1259. elif (r_ground.triggered == 1 and STANCE == True) or (grindHit == True and STANCE == True):
  1260. own["wallride_off"] = 1
  1261. own['requestAction'] = 'fak_nollie_fsshovit'
  1262. jump()
  1263. if r_ground.triggered == 0 and STANCE == False:
  1264. own["wallride_off"] = 1
  1265. if own["wallride"] != None:
  1266. jump()
  1267. elif r_ground.triggered == 0 and STANCE == True:
  1268. own["wallride_off"] = 1
  1269. if own["wallride"] != None:
  1270. jump()
  1271. def frontside_grab_on():
  1272. GRAB_PLAYED = own["GRAB_PLAYED"]
  1273. GRAB_ON = own["GRAB_ON"]
  1274. dict['trick_string'] = 'Mute Grab'
  1275. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1276. own['requestAction'] = 'frontside_grab'
  1277. #skater.playAction("reg_fg", 10,30, layer=400, priority=5, play_mode=1, speed=.5)
  1278. grablay2 = grablay + 1
  1279. GRAB_PLAYED = True
  1280. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1281. elif r_ground.triggered == 1:
  1282. killact(400)
  1283. killact(401)
  1284. def backside_grab_on():
  1285. GRAB_PLAYED = own["GRAB_PLAYED"]
  1286. GRAB_ON = own["GRAB_ON"]
  1287. if GRAB_ON == True and r_ground.triggered == 0 and aBut == True:
  1288. own['requestAction'] = 'reg_fp_rback'
  1289. #skater.playAction("reg_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  1290. #deck.playAction("a_reg_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  1291. #trucks.playAction("a_reg_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  1292. elif GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1293. own['requestAction'] = 'backside_grab'
  1294. GRAB_PLAYED = True
  1295. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1296. elif r_ground.triggered == 1:
  1297. killact(402)
  1298. def fakfrontside_grab_on():
  1299. GRAB_PLAYED = own["GRAB_PLAYED"]
  1300. GRAB_ON = own["GRAB_ON"]
  1301. if GRAB_ON == True and r_ground.triggered == 0 and aBut == True:
  1302. own['requestAction'] = 'fak_fp_rback'
  1303. #skater.playAction("fak_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  1304. #deck.playAction("a_fak_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  1305. #trucks.playAction("a_fak_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  1306. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1307. own['requestAction'] = 'fak_frontside_grab'
  1308. GRAB_PLAYED = True
  1309. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1310. elif r_ground.triggered == 1:
  1311. killact(403)
  1312. def fakbackside_grab_on():
  1313. GRAB_PLAYED = own["GRAB_PLAYED"]
  1314. GRAB_ON = own["GRAB_ON"]
  1315. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1316. own['requestAction'] = 'fak_backside_grab'
  1317. GRAB_PLAYED = True
  1318. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1319. elif r_ground.triggered == 1:
  1320. killact(404)
  1321. #nose/tail grabs
  1322. def frontside_nose_grab_on():
  1323. GRAB_PLAYED = own["GRAB_PLAYED"]
  1324. GRAB_ON = own["GRAB_ON"]
  1325. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1326. own['requestAction'] = 'frontside_nose_grab'
  1327. GRAB_PLAYED = True
  1328. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1329. elif r_ground.triggered == 1:
  1330. killact(400)
  1331. print("frontside nosegrab on")
  1332. def frontside_tail_grab_on():
  1333. GRAB_PLAYED = own["GRAB_PLAYED"]
  1334. GRAB_ON = own["GRAB_ON"]
  1335. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1336. own['requestAction'] = 'frontside_tail_grab'
  1337. GRAB_PLAYED = True
  1338. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1339. elif r_ground.triggered == 1:
  1340. killact(400)
  1341. print("frontside tailgrab on")
  1342. def backside_nose_grab_on():
  1343. GRAB_PLAYED = own["GRAB_PLAYED"]
  1344. GRAB_ON = own["GRAB_ON"]
  1345. #airwalk
  1346. if GRAB_ON == True and r_ground.triggered == 0 and (aBut == True):
  1347. print("airwalk")
  1348. skater.playAction("reg_airwalk", 10,30, layer=405, priority=5, blendin=5, play_mode=1, speed=.5)
  1349. deck.playAction("a_reg_airwalk", 10,30, layer=405, priority=5, blendin=5, play_mode=1, speed=.5)
  1350. trucks.playAction("a_reg_airwalk", 10,30, layer=405, priority=5, blendin=5, play_mode=1, speed=.5)
  1351. #norm
  1352. elif GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1353. own['requestAction'] = 'backside_nose_grab'
  1354. GRAB_PLAYED = True
  1355. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1356. elif r_ground.triggered == 1:
  1357. killact(405)
  1358. print("backside nosegrab on")
  1359. def backside_tail_grab_on():
  1360. GRAB_PLAYED = own["GRAB_PLAYED"]
  1361. GRAB_ON = own["GRAB_ON"]
  1362. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1363. own['requestAction'] = 'backside_tail_grab'
  1364. GRAB_PLAYED = True
  1365. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1366. elif r_ground.triggered == 1:
  1367. killact(411)
  1368. print("backside tailgrab on")
  1369. #switch
  1370. def fak_frontside_nose_grab_on():
  1371. GRAB_PLAYED = own["GRAB_PLAYED"]
  1372. GRAB_ON = own["GRAB_ON"]
  1373. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1374. own['requestAction'] = 'fak_frontside_nose_grab'
  1375. GRAB_PLAYED = True
  1376. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1377. elif r_ground.triggered == 1:
  1378. killact(406)
  1379. print("fak frontside nosegrab on")
  1380. def fak_frontside_tail_grab_on():
  1381. GRAB_PLAYED = own["GRAB_PLAYED"]
  1382. GRAB_ON = own["GRAB_ON"]
  1383. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1384. own['requestAction'] = 'fak_frontside_tail_grab'
  1385. GRAB_PLAYED = True
  1386. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1387. elif r_ground.triggered == 1:
  1388. killact(412)
  1389. print("fak frontside tailgrab on")
  1390. def fak_backside_nose_grab_on():
  1391. GRAB_PLAYED = own["GRAB_PLAYED"]
  1392. GRAB_ON = own["GRAB_ON"]
  1393. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1394. own['requestAction'] = 'fak_backside_nose_grab'
  1395. GRAB_PLAYED = True
  1396. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1397. elif r_ground.triggered == 1:
  1398. killact(408)
  1399. print("fak backside nosegrab on")
  1400. def fak_backside_tail_grab_on():
  1401. GRAB_PLAYED = own["GRAB_PLAYED"]
  1402. GRAB_ON = own["GRAB_ON"]
  1403. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1404. #cont.activate(fak_backsidegrab)
  1405. own['requestAction'] = 'fak_backside_tail_grab'
  1406. GRAB_PLAYED = True
  1407. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1408. elif r_ground.triggered == 1:
  1409. killact(410)
  1410. print("fak backside tailgrab on")
  1411. #--------------------
  1412. def SWAG():
  1413. if r_ground.triggered == 1:
  1414. SWAG = own["swag"]
  1415. SWAG = own.getLinearVelocity(True)
  1416. SWAG = SWAG[1]
  1417. own["swag"] = SWAG
  1418. #print(SWAG)
  1419. if STANCE == True:
  1420. if SWAG > 1 and SWAG < 2:
  1421. rotation = [ 0.0, 0, (SWAG / 200)]
  1422. own.applyRotation( rotation, True)
  1423. elif SWAG > 2:
  1424. rotation = [ 0.0, 0, (SWAG / 50)]
  1425. own.applyRotation( rotation, True)
  1426. elif SWAG < -1 and SWAG > -2:
  1427. rotation = [ 0.0, 0, (SWAG / 200)]
  1428. own.applyRotation( rotation, True)
  1429. elif SWAG < -2:
  1430. rotation = [ 0.0, 0, (SWAG / 50)]
  1431. own.applyRotation( rotation, True)
  1432. if STANCE == False:
  1433. if SWAG > 1 and SWAG < 2:
  1434. rotation = [ 0.0, 0, (-SWAG / 200)]
  1435. own.applyRotation( rotation, True)
  1436. elif SWAG > 2:
  1437. rotation = [ 0.0, 0, (-SWAG / 50)]
  1438. own.applyRotation( rotation, True)
  1439. elif SWAG < -1 and SWAG > -2:
  1440. rotation = [ 0.0, 0, (-SWAG / 200)]
  1441. own.applyRotation( rotation, True)
  1442. elif SWAG < -2:
  1443. rotation = [ 0.0, 0, (-SWAG / 50)]
  1444. own.applyRotation( rotation, True)
  1445. def air():
  1446. if r_ground.triggered == False and own['airup'] == 0:
  1447. distance = own.getDistanceTo(gray.hitPosition)
  1448. since_grind_buf = 3
  1449. if gray.hitObject != None and grindDar2.triggered == False and (frame - lgf) > since_grind_buf:
  1450. if distance < .5:
  1451. own.alignAxisToVect(gray.hitNormal, 2, .1)
  1452. elif distance >= .5 and distance < 1.75:
  1453. own.alignAxisToVect(gray.hitNormal, 2, .05)
  1454. elif distance >= 1.75:
  1455. own.alignAxisToVect([0.0,0.0,1.0], 2, .03)
  1456. if grindDar2.triggered and (frame - lgf) > since_grind_buf:
  1457. if distance < .5:
  1458. own.alignAxisToVect(gray.hitNormal, 2, .1)
  1459. elif distance >= .5 and distance < 1.75:
  1460. own.alignAxisToVect(gray.hitNormal, 2, .03)
  1461. elif distance >= 1.75:
  1462. own.alignAxisToVect([0.0,0.0,1.0], 2, .03)
  1463. elif r_ground.triggered == True:
  1464. pass
  1465. def stopAnims():
  1466. pass
  1467. def isplaying():
  1468. # for x in range(9000):
  1469. # l1 = deck.isPlayingAction(x)
  1470. # if l1 == True:
  1471. # print(x)
  1472. pass
  1473. def nextframe():
  1474. framenumber = own["framenum"]
  1475. framenumber = framenumber + 1
  1476. if framenumber == 900000:
  1477. framenumber = 0
  1478. own["framenum"] = framenumber
  1479. #print(framenumber)
  1480. def push():
  1481. local = True
  1482. #print("push")
  1483. linVelocity15 = own.linearVelocity
  1484. if linVelocity15.x < MAX_VEL and linVelocity15.x >= -0 and r_ground.triggered == True and own['hippy'] == 0 and own['last_hippy'] == 0 and own['last_footplant'] == False:
  1485. countdown = COUNTDOWN
  1486. yvel = linVelocity15.x + SPEEDUP
  1487. own['countdown'] = countdown
  1488. force = [(yvel), 0, linVelocity15.z]
  1489. own.setLinearVelocity(force, local)
  1490. own['requestAction'] = 'fak_push_goof'
  1491. #switch
  1492. if linVelocity15.x > -MAX_VEL and linVelocity15.x < 0 and r_ground.triggered == True and own['hippy'] == 0 and own['last_hippy'] == 0:
  1493. countdown = COUNTDOWN
  1494. yvel = linVelocity15.x - SPEEDUP
  1495. own['countdown'] = countdown
  1496. force = [(yvel), 0, linVelocity15.z]
  1497. own.setLinearVelocity(force, local)
  1498. own['requestAction'] = 'reg_push'
  1499. def push_goof():
  1500. linVelocity15 = own.linearVelocity
  1501. local = True
  1502. #print("push goof")
  1503. if linVelocity15.x < MAX_VEL and linVelocity15.x >= -0 and r_ground.triggered == True and own['hippy'] == 0 and own['last_hippy'] == 0:
  1504. countdown = COUNTDOWN
  1505. yvel = linVelocity15.x + SPEEDUP
  1506. own['countdown'] = countdown
  1507. force = [(yvel), 0, linVelocity15.z]
  1508. own.setLinearVelocity(force, local)
  1509. own['requestAction'] = 'fak_push'
  1510. #switch
  1511. if linVelocity15.x > -MAX_VEL and linVelocity15.x < 0 and r_ground.triggered == True and own['hippy'] == 0 and own['last_hippy'] == 0:
  1512. countdown = COUNTDOWN
  1513. yvel = linVelocity15.x - SPEEDUP
  1514. own['countdown'] = countdown
  1515. force = [(yvel), 0, linVelocity15.z]
  1516. own.setLinearVelocity(force, local)
  1517. own['requestAction'] = 'reg_push_goof'
  1518. def brfoot():
  1519. lay = grablay + 40
  1520. if STANCE == 0:
  1521. own['requestAction'] = 'reg_brfoot'
  1522. # skater.playAction("brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1523. # deck.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1524. # trucks.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1525. if STANCE == 1:
  1526. own['requestAction'] = 'fak_brfoot'
  1527. # skater.playAction("fak_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1528. # deck.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1529. # trucks.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1530. jump()
  1531. def frfoot():
  1532. lay = grablay + 40
  1533. killact(5)
  1534. if STANCE == 0:
  1535. own['requestAction'] = 'reg_frfoot'
  1536. # skater.playAction("frfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1537. # deck.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1538. # trucks.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1539. if STANCE == 1:
  1540. own['requestAction'] = 'fak_frfoot'
  1541. # skater.playAction("fakbfrfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1542. # deck.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1543. # trucks.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1544. jump()
  1545. def blfoot():
  1546. lay = grablay + 40
  1547. killact(5)
  1548. if STANCE == 0:
  1549. own['requestAction'] = 'reg_blfoot'
  1550. # skater.playAction("blfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1551. # deck.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1552. # trucks.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1553. if STANCE == 1:
  1554. own['requestAction'] = 'fak_blfoot'
  1555. # skater.playAction("fakfrfoot.001", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1556. # deck.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1557. # trucks.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1558. jump()
  1559. def flfoot():
  1560. lay = grablay + 40
  1561. killact(5)
  1562. if STANCE == 0:
  1563. own['requestAction'] = 'reg_flfoot'
  1564. # skater.playAction("flfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1565. # deck.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1566. # trucks.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1567. if STANCE == 1:
  1568. own['requestAction'] = 'fak_flfoot'
  1569. # own['reuqestAction'] = 'fak_flfoot'
  1570. # skater.playAction("fak_flfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1571. # deck.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1572. # trucks.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1573. jump()
  1574. def rollsound():
  1575. #onground
  1576. if r_ground.triggered == 1 and grindDar == 0 and own['invert_on'] == 0:
  1577. num1 = .05
  1578. num2 = .25
  1579. if linVelocity.x <= -num1 and linVelocity.x >= num1:
  1580. own.actuators["sroll"].volume = .0001
  1581. cont.deactivate(own.actuators["sroll"])
  1582. own.actuators["sroll"].stopSound()
  1583. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1584. own.actuators["sroll"].volume = .02
  1585. own.actuators["sroll"].pitch = .65
  1586. num1 = .25
  1587. num2 = .5
  1588. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1589. own.actuators["sroll"].volume = .03
  1590. own.actuators["sroll"].pitch = .7
  1591. num1 = .5
  1592. num2 = .75
  1593. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1594. own.actuators["sroll"].volume = .04
  1595. own.actuators["sroll"].pitch = .75
  1596. num1 = .75
  1597. num2 = 1
  1598. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1599. own.actuators["sroll"].volume = .05
  1600. own.actuators["sroll"].pitch = .8
  1601. num1 = 1
  1602. num2 = 1.5
  1603. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1604. own.actuators["sroll"].volume = .06
  1605. own.actuators["sroll"].pitch = .85
  1606. num1 = 1.5
  1607. num2 = 2
  1608. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1609. own.actuators["sroll"].volume = .07
  1610. own.actuators["sroll"].pitch = .9
  1611. num1 = 2
  1612. num2 = 3
  1613. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1614. own.actuators["sroll"].volume = .08
  1615. own.actuators["sroll"].pitch = .95
  1616. num1 = 3
  1617. num2 = 4
  1618. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1619. own.actuators["sroll"].volume = .09
  1620. own.actuators["sroll"].pitch = 1
  1621. num1 = 4
  1622. num2 = 5
  1623. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1624. own.actuators["sroll"].volume = .11
  1625. own.actuators["sroll"].pitch = 1.05
  1626. num1 = 5
  1627. num2 = 6
  1628. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1629. own.actuators["sroll"].volume = .1
  1630. own.actuators["sroll"].pitch = 1.1
  1631. own.actuators['sroll'].mode = 2
  1632. cont.activate(own.actuators["sroll"])
  1633. if grindDar == 1 or own['invert_on'] == 1:
  1634. own.actuators["sroll"].volume = .0001
  1635. cont.deactivate(own.actuators["sroll"])
  1636. own.actuators["sroll"].stopSound()
  1637. #in air
  1638. if r_ground.triggered == False:
  1639. own.actuators["sroll"].volume = .0001
  1640. cont.deactivate(own.actuators["sroll"])
  1641. own.actuators["sroll"].stopSound()
  1642. act = cont.actuators["sroll"]
  1643. own['sroll_vol'] = act.volume
  1644. own['sroll_pitch'] = act.pitch
  1645. def wheelroll():
  1646. #still
  1647. if linVelocity.x <= -0.05 and linVelocity.x >= 0.05:
  1648. wheel1.stopAction(2)
  1649. wheel2.stopAction(2)
  1650. wheel3.stopAction(2)
  1651. wheel4.stopAction(2)
  1652. #regular
  1653. if linVelocity.x > 0.05 and linVelocity.x < .5:
  1654. wheel2.playAction("roll1.001", 1,20, layer=2, play_mode=0, speed=.25)
  1655. wheel3.playAction("roll2.001", 1,20, layer=2, play_mode=0, speed=.25)
  1656. wheel4.playAction("roll3.001", 1,20, layer=2, play_mode=0, speed=.25)
  1657. wheel1.playAction("roll4.001", 1,20, layer=2, play_mode=0, speed=.25)
  1658. if linVelocity.x > 0.5 and linVelocity.x < 1:
  1659. wheel2.playAction("roll1.001", 1,20, layer=2, play_mode=1, speed=1)
  1660. wheel3.playAction("roll2.001", 1,20, layer=2, play_mode=1, speed=1)
  1661. wheel4.playAction("roll3.001", 1,20, layer=2, play_mode=1, speed=1)
  1662. wheel1.playAction("roll4.001", 1,20, layer=2, play_mode=1, speed=1)
  1663. if linVelocity.x > 1 and linVelocity.x < 4:
  1664. wheel2.playAction("roll1.001", 1,20, layer=2, play_mode=1, speed=1.5)
  1665. wheel3.playAction("roll2.001", 1,20, layer=2, play_mode=1, speed=1.5)
  1666. wheel4.playAction("roll3.001", 1,20, layer=2, play_mode=1, speed=1.5)
  1667. wheel1.playAction("roll4.001", 1,20, layer=2, play_mode=1, speed=1.5)
  1668. if linVelocity.x > 4:
  1669. wheel2.playAction("roll1.001", 1,20, layer=2, play_mode=1, speed=2)
  1670. wheel3.playAction("roll2.001", 1,20, layer=2, play_mode=1, speed=2)
  1671. wheel4.playAction("roll3.001", 1,20, layer=2, play_mode=1, speed=2)
  1672. wheel1.playAction("roll4.001", 1,20, layer=2, play_mode=1, speed=2)
  1673. #switch
  1674. if linVelocity.x < -0.05 and linVelocity.x > -.5:
  1675. wheel2.playAction("roll1.001", 20,1, layer=2, play_mode=0, speed=.25)
  1676. wheel3.playAction("roll2.001", 20,1, layer=2, play_mode=0, speed=.25)
  1677. wheel4.playAction("roll3.001", 20,1, layer=2, play_mode=0, speed=.25)
  1678. wheel1.playAction("roll4.001", 20,1, layer=2, play_mode=0, speed=.25)
  1679. if linVelocity.x < -0.5 and linVelocity.x > -1:
  1680. wheel2.playAction("roll1.001", 20,1, layer=2, play_mode=1, speed=1)
  1681. wheel3.playAction("roll2.001", 20,1, layer=2, play_mode=1, speed=1)
  1682. wheel4.playAction("roll3.001", 20,1, layer=2, play_mode=1, speed=1)
  1683. wheel1.playAction("roll4.001", 20,1, layer=2, play_mode=1, speed=1)
  1684. if linVelocity.x < -1 and linVelocity > -4:
  1685. wheel2.playAction("roll1.001", 20,1, layer=2, play_mode=1, speed=1.5)
  1686. wheel3.playAction("roll2.001", 20,1, layer=2, play_mode=1, speed=1.5)
  1687. wheel4.playAction("roll3.001", 20,1, layer=2, play_mode=1, speed=1.5)
  1688. wheel1.playAction("roll4.001", 20,1, layer=2, play_mode=1, speed=1.5)
  1689. if linVelocity.x < -4:
  1690. wheel2.playAction("roll1.001", 20,1, layer=2, play_mode=1, speed=2)
  1691. wheel3.playAction("roll2.001", 20,1, layer=2, play_mode=1, speed=2)
  1692. wheel4.playAction("roll3.001", 20,1, layer=2, play_mode=1, speed=2)
  1693. wheel1.playAction("roll4.001", 20,1, layer=2, play_mode=1, speed=2)
  1694. def transspeed():
  1695. num1 = .1
  1696. num2 = .4
  1697. speed = 20
  1698. def turn():
  1699. rotamt = .02
  1700. linVelocity2 = own.getLinearVelocity(True)
  1701. speed = .002
  1702. manual = 0
  1703. if own['manual_v2'] == 1:
  1704. manual = 1
  1705. if abs(linVelocity.x) < 2:
  1706. speed = .005
  1707. jumpstance = own['jump_stance']
  1708. if lLR > turnsens or lLR < -turnsens:
  1709. own["turn"] = 1
  1710. else:
  1711. own["turn"] = 0
  1712. if lUD > turnsens or lUD < -turnsens:
  1713. own["turnud"] = 1
  1714. else:
  1715. own["turnud"] = 0
  1716. #light
  1717. #if manual and grindhit = true
  1718. if lLR > turnsens and lLR < (turnsens * 1.3) and (grindHit == False or (manual == 1 and grindHit == True)):
  1719. rotation = [ 0.0, 0.0, (-rotamt)]
  1720. local = False # use world axis
  1721. own.applyRotation( rotation, local)
  1722. if r_ground.triggered == True:
  1723. #print("light turn")
  1724. if STANCE == 0:
  1725. own.setLinearVelocity([linVelocity2.x - speed, linVelocity2.y, linVelocity2.z], 1)
  1726. if STANCE == 1:
  1727. own.setLinearVelocity([linVelocity2.x + speed, linVelocity2.y, linVelocity2.z], 1)
  1728. if lLR < -turnsens and lLR > (turnsens * -1.3) and (grindHit == False or (manual == 1 and grindHit == True)):
  1729. rotation = [ 0.0, 0.0, rotamt]
  1730. local = False # use world axis
  1731. own.applyRotation( rotation, local)
  1732. if r_ground.triggered == True:
  1733. #print("light turn")
  1734. if STANCE == 0:
  1735. own.setLinearVelocity([linVelocity2.x - speed, linVelocity2.y, linVelocity2.z], 1)
  1736. if STANCE == 1:
  1737. own.setLinearVelocity([linVelocity2.x + speed, linVelocity2.y, linVelocity2.z], 1)
  1738. #medium
  1739. if lLR > (turnsens * 1.3) and (grindHit == False or (manual == 1 and grindHit == True)):
  1740. #turn left
  1741. if rot.z < .4:
  1742. rotation = [ 0.0, 0.0, (-rotamt * 5)]
  1743. if rot.z < .6 and rot.z > .4:
  1744. rotation = [ 0.0, 0.0, (-rotamt * 2)]
  1745. else:
  1746. rotation = [ 0.0, 0.0, (-rotamt * 1.6)]
  1747. local = True # use world axis
  1748. own.applyRotation( rotation, local)
  1749. if r_ground.triggered == True:
  1750. #print("med turn")
  1751. if STANCE == 0:
  1752. own.setLinearVelocity([linVelocity2.x - speed, linVelocity2.y, linVelocity2.z], 1)
  1753. if STANCE == 1:
  1754. own.setLinearVelocity([linVelocity2.x + speed, linVelocity2.y, linVelocity2.z], 1)
  1755. if lLR < (-turnsens * 1.3) and (grindHit == False or (manual == 1 and grindHit == True)):
  1756. #turn right
  1757. if rot.z < .4:
  1758. rotation = [ 0.0, 0.0, (rotamt * 5)]
  1759. if rot.z < .6 and rot.z > .4:
  1760. rotation = [ 0.0, 0.0, (rotamt * 2)]
  1761. else:
  1762. rotation = [ 0.0, 0.0, (rotamt * 1.6)]
  1763. local = True # use world axis
  1764. own.applyRotation( rotation, local)
  1765. if r_ground.triggered == True:
  1766. #print("med turn")
  1767. if STANCE == 0:
  1768. own.setLinearVelocity([linVelocity2.x - speed, linVelocity2.y, linVelocity2.z], 1)
  1769. if STANCE == 1:
  1770. own.setLinearVelocity([linVelocity2.x + speed, linVelocity2.y, linVelocity2.z], 1)
  1771. #air
  1772. if r_ground.triggered == False and lLR > turnsens and (grindHit == False or (manual == 1 and grindHit == True)) and own["wallride"] == None:
  1773. rotamt = .07
  1774. if STANCE == 0:
  1775. own.applyRotation([0,0,-rotamt], 1)
  1776. if STANCE == 1:
  1777. own.applyRotation([0,0,-rotamt], 1)
  1778. if r_ground.triggered == False and lLR < -turnsens and (grindHit == False or (manual == 1 and grindHit == True)) and own["wallride"] == None:
  1779. rotamt = .07
  1780. if STANCE == 0:
  1781. own.applyRotation([0,0,rotamt], 1)
  1782. if STANCE == 1:
  1783. own.applyRotation([0,0,rotamt], 1)
  1784. ###########
  1785. def grindsound():
  1786. dropin = own['dropinTimer']
  1787. lif = own['last_invert_frame']
  1788. if grindSound != None and grindHit == True and own['nogrindsound'] == 0:
  1789. if abs(linVelocity.x) > abs(linVelocity.y):
  1790. vel = linVelocity.x
  1791. elif abs(linVelocity.x) < abs(linVelocity.y):
  1792. vel = linVelocity.y
  1793. else:
  1794. vel = 0
  1795. if grindSound == "rail":
  1796. cont.deactivate(own.actuators['grind_cement'])
  1797. num1 = .000
  1798. num2 = .05
  1799. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1800. own.actuators["grind_rail"].volume = .0001
  1801. own.actuators["grind_rail"].pitch = .6
  1802. num1 = .05
  1803. num2 = .25
  1804. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1805. own.actuators["grind_rail"].volume = .05
  1806. own.actuators["grind_rail"].pitch = .7
  1807. num1 = .25
  1808. num2 = .5
  1809. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1810. own.actuators["grind_rail"].volume = .1
  1811. own.actuators["grind_rail"].pitch = .75
  1812. num1 = .5
  1813. num2 = .75
  1814. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1815. own.actuators["grind_rail"].volume = .14
  1816. own.actuators["grind_rail"].pitch = .8
  1817. num1 = .75
  1818. num2 = 1
  1819. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1820. own.actuators["grind_rail"].volume = .17
  1821. own.actuators["grind_rail"].pitch = .85
  1822. num1 = 1
  1823. num2 = 1.25
  1824. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1825. own.actuators["grind_rail"].volume = .18
  1826. own.actuators["grind_rail"].pitch = .9
  1827. num1 = 1.25
  1828. num2 = 2
  1829. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1830. own.actuators["grind_rail"].volume = .19
  1831. own.actuators["grind_rail"].pitch = .95
  1832. num1 = 2
  1833. num2 = 40
  1834. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1835. own.actuators["grind_rail"].volume = .19
  1836. own.actuators["grind_rail"].pitch = 1
  1837. cont.activate(own.actuators['grind_rail'])
  1838. if grindSound == "concrete":
  1839. #play sound
  1840. cont.deactivate(own.actuators['grind_rail'])
  1841. num1 = .000
  1842. num2 = .05
  1843. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1844. own.actuators["grind_cement"].volume = .01
  1845. own.actuators["grind_cement"].pitch = .6
  1846. num1 = .05
  1847. num2 = .25
  1848. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1849. own.actuators["grind_cement"].volume = .05
  1850. own.actuators["grind_cement"].pitch = .7
  1851. num1 = .25
  1852. num2 = .5
  1853. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1854. own.actuators["grind_cement"].volume = .1
  1855. own.actuators["grind_cement"].pitch = .75
  1856. num1 = .5
  1857. num2 = .75
  1858. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1859. own.actuators["grind_cement"].volume = .14
  1860. own.actuators["grind_cement"].pitch = .8
  1861. num1 = .75
  1862. num2 = 1
  1863. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1864. own.actuators["grind_cement"].volume = .17
  1865. own.actuators["grind_cement"].pitch = .85
  1866. num1 = 1
  1867. num2 = 1.25
  1868. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1869. own.actuators["grind_cement"].volume = .18
  1870. own.actuators["grind_cement"].pitch = .9
  1871. num1 = 1.25
  1872. num2 = 2
  1873. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1874. own.actuators["grind_cement"].volume = .19
  1875. own.actuators["grind_cement"].pitch = .95
  1876. num1 = 2
  1877. num2 = 40
  1878. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1879. own.actuators["grind_cement"].volume = .19
  1880. own.actuators["grind_cement"].pitch = 1
  1881. cont.activate(own.actuators['grind_cement'])
  1882. else:
  1883. cont.deactivate(own.actuators['grind_cement'])
  1884. cont.deactivate(own.actuators['grind_rail'])
  1885. def record_grindsound():
  1886. dropin = own['dropinTimer']
  1887. lif = own['last_invert_frame']
  1888. if grindHit == True and dropin == 0 and own['invert_on'] == 0 and own["LAST_GRIND"] == True and own["nogrindsound"] == 0 and (frame - lif > 13):
  1889. if grindSound == "concrete":
  1890. act = own.actuators["grind_cement"]
  1891. own['grindcement_vol'] = act.volume
  1892. own['grindcement_pitch'] = act.pitch
  1893. elif grindSound == "rail":
  1894. act = own.actuators["grind_rail"]
  1895. own['grindrail_vol'] = act.volume
  1896. own['grindrail_pitch'] = act.pitch
  1897. if own["LAST_GRIND"] == False:
  1898. own['grindcement_vol'] = 0
  1899. own['grindcement_pitch'] = 0
  1900. own['grindrail_vol'] = 0
  1901. own['grindrail_pitch'] = 0
  1902. def grind():
  1903. grindsound()
  1904. STANCE = own["stance"]
  1905. jumpstance = own["jump_stance"]
  1906. lif = frame - own['last_invert_frame']
  1907. if own['LAST_GRIND'] == False and grindHit == True:
  1908. own['grindstartFrame'] = own['framenum']
  1909. #print(own['grindstartFrame'])
  1910. if grindHit == True and own['invert_on'] == 0 and own['footplant_on'] == False and own['manual'] == 0 and lif > 40 and own['dropinTimer'] < 30:
  1911. gblend = 1
  1912. if LAST_GRIND == 0:
  1913. gt = own['grindType']
  1914. tempstance = 3
  1915. if jumpstance != 3:
  1916. tempstance = jumpstance
  1917. else:
  1918. tempstance = STANCE
  1919. grindpos = own['grindpos']
  1920. if grindpos == "reg_5050" and own['grindType'] == "empty":
  1921. own['grindType'] = grindpos
  1922. if own['grindType'] == "empty" and grindpos == 'reg_board':
  1923. if STANCE == 0:
  1924. own['grindType'] = "reg_bsboard"
  1925. else:
  1926. own['grindType'] = "fak_bsboard"
  1927. # if jumpstance == 1:
  1928. # own['grindType'] = "fak_bsboard"
  1929. # own["stance"] = True
  1930. # STANCE = True
  1931. # elif jumpstance == 0:
  1932. # own['grindType'] = "reg_bsboard"
  1933. # own["stance"] = False
  1934. # STANCE = False
  1935. # elif jumpstance == 3:
  1936. # if STANCE == True:
  1937. # own['grindType'] = "fak_bsboard"
  1938. # else:
  1939. # own['grindType'] = "reg_bsboard"
  1940. if STANCE == True:
  1941. if own['grindType'] == "reg_bsboard":
  1942. own['grind_stance'] = 0
  1943. own['requestAction'] = 'reg_bsboard'
  1944. elif own['grindType'] == "fak_bsboard":
  1945. own['grind_stance'] = 1
  1946. own['requestAction'] = 'fak_bsboard'
  1947. elif own['grindType'] == "reg_fsboard":
  1948. own['grind_stance'] = 0
  1949. own['requestAction'] = 'reg_fsboard'
  1950. elif own['grindType'] == "reg_tailg":
  1951. own['requestAction'] = 'reg_tailg'
  1952. elif own['grindType'] == "reg_tailgR":
  1953. own['requestAction'] = 'reg_tailgr'
  1954. elif own['grindType'] == "reg_tailgL":
  1955. own['requestAction'] = 'reg_tailgl'
  1956. elif own['grindType'] == "reg_noseg":
  1957. own['requestAction'] = 'reg_noseg'
  1958. elif own['grindType'] == "reg_nosegR":
  1959. own['requestAction'] = 'reg_nosegr'
  1960. elif own['grindType'] == "reg_nosegL":
  1961. own['requestAction'] = 'reg_nosegl'
  1962. elif own['grindType'] == "fak_noseg":
  1963. own['requestAction'] = 'fak_noseg'
  1964. elif own['grindType'] == "fak_nosegR":
  1965. own['requestAction'] = 'fak_nosegr'
  1966. elif own['grindType'] == "fak_nosegL":
  1967. own['requestAction'] = 'fak_nosegl'
  1968. elif own['grindType'] == "fak_tailg":
  1969. own['requestAction'] = 'fak_tailg'
  1970. elif own['grindType'] == "fak_tailgR":
  1971. own['requestAction'] = 'fak_tailgr'
  1972. elif own['grindType'] == "fak_tailgL":
  1973. own['requestAction'] = 'fak_tailgl'
  1974. elif own['grindType'] == "reg_tailslide":
  1975. #own['requestAction'] = 'reg_tailslide'
  1976. own['requestAction'] = 'fak_noseslide'
  1977. own['grind_stance'] = 0
  1978. elif own['grindType'] == "fak_tailslide":
  1979. own['requestAction'] = 'fak_tailslide'
  1980. own['grind_stance'] = 1
  1981. elif own['grindType'] == "reg_noseslide":
  1982. #own['requestAction'] = 'reg_noseslide'
  1983. own['requestAction'] = 'fak_tailslide'
  1984. own['grind_stance'] = 0
  1985. elif own['grindType'] == "fak_noseslide":
  1986. own['requestAction'] = 'fak_noseslide'
  1987. own['grind_stance'] = 1
  1988. # elif own['grindType'] == "nose_stall":
  1989. # own['requestAction'] = 'nose_stall'
  1990. # skater.playAction("fak_nose_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  1991. # deck.playAction("a_fak_nose_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  1992. # trucks.playAction("a_fak_nose_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  1993. # elif own['grindType'] == "tail_stall":
  1994. # own['requestAction'] = 'tail_stall'
  1995. # skater.playAction("fak_tail_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  1996. # deck.playAction("a_fak_tail_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  1997. # trucks.playAction("a_fak_tail_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  1998. else:
  1999. if STANCE == 0:
  2000. own['requestAction'] = 'reg_5050'
  2001. if STANCE == 1:
  2002. own['requestAction'] = 'fak_5050'
  2003. #elif STANCE == False and LAST_GRIND == False:
  2004. elif STANCE == False:
  2005. if own['grindType'] == "reg_bsboard":
  2006. own['grind_stance'] = 0
  2007. own['requestAction'] = 'reg_bsboard'
  2008. elif own['grindType'] == "fak_bsboard":
  2009. own['grind_stance'] = 1
  2010. own['requestAction'] = 'fak_bsboard'
  2011. elif own['grindType'] == "reg_tailg":
  2012. own['grind_stance'] = 0
  2013. own['requestAction'] = 'reg_tailg'
  2014. elif own['grindType'] == "reg_tailgR":
  2015. own['requestAction'] = 'reg_tailgr'
  2016. elif own['grindType'] == "reg_tailgL":
  2017. own['requestAction'] = 'reg_tailgl'
  2018. elif own['grindType'] == "reg_noseg":
  2019. own['requestAction'] = 'reg_noseg'
  2020. elif own['grindType'] == "reg_nosegR":
  2021. own['requestAction'] = 'reg_nosegr'
  2022. elif own['grindType'] == "reg_nosegL":
  2023. own['requestAction'] = 'reg_nosegl'
  2024. elif own['grindType'] == "fak_noseg":
  2025. own['requestAction'] = 'fak_noseg'
  2026. elif own['grindType'] == "fak_nosegR":
  2027. own['requestAction'] = 'fak_nosegr'
  2028. elif own['grindType'] == "fak_nosegL":
  2029. own['requestAction'] = 'fak_nosegl'
  2030. elif own['grindType'] == "fak_tailg":
  2031. own['requestAction'] = 'fak_tailg'
  2032. elif own['grindType'] == "fak_tailgR":
  2033. own['requestAction'] = 'fak_tailgr'
  2034. elif own['grindType'] == "fak_tailgL":
  2035. own['requestAction'] = 'fak_tailgl'
  2036. elif own['grindType'] == "reg_tailslide":
  2037. own['requestAction'] = 'reg_tailslide'
  2038. elif own['grindType'] == "fak_tailslide":
  2039. own['grind_stance'] = 1
  2040. #own['requestAction'] = 'fak_tailslide'
  2041. own['requestAction'] = 'reg_noseslide'
  2042. print('mod slide')
  2043. elif own['grindType'] == "reg_noseslide":
  2044. own['grind_stance'] = 0
  2045. own['requestAction'] = 'reg_noseslide'
  2046. elif own['grindType'] == "fak_noseslide":
  2047. own['grind_stance'] = 1
  2048. #own['requestAction'] = 'fak_noseslide'
  2049. own['requestAction'] = 'reg_tailslide'
  2050. # elif own['grindType'] == "nose_stall":
  2051. # skater.playAction("nose_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2052. # deck.playAction("a_nose_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2053. # trucks.playAction("a_nose_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2054. # #print("nose_stall")
  2055. # elif own['grindType'] == "tail_stall":
  2056. # skater.playAction("reg_tail_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2057. # deck.playAction("a_reg_tail_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2058. # trucks.playAction("a_reg_tail_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2059. #print("reg_tail_stall")
  2060. else:
  2061. if STANCE == 0:
  2062. own['requestAction'] = 'reg_5050'
  2063. if STANCE == 1:
  2064. own['requestAction'] = 'fak_5050'
  2065. def rotmult():
  2066. if r_ground.triggered:
  2067. num = ((rot.z * -1) +1)
  2068. num = num * 100
  2069. def airup():
  2070. if r_ground.triggered == False:
  2071. pos = own.worldPosition
  2072. pos = own.worldPosition.z
  2073. last_pos = own['last_posz']
  2074. if last_pos - pos > 0:
  2075. own['airup'] = 0
  2076. if last_pos - pos < 0:
  2077. own['airup'] = 1
  2078. if pos > own['last_posz']:
  2079. own["air_height"] = pos
  2080. own['last_posz'] = pos
  2081. def onramp():
  2082. if r_ground.positive:
  2083. if 'ramp' in r_ground.hitObject:
  2084. own['onramp'] = 1
  2085. else:
  2086. own['onramp'] = 0
  2087. else:
  2088. own['onramp'] = 0
  2089. def grindtype(gtype):
  2090. own['grindType'] = gtype
  2091. def transmult():
  2092. lastrotz = own["rotz"]
  2093. linvel = own.getLinearVelocity(True)
  2094. newx = (linvel.x + (linvel.x * .039))
  2095. if linvel.x < 7 and linvel.x > -7 and rot.z > lastrotz and r_ground.triggered == 1 and rot.z > .3 and rot.z < .93:
  2096. own.setLinearVelocity([newx, linvel.y, linvel.z], True)
  2097. def speedmult():
  2098. vel = own.getLinearVelocity(True)
  2099. xyz = own.worldOrientation.to_euler()
  2100. roty = math.degrees(xyz[1])
  2101. roty = abs(roty)
  2102. roty = roty * .0005
  2103. if abs(vel.x) > 1:
  2104. mult = .0015 + roty
  2105. else:
  2106. mult = .000
  2107. mult2 = .018
  2108. mult3 = .007
  2109. lastrotz = own["rotz"]
  2110. x = vel.x * mult
  2111. x2 = x + vel.x
  2112. x3 = vel.x * mult2
  2113. x4 = x3 + vel.x
  2114. x5 = vel.x * mult3
  2115. x6 = x5 + vel.x
  2116. if r_ground.triggered and vel.x < 4 and vel.x > -4:
  2117. own.setLinearVelocity([x2, vel.y, vel.z], True)
  2118. def coping():
  2119. if invertTouch.positive:
  2120. own["coping"] = 1
  2121. else:
  2122. own["coping"] = 0
  2123. def onboard():
  2124. if own['walk'] == 1:
  2125. cont.deactivate(cam.actuators['replayCam'])
  2126. cont.activate(cam.actuators['Camera'])
  2127. killall()
  2128. walklay = 40
  2129. fliplay3 = 2060
  2130. ob_speed = .5
  2131. if STANCE == 0:
  2132. skater.stopAction(fliplay)
  2133. deck.stopAction(fliplay)
  2134. trucks.stopAction(fliplay)
  2135. killall()
  2136. if own['dropinCol'] == True:
  2137. print("dropinanim")
  2138. own['requestAction'] = reg_dropin
  2139. else:
  2140. own['requestAction'] = 'reg_onboard'
  2141. force = (linVelocity.x -1, linVelocity.y, linVelocity.z)
  2142. own.setLinearVelocity(force, True)
  2143. own['dropinTimer'] = 60
  2144. if STANCE == 1:
  2145. skater.stopAction(fliplay)
  2146. deck.stopAction(fliplay)
  2147. trucks.stopAction(fliplay)
  2148. killall()
  2149. if own['dropinTimer'] > 30:
  2150. print("dropinanim2")
  2151. own['requestAction'] = fak_dropin
  2152. else:
  2153. own['requestAction'] = 'fak_onboard'
  2154. force = (linVelocity.x +1, linVelocity.y, linVelocity.z)
  2155. own.setLinearVelocity(force, True)
  2156. own['dropinTimer'] = 60
  2157. else:
  2158. num = own['dropinTimer']
  2159. if num > 0:
  2160. num = num - 1
  2161. own['dropinTimer'] = num
  2162. def offboard():
  2163. wheel1.stopAction(2)
  2164. wheel2.stopAction(2)
  2165. wheel3.stopAction(2)
  2166. wheel4.stopAction(2)
  2167. cont.deactivate(own.actuators["sroll"])
  2168. sact = own.actuators["sroll"]
  2169. sact.volume = .0001
  2170. own.actuators["sroll"].stopSound()
  2171. own['offboard_vel'] = own.linearVelocity
  2172. own['walk_timer'] = 0
  2173. def resetjumpstance():
  2174. if LAST_GRIND == True and grindHit == False:
  2175. own["lF_ground_frame"] = own['framenum']
  2176. lfg = own["lF_ground_frame"]
  2177. #print(lfg, "----- this?")
  2178. if own['jump_stance'] != 3:
  2179. own['jump_stance'] = 3
  2180. def grass():
  2181. try:
  2182. if 'grass' in r_ground.hitObject:
  2183. #print("grass")
  2184. linVel = own.getLinearVelocity(True)
  2185. linvelx = linVel.x * .98
  2186. own.setLinearVelocity((linvelx, linVel.y, linVel.z), 1)
  2187. except:
  2188. pass
  2189. def grindoutair():
  2190. skippy = 0
  2191. linVel = own.getLinearVelocity(True)
  2192. if own['LAST_GRIND'] == True and grindHit == True:
  2193. own['lg_stance'] = STANCE
  2194. lg_stance = own['lg_stance']
  2195. own.actuators["grindoutair"].useLocalLinV = True
  2196. if own['grindjumpturn'] == True and own['grindCountdown'] > 12 and skippy == 0:
  2197. grindoutspeed = .1
  2198. grindoutspeed2 = 5.4
  2199. if lLR > turnsens:
  2200. if own['last_grindpos'] == 'reg_5050':
  2201. if STANCE == 0:
  2202. own.actuators["grindoutair"].linV = [0, grindoutspeed, 0]
  2203. else:
  2204. own.actuators["grindoutair"].linV = [0, -grindoutspeed, 0]
  2205. cont.activate(own.actuators["grindoutair"])
  2206. if lLR < -turnsens:
  2207. if own['last_grindpos'] == 'reg_5050':
  2208. if STANCE == 0:
  2209. own.actuators["grindoutair"].linV = [0, -grindoutspeed, 0]
  2210. else:
  2211. own.actuators["grindoutair"].linV = [0, grindoutspeed, 0]
  2212. cont.activate(own.actuators["grindoutair"])
  2213. if lUD > turnsens:
  2214. js = own['lg_stance']
  2215. linvelx = own.getLinearVelocity(True)
  2216. if own['last_grindpos'] == 'reg_board':
  2217. if js == 1:
  2218. own.actuators["grindoutair"].linV = [-grindoutspeed, 0, 0]
  2219. cont.activate(own.actuators["grindoutair"])
  2220. else:
  2221. own.actuators["grindoutair"].linV = [grindoutspeed, 0, 0]
  2222. cont.activate(own.actuators["grindoutair"])
  2223. if lUD < -turnsens:
  2224. js = own['lg_stance']
  2225. if own['last_grindpos'] == 'reg_board':
  2226. if js == 0:
  2227. own.actuators["grindoutair"].linV = [-grindoutspeed, 0, 0]
  2228. cont.activate(own.actuators["grindoutair"])
  2229. else:
  2230. own.actuators["grindoutair"].linV = [grindoutspeed, 0, 0]
  2231. cont.activate(own.actuators["grindoutair"])
  2232. if LAST_GRIND == False and r_ground.triggered and own['grindjumpturn'] == True and own['grindCountdown'] < 1:
  2233. own['grindjumpturn'] = False
  2234. if r_ground.triggered:
  2235. own['grind_jump'] = False
  2236. if own['grindjumpturn'] == False or own['grindCountdown'] < 19:
  2237. cont.deactivate(own.actuators["grindoutair"])
  2238. def set_last_grindpos():
  2239. if own['grindpos'] != None:
  2240. own['last_grindpos'] = own['grindpos']
  2241. def air_pos():
  2242. grindpos = own['grindpos']
  2243. GRAB_ON = own["GRAB_ON"]
  2244. wr = own["wallride"]
  2245. jump_timer = own['jump_timer']
  2246. if rUD > .040 and r_ground.triggered == False and GRAB_ON == False and wr == None and jump_timer < 30:
  2247. killact(2)
  2248. killact(4)
  2249. if STANCE == 0:
  2250. own['requestAction'] = 'reg_air_tail'
  2251. print("reg_air_tail")
  2252. else:
  2253. own['requestAction'] = 'fak_air_tail'
  2254. print("fak_air_tail")
  2255. elif rUD < -.040 and r_ground.triggered == False and GRAB_ON == False and wr == None and jump_timer < 30:
  2256. killact(2)
  2257. killact(4)
  2258. if STANCE == 0:
  2259. own['requestAction'] = 'reg_air_nose'
  2260. print("reg_air_nose")
  2261. else:
  2262. own['requestAction'] = 'fak_air_nose'
  2263. print("fak_air_nose")
  2264. def air_turn_boost():
  2265. pass
  2266. def revert():
  2267. own["Q3oncdl"] = 0
  2268. own["Q4oncdl"] = 0
  2269. own["Q5oncdl"] = 0
  2270. own["Q6oncdl"] = 0
  2271. own["Q7oncdl"] = 0
  2272. local = True
  2273. rot = [ 0.0, 0.0, 3.14]
  2274. own.applyRotation(rot,local)
  2275. framenum = own['framenum']
  2276. last_ground_frame = own['lF_ground_frame']
  2277. lF_air_frame = own['lF_air_frame']
  2278. frames_since_ground = framenum - lF_air_frame
  2279. #if frames_since_ground > 20:
  2280. if own['manual_v2_type'] == 'reg manual':
  2281. own['requestAction'] = 'reg_manual_revert_ccw'
  2282. print("reg")
  2283. elif own['manual_v2_type'] == 'reg nose manual':
  2284. own['requestAction'] = 'fak_manual_revert_ccw'
  2285. #skater.playAction("fak_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2286. #deck.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2287. #trucks.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2288. print("reg nose manual revert")
  2289. elif own['manual_v2_type'] == 'fak manual':
  2290. own['requestAction'] = 'fak_manual_revert_ccw'
  2291. #skater.playAction("fak_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2292. #deck.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2293. #trucks.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2294. print("fak manual revert")
  2295. elif own['manual_v2_type'] == 'fak nose manual':
  2296. own['requestAction'] = 'reg_manual_revert_ccw'
  2297. #skater.playAction("reg_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2298. #deck.playAction("a_reg_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2299. #trucks.playAction("a_reg_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2300. print("fak")
  2301. else:
  2302. own['requestAction'] = 'revert1'
  2303. own['revert_timer'] = 20
  2304. cont.activate(own.actuators["revertSound"])
  2305. def revert2():
  2306. own["Q3oncdl"] = 0
  2307. own["Q4oncdl"] = 0
  2308. own["Q5oncdl"] = 0
  2309. own["Q6oncdl"] = 0
  2310. own["Q7oncdl"] = 0
  2311. local = True
  2312. rot = [ 0.0, 0.0, -3.14]
  2313. own.applyRotation(rot,local)
  2314. if own['manual_v2_type'] == 'reg manual':
  2315. own['requestAction'] = 'reg_manual_revert_cw'
  2316. #skater.playAction("reg_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2317. #deck.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2318. #trucks.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2319. print("reg")
  2320. elif own['manual_v2_type'] == 'reg nose manual':
  2321. own['requestAction'] = 'fak_manual_revert_cw'
  2322. #skater.playAction("fak_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2323. #deck.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2324. #trucks.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2325. print("reg nose manual revert")
  2326. elif own['manual_v2_type'] == 'fak manual':
  2327. own['requestAction'] = 'fak_manual_revert_cw'
  2328. #skater.playAction("fak_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2329. #deck.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2330. #trucks.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2331. print("fak manual revert")
  2332. elif own['manual_v2_type'] == 'fak nose manual':
  2333. own['requestAction'] = 'reg_manual_revert_cw'
  2334. #skater.playAction("reg_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2335. #deck.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2336. #trucks.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2337. print("fak")
  2338. else:
  2339. own['requestAction'] = 'revert2'
  2340. own['revert_timer'] = 20
  2341. cont.activate(own.actuators["revertSound"])
  2342. def revert3():
  2343. own["Q7oncdl"] = 0
  2344. own["Q8oncdl"] = 0
  2345. own["Q1oncdl"] = 0
  2346. own["Q2oncdl"] = 0
  2347. own["Q3oncdl"] = 0
  2348. local = True
  2349. rot = [ 0.0, 0.0, 3.14]
  2350. own.applyRotation(rot,local)
  2351. print("real revert 3")
  2352. if own['manual_v2_type'] == 'reg manual':
  2353. own['requestAction'] = 'reg_manual_revert_ccw'
  2354. #skater.playAction("reg_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2355. #deck.playAction("a_reg_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2356. #trucks.playAction("a_reg_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2357. print("reg")
  2358. elif own['manual_v2_type'] == 'reg nose manual':
  2359. own['requestAction'] = 'fak_manual_revert_ccw'
  2360. #skater.playAction("fak_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2361. #deck.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2362. #trucks.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2363. print("reg nose manual revert")
  2364. elif own['manual_v2_type'] == 'fak manual':
  2365. own['requestAction'] = 'fak_manual_revert_ccw'
  2366. #skater.playAction("fak_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2367. #deck.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2368. #trucks.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2369. print("fak manual revert")
  2370. elif own['manual_v2_type'] == 'fak nose manual':
  2371. own['requestAction'] = 'reg_manual_revert_ccw'
  2372. #skater.playAction("reg_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2373. #deck.playAction("a_reg_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2374. #trucks.playAction("a_reg_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2375. print("fak")
  2376. else:
  2377. own['requestAction'] = 'revert3'
  2378. own['revert_timer'] = 20
  2379. cont.activate(own.actuators["revertSound"])
  2380. def revert4():
  2381. own["Q7oncdl"] = 0
  2382. own["Q8oncdl"] = 0
  2383. own["Q1oncdl"] = 0
  2384. own["Q2oncdl"] = 0
  2385. own["Q3oncdl"] = 0
  2386. local = True
  2387. rot = [ 0.0, 0.0, 3.14]
  2388. own.applyRotation(rot,local)
  2389. if own['manual_v2_type'] == 'reg manual':
  2390. own['requestAction'] = 'reg_manual_revert_cw'
  2391. #skater.playAction("reg_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2392. #deck.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2393. #trucks.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2394. print("reg")
  2395. #elif own['reg_nmanual'] == 1:
  2396. elif own['manual_v2_type'] == 'reg nose manual':
  2397. own['requestAction'] = 'fak_manual_revert_cw'
  2398. #skater.playAction("fak_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2399. #deck.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2400. #trucks.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2401. print("reg nose manual revert")
  2402. #elif own['fak_manual'] == 1 or own['fak_nmanual'] == 1:
  2403. elif own['manual_v2_type'] == 'fak manual':
  2404. own['requestAction'] = 'fak_manual_revert_cw'
  2405. #skater.playAction("fak_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2406. #deck.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2407. #trucks.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2408. print("fak manual revert")
  2409. elif own['manual_v2_type'] == 'fak nose manual':
  2410. own['requestAction'] = 'reg_manual_revert_cw'
  2411. #skater.playAction("reg_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2412. #deck.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2413. #trucks.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2414. print("fak")
  2415. else:
  2416. own['requestAction'] = 'revert4'
  2417. print("normal revert")
  2418. own['revert_timer'] = 20
  2419. cont.activate(own.actuators["revertSound"])
  2420. def powerslide():
  2421. own['powerslide_counter'] = own['powerslide_counter'] + 1
  2422. since_walk = own['framenum'] - own['last_walk_frame']
  2423. since_grind = own['framenum'] - own['last_grind_frame']
  2424. if own['powerslide_counter'] > 15 and since_walk > 100 and since_grind > 40:
  2425. own['powerslide_on'] = 1
  2426. if STANCE == 0:
  2427. own['powerslide'] = "reg2"
  2428. if STANCE == 1:
  2429. own['powerslide'] = "fak1"
  2430. linVelocity4 = own.getLinearVelocity(True)
  2431. if own['powerslide_counter'] > 15 and own['powerslide_counter'] < 18:
  2432. newx = linVelocity4.x * .9
  2433. else:
  2434. newx = linVelocity4.x * .98
  2435. force = [newx, linVelocity4.y, linVelocity4.z]
  2436. own.setLinearVelocity(force, True)
  2437. def powerslide2():
  2438. own['powerslide_counter'] = own['powerslide_counter'] + 1
  2439. since_walk = own['framenum'] - own['last_walk_frame']
  2440. since_grind = own['framenum'] - own['last_grind_frame']
  2441. if own['powerslide_counter'] > 15 and since_walk > 100 and since_grind > 100:
  2442. own['powerslide_on'] = 1
  2443. if STANCE == 0:
  2444. own['powerslide'] = "reg1"
  2445. if STANCE == 1:
  2446. own['powerslide'] = "fak2"
  2447. linVelocity4 = own.getLinearVelocity(True)
  2448. if own['powerslide_counter'] > 15 and own['powerslide_counter'] < 18:
  2449. newx = linVelocity4.x * .9
  2450. else:
  2451. newx = linVelocity4.x * .98
  2452. force = [newx, linVelocity4.y, linVelocity4.z]
  2453. own.setLinearVelocity(force, True)
  2454. def powerslide_state():
  2455. ####powerslide on#####
  2456. if own['powerslide_on'] == 1:
  2457. if own['powerslide'] == "reg2":
  2458. own['requestAction'] = 'reg_fs_powerslide'
  2459. if own['powerslide'] == "fak1":
  2460. own['requestAction'] = 'fak_fs_powerslide'
  2461. if own['powerslide'] == "reg1":
  2462. own['requestAction'] = 'reg_powerslide'
  2463. if own['powerslide'] == "fak2":
  2464. own['requestAction'] = 'fak_powerslide'
  2465. def powerslide_sound():
  2466. sact = own.actuators["powerslide_sound"]
  2467. if own['powerslide_on'] == 1:
  2468. sact = own.actuators["powerslide_sound"]
  2469. sact.volume = .2
  2470. new_pitch = (abs(linVelocity.x) / 3)
  2471. if new_pitch < 1.1 and new_pitch > .5:
  2472. sact.pitch = new_pitch
  2473. elif new_pitch <= .5:
  2474. sact.pitch = .5
  2475. else:
  2476. sact.pitch = 1.1
  2477. cont.activate(own.actuators["powerslide_sound"])
  2478. else:
  2479. sact.volume = .0
  2480. cont.deactivate(own.actuators["powerslide_sound"])
  2481. def check_powerslide():
  2482. try:
  2483. own['last_powerslide_on'] = own['powerslide_on']
  2484. except:
  2485. pass
  2486. psxvel = abs(linVelocity.x)
  2487. if (lUD > .08 or lUD < -.08) and own['manual_v2'] == False and r_ground.triggered == True and psxvel > .1:
  2488. if lUD > .08:
  2489. powerslide()
  2490. else:
  2491. powerslide2()
  2492. else:
  2493. own['powerslide_on'] = 0
  2494. own['powerslide_counter'] = 0
  2495. if own['last_powerslide_on'] == 0:
  2496. own['powerslide'] = None
  2497. def killmanuals():
  2498. if own['last_manual_v2'] == 1 and own['manual_v2'] == 0:
  2499. fak_manual_off()
  2500. reg_manual_off()
  2501. fak_nmanual_off()
  2502. reg_nmanual_off()
  2503. def killopos():
  2504. pass
  2505. stopAnims()
  2506. #nextframe()
  2507. air()
  2508. stance()
  2509. turn()
  2510. #grind()
  2511. rotmult()
  2512. airup()
  2513. onramp()
  2514. speedmult()
  2515. coping()
  2516. onboard()
  2517. resetjumpstance()
  2518. grass()
  2519. grindoutair()
  2520. set_last_grindpos()
  2521. air_pos()
  2522. air_turn_boost()
  2523. record_grindsound()
  2524. check_powerslide()
  2525. powerslide_state()
  2526. powerslide_sound()
  2527. killmanuals()
  2528. killopos()
  2529. grind()
  2530. ##################
  2531. ###realcontrols###
  2532. ##################
  2533. # q1
  2534. # q8 q2
  2535. # q7 q3
  2536. # q6 q4
  2537. # q5
  2538. ##################
  2539. #lq6
  2540. if lUD > .04 and lLR < -0.04 :
  2541. lq6on = 1
  2542. q6oncdl = countdown
  2543. own["Q6oncdl"] = q6oncdl
  2544. #print("lq6on")
  2545. elif q6oncdl > 0:
  2546. lq6on = 0
  2547. q6oncdl = q6oncdl - 1
  2548. own["Q6oncdl"] = q6oncdl
  2549. #lq8
  2550. if lUD < -.04 and lLR < -0.04 :
  2551. lq8on = 1
  2552. q8oncdl = countdown
  2553. own["Q8oncdl"] = q8oncdl
  2554. #print("lq8on")
  2555. elif q8oncdl > 0:
  2556. lq8on = 0
  2557. q8oncdl = q8oncdl - 1
  2558. own["Q8oncdl"] = q8oncdl
  2559. #lq2
  2560. if lUD < -.04 and lLR > 0.04 :
  2561. lq2on = 1
  2562. q2oncdl = countdown
  2563. own["Q2oncdl"] = q2oncdl
  2564. #print("lq2on")
  2565. elif q2oncdl > 0:
  2566. lq2on = 0
  2567. q2oncdl = q2oncdl - 1
  2568. own["Q2oncdl"] = q2oncdl
  2569. #q4
  2570. if lUD > 0.04 and lLR > 0.04 :
  2571. lq4on = 1
  2572. q4oncdl = countdown
  2573. own["Q4oncdl"] = q4oncdl
  2574. #print("lq4on")
  2575. elif q4oncdl > 0:
  2576. lq4on = 0
  2577. q4oncdl = q4oncdl - 1
  2578. own["Q4oncdl"] = q4oncdl
  2579. #q5
  2580. if lUD > .070 and lq4on == 0 and lq6on == 0:
  2581. lq5on = 1
  2582. q5oncdl = countdown
  2583. own["Q5oncdl"] = q5oncdl
  2584. #print("lq5on")
  2585. elif q5oncdl > 0:
  2586. lq5on = 0
  2587. q5oncdl = q5oncdl - 1
  2588. own["Q5oncdl"] = q5oncdl
  2589. #q1
  2590. if lUD < -0.070 and lq8on !=1 and lq2on != 1:
  2591. lq1on = 1
  2592. q1oncdl = countdown
  2593. own["Q1oncdl"] = q1oncdl
  2594. #print("lq1on")
  2595. elif q1oncdl > 0:
  2596. lq1on = 0
  2597. q1oncdl = q1oncdl - 1
  2598. own["Q1oncdl"] = q1oncdl
  2599. #q7
  2600. if lLR < -0.070 and lq8on != 1 and lq6on != 1:
  2601. lq7on = 1
  2602. q7oncdl = countdown
  2603. own["Q7oncdl"] = q7oncdl
  2604. #print("lq7on")
  2605. elif q7oncdl > 0:
  2606. lq7on = 0
  2607. q7oncdl = q7oncdl - 1
  2608. own["Q7oncdl"] = q7oncdl
  2609. #q3
  2610. if lLR > 0.070 and lq2on !=1 and lq4on != 1:
  2611. lq3on = 1
  2612. q3oncdl = countdown
  2613. own["Q3oncdl"] = q3oncdl
  2614. #print("lq3on")
  2615. elif q3oncdl > 0:
  2616. lq3on = 0
  2617. q3oncdl = q3oncdl - 1
  2618. own["Q3oncdl"] = q3oncdl
  2619. #34567
  2620. own['set_revert_timer'] = 0
  2621. ground_since = own["framenum"] - own['lF_air_frame']
  2622. if ground_since > 20 and frames_since_grinding > 20:
  2623. if q3oncdl < q4oncdl < q5oncdl < q6oncdl < q7oncdl:
  2624. if r_ground.triggered == True:
  2625. print("REVERT!!!")
  2626. revert()
  2627. own['set_revert_timer'] = 1
  2628. if q3oncdl > q4oncdl > q5oncdl > q6oncdl > q7oncdl:
  2629. if r_ground.triggered == True:
  2630. print("REVERT2!!!")
  2631. revert2()
  2632. own['set_revert_timer'] = 1
  2633. if q7oncdl < q8oncdl < q1oncdl < q2oncdl < q3oncdl:
  2634. if r_ground.triggered == True:
  2635. print("REVERT3!!!")
  2636. revert3()
  2637. own['set_revert_timer'] = 1
  2638. if q7oncdl > q8oncdl > q1oncdl > q2oncdl > q3oncdl:
  2639. if r_ground.triggered == True:
  2640. print("REVERT4!!!")
  2641. revert4()
  2642. own['set_revert_timer'] = 1
  2643. ################
  2644. #q6
  2645. if rUD > .04 and rLR < -0.04 :
  2646. q6on = 1
  2647. q6oncd = countdown
  2648. own["Q6oncd"] = q6oncd
  2649. #print("q6on")
  2650. elif q6oncd > 0:
  2651. q6on = 0
  2652. q6oncd = q6oncd - 1
  2653. own["Q6oncd"] = q6oncd
  2654. #q8
  2655. if rUD < -.04 and rLR < -0.04 :
  2656. q8on = 1
  2657. q8oncd = countdown
  2658. own["Q8oncd"] = q8oncd
  2659. #print("q8on")
  2660. elif q8oncd > 0:
  2661. q8on = 0
  2662. q8oncd = q8oncd - 1
  2663. own["Q8oncd"] = q8oncd
  2664. #q2
  2665. if rUD < -.04 and rLR > 0.04 :
  2666. q2on = 1
  2667. q2oncd = countdown
  2668. own["Q2oncd"] = q2oncd
  2669. #print("q2on")
  2670. elif q2oncd > 0:
  2671. q2on = 0
  2672. q2oncd = q2oncd - 1
  2673. own["Q2oncd"] = q2oncd
  2674. #q4
  2675. if rUD > 0.04 and rLR > 0.04 :
  2676. q4on = 1
  2677. q4oncd = countdown
  2678. own["Q4oncd"] = q4oncd
  2679. #print("q4on")
  2680. elif q4oncd > 0:
  2681. q4on = 0
  2682. q4oncd = q4oncd - 1
  2683. own["Q4oncd"] = q4oncd
  2684. #q5
  2685. if rUD > .070:
  2686. if q4on == 0 and q6on == 0:
  2687. #print("q5on")
  2688. q5on = 1
  2689. q5oncd = countdown
  2690. own["Q5oncd"] = q5oncd
  2691. oposin()
  2692. ground_since = own["framenum"] - own['lF_air_frame']
  2693. if (rTrig > 0.02 and GRAB_ON == False and r_ground.triggered == 1) or (lTrig > 0.02 and GRAB_ON == False and r_ground.triggered == 1) and ground_since > 10:
  2694. pump()
  2695. else:
  2696. own["lastPump"] = False
  2697. own["Pump"] = False
  2698. own['jump_stance'] = STANCE
  2699. if rUD > .02:
  2700. grindpos = own['grindpos']
  2701. jumpstance = own["jump_stance"]
  2702. if LAST_GRIND == False:
  2703. if grindpos == "reg_stall":
  2704. grindtype("nose_stall") #change
  2705. elif grindpos == "fak_stall":
  2706. grindtype("nose_stall")
  2707. elif grindpos == "reg_5050":
  2708. if jumpstance != 3:
  2709. if jumpstance == 0:
  2710. if rLR > .02:
  2711. grindtype("reg_tailgR")
  2712. elif rLR < -.02:
  2713. grindtype("reg_tailgL")
  2714. else:
  2715. grindtype("reg_tailg")
  2716. if jumpstance == 1:
  2717. if rLR > .02:
  2718. grindtype("fak_tailgR")
  2719. elif rLR < -.02:
  2720. grindtype("fak_tailgL")
  2721. else:
  2722. grindtype("fak_tailg")
  2723. else:
  2724. if STANCE == 0:
  2725. if rLR > .03:
  2726. grindtype("reg_tailgR")
  2727. elif rLR < -.02:
  2728. grindtype("reg_tailgL")
  2729. else:
  2730. grindtype("reg_tailg")
  2731. if STANCE == 1:
  2732. grindtype("fak_tailg")
  2733. elif grindpos == "reg_board":
  2734. if jumpstance != 3:
  2735. if jumpstance == 0:
  2736. grindtype("reg_tailslide")
  2737. if jumpstance == 1:
  2738. grindtype("fak_tailslide")
  2739. STANCE = jumpstance
  2740. own['stance'] = STANCE
  2741. else:
  2742. if STANCE == 0:
  2743. grindtype("reg_tailslide")
  2744. if STANCE == 1:
  2745. grindtype("fak_tailslide")
  2746. else:
  2747. if jumpstance == 0:
  2748. grindtype("reg_tailg")
  2749. if jumpstance == 1:
  2750. grindtype("fak_tailg")
  2751. if q5oncd > 0:
  2752. q5on = 0
  2753. q5oncd = q5oncd - 1
  2754. own["Q5oncd"] = q5oncd
  2755. own["last_Opos"] = False
  2756. #q1
  2757. if rUD < -0.070:
  2758. if q2on == 0 and q8on == 0:
  2759. #print("q1on")
  2760. q1on = 1
  2761. q1oncd = countdown
  2762. own["Q1oncd"] = q1oncd
  2763. noposin()
  2764. if rUD < -0.020:
  2765. grindpos = own['grindpos']
  2766. jumpstance = own["jump_stance"]
  2767. if LAST_GRIND == False:
  2768. if grindpos == "reg_5050":
  2769. #print("nose something")
  2770. if jumpstance != 3:
  2771. if jumpstance == 0:
  2772. if rLR > .02:
  2773. grindtype("reg_nosegR")
  2774. elif rLR < -.02:
  2775. grindtype("reg_nosegL")
  2776. else:
  2777. grindtype("reg_noseg")
  2778. if jumpstance == 1:
  2779. if rLR > .02:
  2780. grindtype("fak_nosegR")
  2781. elif rLR < -.02:
  2782. grindtype("fak_nosegL")
  2783. else:
  2784. grindtype("fak_noseg")
  2785. else:
  2786. if STANCE == 0:
  2787. if rLR > .02:
  2788. grindtype("reg_nosegR")
  2789. elif rLR < -.02:
  2790. grindtype("reg_nosegL")
  2791. else:
  2792. grindtype("reg_noseg")
  2793. if STANCE == 1:
  2794. if rLR > .02:
  2795. grindtype("fak_nosegR")
  2796. elif rLR < -.02:
  2797. grindtype("fak_nosegL")
  2798. else:
  2799. grindtype("fak_noseg")
  2800. elif grindpos == "reg_board":
  2801. if jumpstance != 3:
  2802. if jumpstance == 0:
  2803. grindtype("reg_noseslide")
  2804. if jumpstance == 1:
  2805. grindtype("fak_noseslide")
  2806. STANCE = jumpstance
  2807. own['stance'] = STANCE
  2808. else:
  2809. if STANCE == 0:
  2810. grindtype("reg_noseslide")
  2811. if STANCE == 1:
  2812. grindtype("fak_noseslide")
  2813. if rUD > -0.020 and rUD <= .020 and LAST_GRIND == False:
  2814. if own['grindpos'] == 'reg_5050':
  2815. grindtype("reg_5050")
  2816. if own['grindpos'] == 'fak_5050':
  2817. grindtype("fak_5050")
  2818. if q1oncd > 0:
  2819. q1on = 0
  2820. q1oncd = q1oncd - 1
  2821. own["Q1oncd"] = q1oncd
  2822. own["last_nOpos"] = False
  2823. #print(q1oncd)
  2824. #q7
  2825. if rLR < -0.070:
  2826. if q8on == 0 and q6on == 0:
  2827. q7on = 1
  2828. q7oncd = countdown
  2829. own["Q7oncd"] = q7oncd
  2830. #print("q7on")
  2831. elif q7oncd > 0:
  2832. q7on = 0
  2833. q7oncd = q7oncd - 1
  2834. own["Q7oncd"] = q7oncd
  2835. #q3
  2836. if rLR > 0.070:
  2837. if q4on == 0 and q2on == 0:
  2838. q3on = 1
  2839. q3oncd = countdown
  2840. own["Q3oncd"] = q3oncd
  2841. #print("q3on")
  2842. elif q3oncd > 0:
  2843. q3on = 0
  2844. q3oncd = q3oncd - 1
  2845. own["Q3oncd"] = q3oncd
  2846. #trick calls
  2847. # 360 flip
  2848. # 3 > 4 > 5 > 8
  2849. # laser flip
  2850. # 7 > 6 > 5 > 2
  2851. #nollie 360 shovit
  2852. if q7oncd > 0 and q8oncd > 0 and q1oncd > 0 and q2oncd > 0 and q3oncd > 0 and q7oncd <= q8oncd <= q1oncd <= q2oncd <= q3oncd:
  2853. print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  2854. print ("Nollie 360 shovit")
  2855. dict['trick_string'] = 'Nollie 360 Shovit'
  2856. nollie_shovit360()
  2857. q7oncd = 0
  2858. q8oncd = 0
  2859. q1oncd = 0
  2860. q2oncd = 0
  2861. q3oncd = 0
  2862. own["Q7oncd"] = q7oncd
  2863. own["Q8oncd"] = q8oncd
  2864. own["Q1oncd"] = q1oncd
  2865. own["Q2oncd"] = q2oncd
  2866. own["Q3oncd"] = q3oncd
  2867. #nollie fs 360 shovit
  2868. if q7oncd > 0 and q8oncd > 0 and q1oncd > 0 and q2oncd > 0 and q3oncd > 0 and q3oncd <= q2oncd <= q1oncd <= q8oncd <= q7oncd:
  2869. #print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  2870. print ("Nollie Front Side 360 shovit")
  2871. dict['trick_string'] = 'Nollie FS 360 Shovit'
  2872. nollie_fsshovit360()
  2873. q7oncd = 0
  2874. q8oncd = 0
  2875. q1oncd = 0
  2876. q2oncd = 0
  2877. q3oncd = 0
  2878. own["Q7oncd"] = q7oncd
  2879. own["Q8oncd"] = q8oncd
  2880. own["Q1oncd"] = q1oncd
  2881. own["Q2oncd"] = q2oncd
  2882. own["Q3oncd"] = q3oncd
  2883. # varial heelflip
  2884. # 7 < 6 < 2
  2885. if q7oncd > 0 and q6oncd > 0 and q2oncd > 0 and q7oncd < q6oncd < q2oncd:
  2886. dict['trick_string'] = 'Varial Heelflip'
  2887. varial_heelflip()
  2888. reset_rtimers()
  2889. # varial kickflip
  2890. # 3 < 4 < 8
  2891. if q3oncd > 0 and q4oncd > 0 and q8oncd > 0 and q3oncd < q4oncd < q8oncd:
  2892. dict['trick_string'] = 'Varial Kickflip'
  2893. varial_kickflip()
  2894. reset_rtimers()
  2895. # nollie varial kickflip
  2896. # 3 < 2 < 6
  2897. if q3oncd > 0 and q2oncd > 0 and q6oncd > 0 and q3oncd <= q2oncd <= q6oncd:
  2898. dict['trick_string'] = 'Nollie Varial Kickflip'
  2899. print('Nollie Varial Kickflip')
  2900. nollie_varial_kickflip()
  2901. reset_rtimers()
  2902. # nollie varial heelflip
  2903. # 7 < 8 < 4
  2904. if q7oncd > 0 and q8oncd > 0 and q4oncd > 0 and q7oncd <= q8oncd <= q4oncd:
  2905. dict['trick_string'] = 'Nollie Varial Heelflip'
  2906. print('Nollie Varial Heelflip')
  2907. nollie_varial_heelflip()
  2908. reset_rtimers()
  2909. #360 shovit
  2910. if q3oncd > 0 and q4oncd > 0 and q5oncd > 0 and q6oncd > 0 and q7oncd > 0 and q7oncd >= q6oncd >= q5oncd >= q4oncd >= q3oncd:
  2911. # print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  2912. #print ("______-------360 shovit")
  2913. dict['trick_string'] = '360 Shovit'
  2914. shovit360()
  2915. q3oncd = 0
  2916. q4oncd = 0
  2917. q5oncd = 0
  2918. q6oncd = 0
  2919. q7oncd = 0
  2920. own["Q3oncd"] = q3oncd
  2921. own["Q4oncd"] = q4oncd
  2922. own["Q5oncd"] = q5oncd
  2923. own["Q6oncd"] = q6oncd
  2924. own["Q7oncd"] = q7oncd
  2925. #360 fs shovit
  2926. if q3oncd > 0 and q4oncd > 0 and q5oncd > 0 and q6oncd >= 0 and q7oncd > 0 and q7oncd <= q6oncd <= q5oncd <= q4oncd <= q3oncd:
  2927. # print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  2928. #print ("______-------360 shovit")
  2929. dict['trick_string'] = '360 Frontside Shovit'
  2930. fsshovit360()
  2931. q3oncd = 0
  2932. q4oncd = 0
  2933. q5oncd = 0
  2934. q6oncd = 0
  2935. q7oncd = 0
  2936. own["Q3oncd"] = q3oncd
  2937. own["Q4oncd"] = q4oncd
  2938. own["Q5oncd"] = q5oncd
  2939. own["Q6oncd"] = q6oncd
  2940. own["Q7oncd"] = q7oncd
  2941. #ollie
  2942. if q5oncd > 0 and q1oncd > 0 and q5oncd < q1oncd:
  2943. JUMPSTRENGTH = q1oncd - q5oncd
  2944. #4,7
  2945. if JUMPSTRENGTH <= 4:
  2946. JUMPSTRENGTH = 1.1
  2947. if JUMPSTRENGTH > 4 and JUMPSTRENGTH < 7:
  2948. JUMPSTRENGTH = 1
  2949. if JUMPSTRENGTH >= 7:
  2950. JUMPSTRENGTH = .9
  2951. aollie()
  2952. q1oncd = 0
  2953. q5oncd = 0
  2954. own["Q1oncd"] = q1oncd
  2955. own["Q5oncd"] = q5oncd
  2956. #nollie
  2957. if q5oncd > 0 and q1oncd > 0 and q5oncd > q1oncd:
  2958. JUMPSTRENGTH = q5oncd - q1oncd
  2959. #4,7
  2960. if JUMPSTRENGTH <= 4:
  2961. JUMPSTRENGTH = 1.1
  2962. if JUMPSTRENGTH > 4 and JUMPSTRENGTH < 7:
  2963. JUMPSTRENGTH = 1
  2964. if JUMPSTRENGTH >= 7:
  2965. JUMPSTRENGTH = .9
  2966. nollie()
  2967. q1oncd = 0
  2968. q5oncd = 0
  2969. own["Q1oncd"] = q1oncd
  2970. own["Q5oncd"] = q5oncd
  2971. print("nollie")
  2972. #kickflip
  2973. if q5oncd > 0 and q8oncd > 0 and q5oncd < q8oncd and q3oncd < 1:
  2974. kickflip()
  2975. q8oncd = 0
  2976. q5oncd = 0
  2977. own["Q8oncd"] = q8oncd
  2978. own["Q5oncd"] = q5oncd
  2979. #nollie kickflip
  2980. if q1oncd > 0 and q6oncd > 0 and q1oncd < q6oncd:
  2981. nollie_kickflip()
  2982. q6oncd = 0
  2983. q1oncd = 0
  2984. own["Q6oncd"] = q6oncd
  2985. own["Q1oncd"] = q1oncd
  2986. #heelflip
  2987. if q5oncd > 0 and q2oncd > 0 and q5oncd < q2oncd:
  2988. heelflip()
  2989. q2oncd = 0
  2990. q5oncd = 0
  2991. own["Q2oncd"] = q2oncd
  2992. own["Q5oncd"] = q5oncd
  2993. #nollie_heelflip
  2994. if q1oncd > 0 and q4oncd > 0 and q1oncd < q4oncd:
  2995. nollie_heelflip()
  2996. q1oncd = 0
  2997. q4oncd = 0
  2998. own["Q1oncd"] = q1oncd
  2999. own["Q4oncd"] = q4oncd
  3000. #shovit
  3001. if q4oncd > 0 and q5oncd > 0 and q6oncd > 0 and q4oncd <= q5oncd <= q6oncd and q3oncd < 1:
  3002. shovit()
  3003. q4oncd = 0
  3004. q5oncd = 0
  3005. q6oncd = 0
  3006. own["Q4oncd"] = q4oncd
  3007. own["Q5oncd"] = q5oncd
  3008. own["Q6oncd"] = q6oncd
  3009. #nollie_shovit
  3010. if q2oncd > 0 and q1oncd > 0 and q8oncd > 0 and q2oncd <= q1oncd <= q8oncd and q3oncd == 0:
  3011. nollie_shovit()
  3012. print('nollie shuvit')
  3013. #nollie_fsshovit()
  3014. q2oncd = 0
  3015. q1oncd = 0
  3016. q8oncd = 0
  3017. own["Q2oncd"] = q2oncd
  3018. own["Q1oncd"] = q1oncd
  3019. own["Q8oncd"] = q8oncd
  3020. #fsshovit
  3021. if q4oncd > 0 and q5oncd > 0 and q6oncd > 0 and q6oncd <= q5oncd <= q4oncd and q7oncd < 1:
  3022. # print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  3023. # print ("^%*^%*^%*^%fsshovit")
  3024. fsshovit()
  3025. q4oncd = 0
  3026. q5oncd = 0
  3027. q6oncd = 0
  3028. own["Q4oncd"] = q4oncd
  3029. own["Q5oncd"] = q5oncd
  3030. own["Q6oncd"] = q6oncd
  3031. #nollie_fsshovit
  3032. if q8oncd > 0 and q1oncd > 0 and q2oncd > 0 and q8oncd <= q1oncd <= q2oncd and q7oncd == 0:
  3033. # print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  3034. print ("nollie fsshovit")
  3035. nollie_fsshovit()
  3036. #nollie_shovit()
  3037. q8oncd = 0
  3038. q1oncd = 0
  3039. q2oncd = 0
  3040. own["Q8oncd"] = q4oncd
  3041. own["Q1oncd"] = q5oncd
  3042. own["Q2oncd"] = q6oncd
  3043. #360 shovit
  3044. # 360 shovit
  3045. # 3 > 4 > 5 >6 > 7
  3046. # fs 360 shovit
  3047. # 7 > 6 > 5 > 4 > 3
  3048. def hippy_jump():
  3049. STANCE = own["stance"]
  3050. if own['hippy'] == 1 and own['last_hippy'] == 0:
  3051. if STANCE == 0:
  3052. #own['requestAction'] = 'reg_hippy'
  3053. own['requestAction'] = 'reg_hippy_in'
  3054. #skater.playAction("reg_hippy", 1,10, layer=1101, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3055. if STANCE == 1:
  3056. own['requestAction'] = 'fak_hippy_in'
  3057. #skater.playAction("fak_hippy", 1,10, layer=1101, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3058. if own['hippy'] == 1 and own['last_hippy'] == 1:
  3059. if STANCE == 0:
  3060. own['requestAction'] = 'reg_hippy_in'
  3061. #skater.playAction("reg_hippy", 10,10, layer=1100, priority=0, layer_weight=0, play_mode=1, speed=.5)
  3062. if STANCE == 1:
  3063. own['requestAction'] = 'fak_hippy_in'
  3064. #skater.playAction("fak_hippy", 10,10, layer=1100, priority=0, layer_weight=0, play_mode=1, speed=.5)
  3065. if own['hippy'] == 0 and own['last_hippy'] == 1:
  3066. killact(1100)
  3067. if rLR > turnsens:
  3068. local = True
  3069. rot = [ 0.0, 0.0, 3.14]
  3070. own.applyRotation(rot,local)
  3071. print("hippy turn")
  3072. if STANCE == 0:
  3073. own['requestAction'] = 'reg_hippy_ncw'
  3074. #skater.playAction("reg_hippy_ncw", 10,40, layer=1102, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3075. print('%hip1')
  3076. if STANCE == 1:
  3077. own['requestAction'] = 'fak_hippy_ncw'
  3078. #skater.playAction("fak_hippy_ncw", 10,40, layer=1102, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3079. print('%hip2')
  3080. elif rLR < -turnsens:
  3081. local = True
  3082. rot = [ 0.0, 0.0, -3.14]
  3083. own.applyRotation(rot,local)
  3084. print("hippy turn neg")
  3085. if STANCE == 0:
  3086. own['requestAction'] = 'fak_hippy_nccw'
  3087. #skater.playAction("fak_hippy_nccw", 10,40, layer=1102, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3088. print('%hip3')
  3089. if STANCE == 1:
  3090. own['requestAction'] = 'reg_hippy_nccw'
  3091. #skater.playAction("reg_hippy_nccw", 10,40, layer=1102, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3092. print('%hip4')
  3093. ##straight
  3094. else:
  3095. if STANCE == 0:
  3096. #skater.playAction("reg_hippy", 10,40, layer=1102, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3097. own['requestAction'] = 'reg_hippy'
  3098. if STANCE == 1:
  3099. own['requestAction'] = 'fak_hippy'
  3100. #skater.playAction("fak_hippy", 10,40, layer=1102, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3101. #pushing and hippy jumps
  3102. since_a = frame - lastaf
  3103. since_x = frame - lastxf
  3104. cush = 10
  3105. hippy = 0
  3106. own['hippy'] = 0
  3107. #print(since_a, "a", since_x, "x")
  3108. #if xBut == 1 and aBut == 1 and since_a <= cush and since_x <= cush and (lTrig < 0.02 and rTrig < 0.02):
  3109. if xBut == 1 and aBut == 1 and (lTrig < 0.02 and rTrig < 0.02) and r_ground.triggered == True:
  3110. #F"hippy")
  3111. hippy = 1
  3112. own['hippy'] = 1
  3113. #hippy_jump()
  3114. #print(hippy)
  3115. hippy_jump()
  3116. if since_a > cush and aBut == 1 and lasta == 1 and (lTrig < 0.02 and rTrig < 0.02) and own['last_hippy'] == 0:
  3117. #print("apush suckka", since_a)
  3118. if xBut == 0 and hippy == 0 and lastaBut_ground == True:
  3119. push()
  3120. if since_x > cush and xBut == 1 and lastx == 1 and (lTrig < 0.02 and rTrig < 0.02) and own['last_hippy'] == 0:
  3121. #print("push suckka", since_x)
  3122. if aBut == 0 and hippy == 0 and lastxBut_ground == True:
  3123. push_goof()
  3124. #cavemans
  3125. if LAST_GRIND == False and grindHit == False and r_ground.triggered:
  3126. if (aBut ==0 and own['lastaBut_ground'] == 1) and lTrig > 0.02:
  3127. brfoot()
  3128. if (aBut ==0 and own['lastaBut_ground'] == 1) and rTrig > 0.02:
  3129. frfoot()
  3130. if (xBut ==0 and own['lastxBut_ground'] == 1) and lTrig > 0.02:
  3131. blfoot()
  3132. if (xBut ==0 and own['lastxBut_ground'] == 1) and rTrig > 0.02:
  3133. flfoot()
  3134. #push b button
  3135. if bBut == 1:
  3136. #print("push suckka")
  3137. if linVelocity.x > .05 or linVelocity.x < -.05:
  3138. stop()
  3139. elif linVelocity.x < .05 or linVelocity.x > -.05:
  3140. if own["lastStop"] == True:
  3141. own["lastStop"] = False
  3142. elif bBut ==0:
  3143. own["lastStop"] = False
  3144. ##### falls
  3145. if own['fall'] == 1:
  3146. offboard()
  3147. own['getoffboard'] = True
  3148. ####
  3149. #y button
  3150. if own['lasty'] == 1 and yBut ==0:
  3151. offboard()
  3152. if own["GRAB_ON"] == True:
  3153. playing = skater.isPlayingAction(fliplay)
  3154. if playing == 1:
  3155. frame = skater.getActionFrame(fliplay)
  3156. #print("Flipping frame: ", frame)
  3157. if frame > 16:
  3158. skater.stopAction(fliplay)
  3159. #frontside grab
  3160. flipping = skater.isPlayingAction(fliplay)
  3161. if rTrig > 0.02 and r_ground.triggered == 0 and flipping == False:
  3162. GRAB_ON = True
  3163. own["GRAB_ON"] = GRAB_ON
  3164. #print(rTrig, GRAB_ON)
  3165. if STANCE == False and rUD >= -.07 and rUD <= .07:
  3166. frontside_grab_on()
  3167. elif STANCE == True and rUD >= -.07 and rUD <= .07:
  3168. fakbackside_grab_on()
  3169. #front_nose
  3170. if STANCE == True and rUD < -0.070:
  3171. fak_backside_nose_grab_on()
  3172. #front_tail
  3173. elif STANCE == True and rUD > 0.07:
  3174. fak_backside_tail_grab_on()
  3175. #
  3176. if STANCE == False and rUD < -0.070:
  3177. frontside_nose_grab_on()
  3178. #front_tail
  3179. elif STANCE == False and rUD > 0.07:
  3180. frontside_tail_grab_on()
  3181. #backside grab
  3182. #if lTrig > 0.02 and GRAB_ON == False and r_ground.triggered == 0:
  3183. if lTrig > 0.02 and r_ground.triggered == 0 and flipping == False:
  3184. GRAB_ON = True
  3185. own["GRAB_ON"] = GRAB_ON
  3186. #print(rTrig)
  3187. if STANCE == False and rUD >= -.07 and rUD <= .07:
  3188. backside_grab_on()
  3189. elif STANCE == True and rUD >= -.07 and rUD <= .07:
  3190. fakfrontside_grab_on()
  3191. #front_nose
  3192. if STANCE == True and rUD < -0.070:
  3193. fak_frontside_nose_grab_on()
  3194. #front_tail
  3195. elif STANCE == True and rUD > 0.07:
  3196. fak_frontside_tail_grab_on()
  3197. #front_nose
  3198. if STANCE == False and rUD < -0.070:
  3199. backside_nose_grab_on()
  3200. #front_tail
  3201. elif STANCE == False and rUD > 0.07:
  3202. backside_tail_grab_on()
  3203. #kill grabs
  3204. if lTrig <= 0.02 and GRAB_ON == True and lTrig >= -.02 and rTrig <= .02 and rTrig >= -.2:
  3205. GRAB_ON = False
  3206. own["GRAB_ON"] = GRAB_ON
  3207. GRAB_PLAYED = False
  3208. own["GRAB_PLAYED"] = GRAB_PLAYED
  3209. #frontside pump #backside pump
  3210. def footplant():
  3211. framenum = own['framenum']
  3212. last_ground_frame = own['lF_ground_frame']
  3213. lF_air_frame = own['lF_air_frame']
  3214. frames_since_ground = framenum - lF_air_frame
  3215. frames_since_grind = framenum - own['last_grind_frame']
  3216. if grindHit == True and aBut == True:
  3217. print("first invert check")
  3218. own.linearVelocity.x = 0
  3219. own.linearVelocity.y = 0
  3220. #own.setLinearVelocity([0,0,0],0)
  3221. own['footplant_on'] = 1
  3222. if grindHit == False:
  3223. own['footplant_on'] = 0
  3224. if own['footplant_on'] == True and rUD < turnsens and rUD > -turnsens:
  3225. #own.setLinearVelocity([0,0,0],0)
  3226. own.linearVelocity.x = 0
  3227. own.linearVelocity.y = 0
  3228. if own['footplant_on'] == 1 and own['last_footplant'] == True and own['jump_timer'] < 50:
  3229. if skater.isPlayingAction(2925) == False:
  3230. if STANCE == 0:
  3231. own['requestAction'] = 'reg_fp_rback'
  3232. #print("requesting footplant0")
  3233. if STANCE == 1:
  3234. own['requestAction'] = 'fak_fp_rback'
  3235. #print("requesting footplant1")
  3236. def invert():
  3237. if grindHit == True and own['grindpos'] == 'reg_board':
  3238. #if LAST_GRIND == False and grindHit == True and own['grindpos'] == 'reg_board':
  3239. if lBump == 1:
  3240. #print("invert")
  3241. #if coping_on ==1 and lBump == 1:
  3242. #print("invert")
  3243. own['invert_on'] = 1
  3244. #invert_on = 1
  3245. own.linearVelocity.x = 0
  3246. own.linearVelocity.y = 0
  3247. if own["coping"] == 1 and own['invert_on'] == 1:
  3248. if own['invert_on'] == 1 and own['last_invert'] == False:
  3249. #killall()
  3250. cont.activate(own.actuators['invertOn_sound'])
  3251. if STANCE == False:
  3252. own['invert_type'] = "reg_back_invert_in"
  3253. if STANCE == True:
  3254. own['invert_type'] = "fak_fr_invert"
  3255. if own['invert_on'] == 0 and own['last_invert'] == True:
  3256. #print("kill invert")
  3257. own['last_invert_frame'] = frame
  3258. cont.activate(own.actuators['invertOff_Sound'])
  3259. if own['invert_on'] == 1:
  3260. if own['invert_type'] == "reg_back_invert_in":
  3261. own['requestAction'] = 'reg_back_invert'
  3262. if own['invert_type'] == "fak_fr_invert":
  3263. own['requestAction'] = 'fak_fr_invert'
  3264. lif = own['last_invert_frame']
  3265. if frame - lif > 3 and own['invert_on'] == 0:
  3266. own['invert_type'] = None
  3267. if grindHit == False:
  3268. own['invert_on'] = False
  3269. invert()
  3270. footplant()
  3271. if own['invert_on'] == 0:
  3272. killact(900)
  3273. def reset_pos():
  3274. #reset
  3275. if ddPad == 1:
  3276. spawn_pos = own['spawn_pos']
  3277. spawn_rot = own['spawn_rot']
  3278. try:
  3279. own.worldPosition = (spawn_pos[0], spawn_pos[1], (spawn_pos[2] + .1))
  3280. own.worldOrientation = [[spawn_rot[0][0],spawn_rot[0][1],spawn_rot[0][2]], [spawn_rot[1][0],spawn_rot[1][1],spawn_rot[1][2]], [0.0, 0.0, 1.0]]
  3281. except:
  3282. own.worldPosition = (0, 0, .1)
  3283. own.worldOrientation = [[1.0, 0.0, 0.0], [ 0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]
  3284. if own["spawn_stance"] == 1:
  3285. own.setLinearVelocity([.1,0,0], 1)
  3286. #cam.worldPosition = (spawn_pos[0], spawn_pos[1], (spawn_pos[2] + .25))
  3287. #cam.applyMovement([0,-1,0], True)
  3288. #lx = cam.localPosition[1]
  3289. #lx = lx - 4
  3290. #cam.worldOrientation = [[spawn_rot[0][0],spawn_rot[0][1],spawn_rot[0][2]], [spawn_rot[1][0],spawn_rot[1][1],spawn_rot[1][2]], [0.0, 0.0, 1.0]]
  3291. #cam.localPosition[1] = lx
  3292. else:
  3293. own.setLinearVelocity([-.1,0,0], 1)
  3294. #cam.worldPosition = (spawn_pos[0], spawn_pos[1], (spawn_pos[2] + .25))
  3295. #cam.applyMovement([0,1,0], True)
  3296. #lx = cam.localPosition[1]
  3297. #lx = lx - 4
  3298. #cam.worldOrientation = [[spawn_rot[0][0],spawn_rot[0][1],spawn_rot[0][2]], [spawn_rot[1][0],spawn_rot[1][1],spawn_rot[1][2]], [0.0, 0.0, 1.0]]
  3299. #cam.localPosition[1] = lx
  3300. if udPad == 1:
  3301. own['spawn_pos'] = [own.worldPosition[0], own.worldPosition[1], own.worldPosition[2]]
  3302. own['spawn_rot'] = [[own.worldOrientation[0][0],own.worldOrientation[0][1],own.worldOrientation[0][2]], [own.worldOrientation[1][0],own.worldOrientation[1][1],own.worldOrientation[1][2]], own.worldOrientation[2][2]]
  3303. stance = own["stance"]
  3304. own["spawn_stance"] = stance
  3305. #start button
  3306. #print(own['last_stBut'])
  3307. #print(own['pause_on'])
  3308. if stBut == True:
  3309. own.actuators["sroll"].volume = .0001
  3310. cont.deactivate(own.actuators["sroll"])
  3311. own.actuators["sroll"].stopSound()
  3312. if stBut == False and own['last_stBut'] == True:
  3313. if own['pause_on'] == True:
  3314. own['pause_on'] = False
  3315. #own.restoreDynamics()
  3316. else:
  3317. own['pause_on'] = True
  3318. #own.suspendDynamics()
  3319. own['last_stBut'] = stBut
  3320. def ylimit():
  3321. lgf = own['last_grind_frame']
  3322. frame = own['framenum']
  3323. frames_since_grinding = frame - lgf
  3324. if r_ground.triggered and touched == False and grindHit == 0 and frames_since_grinding > 20:
  3325. linVelocity4 = own.getLinearVelocity(True)
  3326. newy = linVelocity4.y * .8 #.4
  3327. force = [linVelocity4.x, newy, linVelocity4.z]
  3328. own.setLinearVelocity(force, True)
  3329. def getoffboard():
  3330. lasty = own['lasty']
  3331. getoffboard = own['getoffboard']
  3332. if getoffboard == 1 and own['fall'] == False:
  3333. own['getoffboard'] = 0
  3334. if yBut == False and lasty == True:
  3335. own['getoffboard'] = 1
  3336. def switchcam():
  3337. pass
  3338. # if ltsBut == False and own['lastlts'] == True and rtsBut == False:
  3339. # if own['camera'] == 1:
  3340. # own['camera'] = 0
  3341. # else:
  3342. # own['camera'] = 1
  3343. # if rtsBut == False and own['lastrts'] == True and ltsBut == False:
  3344. # if own['camera'] == 2:
  3345. # own['camera'] = 0
  3346. # else:
  3347. # own['camera'] = 2
  3348. #followcam
  3349. def move_followcam():
  3350. if own['camera'] == 2:
  3351. #if rtsBut == False and own['lastrts'] == True:
  3352. if own['lastbkBut'] == True and bkBut == False:
  3353. #print("activate move followcam")
  3354. if own['move_followcam'] == False:
  3355. own['move_followcam'] = True
  3356. else:
  3357. own['move_followcam'] = False
  3358. if own['move_followcam'] == True:
  3359. #act = followcam.actuators[
  3360. camspeed1 = .015
  3361. camspeed2 = .055
  3362. camrot1 = .005
  3363. camrot2 = .02
  3364. #up
  3365. if lUD < -0.080:
  3366. followcam.actuators["up"].dLoc = [ 0, 0, -camspeed2]
  3367. cont.activate(followcam.actuators["up"])
  3368. #print("fastup")
  3369. else:
  3370. cont.deactivate(followcam.actuators["up"])
  3371. # #down
  3372. if lUD > .080:
  3373. followcam.actuators["down"].dLoc = [ 0, 0, camspeed2]
  3374. cont.activate(followcam.actuators["down"])
  3375. else:
  3376. cont.deactivate(followcam.actuators["down"])
  3377. # #left
  3378. if lLR < -0.080:
  3379. followcam.actuators["left"].dLoc = [-camspeed2, 0, 0]
  3380. cont.activate(followcam.actuators["left"])
  3381. else:
  3382. cont.deactivate(followcam.actuators["left"])
  3383. # #right
  3384. if lLR > 0.080:
  3385. followcam.actuators["right"].dLoc = [camspeed2, 0, 0]
  3386. cont.activate(followcam.actuators["right"])
  3387. else:
  3388. cont.deactivate(followcam.actuators["right"])
  3389. #up
  3390. if rUD < -0.080:
  3391. followcam.actuators["rotup"].dLoc = [0, 0, camrot2]
  3392. cont.activate(followcam.actuators["rotup"])
  3393. #print("uppppppppppppppppppppppppppp")
  3394. else:
  3395. cont.deactivate(followcam.actuators["rotup"])
  3396. # #down
  3397. if rUD > .080:
  3398. followcam.actuators["rotdown"].dLoc = [0, 0, -camrot2]
  3399. cont.activate(followcam.actuators["rotdown"])
  3400. else:
  3401. cont.deactivate(followcam.actuators["rotdown"])
  3402. # #left
  3403. if rLR < -0.080:
  3404. followcam.actuators["rotleft"].dRot = [0, 0, camrot2]
  3405. cont.activate(followcam.actuators["rotleft"])
  3406. else:
  3407. cont.deactivate(followcam.actuators["rotleft"])
  3408. # #right
  3409. if rLR > 0.080:
  3410. followcam.actuators["rotright"].dRot = [0, 0, -camrot2]
  3411. cont.activate(followcam.actuators["rotright"])
  3412. else:
  3413. cont.deactivate(followcam.actuators["rotright"])
  3414. #*********************************************
  3415. if lUD > -0.080 and lUD < -0.030:
  3416. followcam.actuators["up"].dLoc = [ 0, 0, -camspeed1]
  3417. cont.activate(followcam.actuators["up"])
  3418. #print(lUD)
  3419. else:
  3420. cont.deactivate(followcam.actuators["up"])
  3421. # #down
  3422. if lUD < .080 and lUD > .03:
  3423. followcam.actuators["down"].dLoc = [ 0, 0, camspeed1]
  3424. cont.activate(followcam.actuators["down"])
  3425. else:
  3426. cont.deactivate(followcam.actuators["down"])
  3427. # #left
  3428. if lLR > -0.080 and lLR < -0.030:
  3429. followcam.actuators["left"].dLoc = [-camspeed1, 0, 0]
  3430. cont.activate(followcam.actuators["left"])
  3431. else:
  3432. cont.deactivate(followcam.actuators["left"])
  3433. # #right
  3434. if lLR < .080 and lLR > .03:
  3435. followcam.actuators["right"].dLoc = [camspeed1, 0, 0]
  3436. cont.activate(followcam.actuators["right"])
  3437. else:
  3438. cont.deactivate(followcam.actuators["right"])
  3439. #up
  3440. if rUD > -0.080 and rUD < -0.030:
  3441. followcam.actuators["rotup"].dRot = [camrot1, 0, 0]
  3442. cont.activate(followcam.actuators["rotup"])
  3443. else:
  3444. cont.deactivate(followcam.actuators["rotup"])
  3445. # #down
  3446. if rUD < .080 and rUD > .03:
  3447. followcam.actuators["rotdown"].dRot = [-camrot1, 0, 0]
  3448. cont.activate(followcam.actuators["rotdown"])
  3449. else:
  3450. cont.deactivate(followcam.actuators["rotdown"])
  3451. # #left
  3452. if rLR > -0.080 and rLR < -0.030:
  3453. followcam.actuators["rotleft"].dRot = [0, 0, camrot1]
  3454. cont.activate(followcam.actuators["rotleft"])
  3455. else:
  3456. cont.deactivate(followcam.actuators["rotleft"])
  3457. # #right
  3458. if rLR < .080 and rLR > .03:
  3459. followcam.actuators["rotright"].dRot = [0, 0, -camrot1]
  3460. cont.activate(followcam.actuators["rotright"])
  3461. else:
  3462. cont.deactivate(followcam.actuators["rotright"])
  3463. def move_flycam():
  3464. if own['camera'] == 1:
  3465. #if rtsBut == False and own['lastrts'] == True:
  3466. if own['lastbkBut'] == True and bkBut == False:
  3467. if own['move_freecam'] == False:
  3468. own['move_freecam'] = True
  3469. else:
  3470. own['move_freecam'] = False
  3471. if own['move_freecam'] == True:
  3472. #act = freecam.actuators[
  3473. camspeed1 = .015
  3474. camspeed2 = .055
  3475. camrot1 = .005
  3476. camrot2 = .02
  3477. #up
  3478. if lUD < -0.080:
  3479. freecam.actuators["up"].dLoc = [ 0, 0, -camspeed2]
  3480. cont.activate(freecam.actuators["up"])
  3481. #print("fastup")
  3482. else:
  3483. cont.deactivate(freecam.actuators["up"])
  3484. # #down
  3485. if lUD > .080:
  3486. freecam.actuators["down"].dLoc = [ 0, 0, camspeed2]
  3487. cont.activate(freecam.actuators["down"])
  3488. else:
  3489. cont.deactivate(freecam.actuators["down"])
  3490. # #left
  3491. if lLR < -0.080:
  3492. freecam.actuators["left"].dLoc = [-camspeed2, 0, 0]
  3493. cont.activate(freecam.actuators["left"])
  3494. else:
  3495. cont.deactivate(freecam.actuators["left"])
  3496. # #right
  3497. if lLR > 0.080:
  3498. freecam.actuators["right"].dLoc = [camspeed2, 0, 0]
  3499. cont.activate(freecam.actuators["right"])
  3500. else:
  3501. cont.deactivate(freecam.actuators["right"])
  3502. #up
  3503. if rUD < -0.080:
  3504. freecam.actuators["rotup"].dRot = [camrot2, 0, 0]
  3505. cont.activate(freecam.actuators["rotup"])
  3506. else:
  3507. cont.deactivate(freecam.actuators["rotup"])
  3508. # #down
  3509. if rUD > .080:
  3510. freecam.actuators["rotdown"].dRot = [-camrot2, 0, 0]
  3511. cont.activate(freecam.actuators["rotdown"])
  3512. else:
  3513. cont.deactivate(freecam.actuators["rotdown"])
  3514. # #left
  3515. if rLR < -0.080:
  3516. freecam.actuators["rotleft"].dRot = [0, 0, camrot2]
  3517. cont.activate(freecam.actuators["rotleft"])
  3518. else:
  3519. cont.deactivate(freecam.actuators["rotleft"])
  3520. # #right
  3521. if rLR > 0.080:
  3522. freecam.actuators["rotright"].dRot = [0, 0, -camrot2]
  3523. cont.activate(freecam.actuators["rotright"])
  3524. else:
  3525. cont.deactivate(freecam.actuators["rotright"])
  3526. #*********************************************
  3527. if lUD > -0.080 and lUD < -0.030:
  3528. freecam.actuators["up"].dLoc = [ 0, 0, -camspeed1]
  3529. cont.activate(freecam.actuators["up"])
  3530. #print(lUD)
  3531. else:
  3532. cont.deactivate(freecam.actuators["up"])
  3533. # #down
  3534. if lUD < .080 and lUD > .03:
  3535. freecam.actuators["down"].dLoc = [ 0, 0, camspeed1]
  3536. cont.activate(freecam.actuators["down"])
  3537. else:
  3538. cont.deactivate(freecam.actuators["down"])
  3539. # #left
  3540. if lLR > -0.080 and lLR < -0.030:
  3541. freecam.actuators["left"].dLoc = [-camspeed1, 0, 0]
  3542. cont.activate(freecam.actuators["left"])
  3543. else:
  3544. cont.deactivate(freecam.actuators["left"])
  3545. # #right
  3546. if lLR < .080 and lLR > .03:
  3547. freecam.actuators["right"].dLoc = [camspeed1, 0, 0]
  3548. cont.activate(freecam.actuators["right"])
  3549. else:
  3550. cont.deactivate(freecam.actuators["right"])
  3551. #up
  3552. if rUD > -0.080 and rUD < -0.030:
  3553. freecam.actuators["rotup"].dRot = [camrot1, 0, 0]
  3554. cont.activate(freecam.actuators["rotup"])
  3555. else:
  3556. cont.deactivate(freecam.actuators["rotup"])
  3557. # #down
  3558. if rUD < .080 and rUD > .03:
  3559. freecam.actuators["rotdown"].dRot = [-camrot1, 0, 0]
  3560. cont.activate(freecam.actuators["rotdown"])
  3561. else:
  3562. cont.deactivate(freecam.actuators["rotdown"])
  3563. # #left
  3564. if rLR > -0.080 and rLR < -0.030:
  3565. freecam.actuators["rotleft"].dRot = [0, 0, camrot1]
  3566. cont.activate(freecam.actuators["rotleft"])
  3567. else:
  3568. cont.deactivate(freecam.actuators["rotleft"])
  3569. # #right
  3570. if rLR < .080 and rLR > .03:
  3571. freecam.actuators["rotright"].dRot = [0, 0, -camrot1]
  3572. cont.activate(freecam.actuators["rotright"])
  3573. else:
  3574. cont.deactivate(freecam.actuators["rotright"])
  3575. if r_ground.triggered == False:
  3576. own["lF_air_frame"] = own["framenum"]
  3577. if r_ground.triggered == True:
  3578. own["lF_ground_frame"] = own["framenum"]
  3579. if own['LAST_GRIND'] == True:
  3580. own['last_grind_frame'] = own['framenum']
  3581. if own['LAST_GRIND'] == False and r_ground.triggered and own['jump_timer'] == 0:
  3582. if own['jump_stance'] != 3:
  3583. own['jump_stance'] = 3
  3584. def control_calib():
  3585. #controller calibration test
  3586. scenes = bge.logic.getSceneList()
  3587. controller_calib = [scene for scene in scenes if scene.name=="controller_calib"][0]
  3588. cq1 = controller_calib.objects['q1']
  3589. cq2 = controller_calib.objects['q2']
  3590. cq3 = controller_calib.objects['q3']
  3591. cq4 = controller_calib.objects['q4']
  3592. cq5 = controller_calib.objects['q5']
  3593. cq6 = controller_calib.objects['q6']
  3594. cq7 = controller_calib.objects['q7']
  3595. cq8 = controller_calib.objects['q8']
  3596. if lq1on == 1:
  3597. cq1["q1"] = 1
  3598. else:
  3599. cq1["q1"] = 0
  3600. if lq2on == 1:
  3601. cq2["q2"] = 1
  3602. else:
  3603. cq2["q2"] = 0
  3604. if lq3on == 1:
  3605. cq3["q3"] = 1
  3606. else:
  3607. cq3["q3"] = 0
  3608. if lq4on == 1:
  3609. cq4["q4"] = 1
  3610. else:
  3611. cq4["q4"] = 0
  3612. if lq5on == 1:
  3613. cq5["q5"] = 1
  3614. else:
  3615. cq5["q5"] = 0
  3616. if lq6on == 1:
  3617. cq6["q6"] = 1
  3618. else:
  3619. cq6["q6"] = 0
  3620. if lq7on == 1:
  3621. cq7["q7"] = 1
  3622. else:
  3623. cq7["q7"] = 0
  3624. if lq8on == 1:
  3625. cq8["q8"] = 1
  3626. else:
  3627. cq8["q8"] = 0
  3628. def grind_turn():
  3629. jumping = None
  3630. gotcd = 25
  3631. force = [0,0,0]
  3632. grindHit = own['grindTouch']
  3633. #print("grindHit: ", grindHit)
  3634. sincegrinding = own['framenum'] - own['grindstartFrame']
  3635. STANCE = own['stance']
  3636. if rUD > turnsens or rLR > turnsens or rUD < -turnsens or rLR < -turnsens:
  3637. jumping = True
  3638. if grindHit == False:
  3639. cont.deactivate(own.actuators['grindoutRight'])
  3640. cont.deactivate(own.actuators['grindoutLeft'])
  3641. if (grindHit == True and jumping == None and sincegrinding > 20)or own['invert_on'] == True:
  3642. #if grindHit == True and jumping == None:
  3643. outloc = 0.022
  3644. bsoutloc = .07
  3645. bsoutvel = .1
  3646. outrot = .02 #0.012
  3647. outrot2 = .24
  3648. outact = own.actuators["grindoutRight"]
  3649. if own['grindpos'] == 'reg_5050':
  3650. if lq3on == 1 or lq2on:
  3651. if own['gt_cd2'] == 0:
  3652. own['gt_cd2'] = 60
  3653. if STANCE == True:
  3654. if own['grind_out_type'] == None:
  3655. own['grind_out_type'] = 'fak right'
  3656. if STANCE == False:
  3657. if own['grind_out_type'] == None:
  3658. own['grind_out_type'] = 'reg right'
  3659. own["grindoutturn"] = gotcd
  3660. if lq7on == 1 or lq8on:
  3661. if own['gt_cd2'] == 0:
  3662. own['gt_cd2'] = 60
  3663. if STANCE == True:
  3664. if own['grind_out_type'] == None:
  3665. own['grind_out_type'] = 'fak left'
  3666. if STANCE == False:
  3667. if own['grind_out_type'] == None:
  3668. own['grind_out_type'] = 'reg left'
  3669. own["grindoutturn"] = gotcd
  3670. if lq4on == 1:
  3671. if own['gt_cd2'] == 0:
  3672. own['gt_cd2'] = 60
  3673. if STANCE == True:
  3674. if own['grind_out_type'] == None:
  3675. own['grind_out_type'] = 'fak fak right'
  3676. if STANCE == False:
  3677. if own['grind_out_type'] == None:
  3678. own['grind_out_type'] = 'reg fak right'
  3679. own["grindoutturn"] = gotcd
  3680. if lq6on == 1:
  3681. if own['gt_cd2'] == 0:
  3682. own['gt_cd2'] = 60
  3683. if STANCE == True:
  3684. if own['grind_out_type'] == None:
  3685. own['grind_out_type'] = 'fak fak left'
  3686. if STANCE == False:
  3687. if own['grind_out_type'] == None:
  3688. own['grind_out_type'] = 'reg fak left'
  3689. own["grindoutturn"] = gotcd
  3690. #use stance for 5050 and grindstance for boards
  3691. if own['grindpos'] == 'reg_board':
  3692. outvel = own.getLinearVelocity(1)
  3693. outact.dLoc = [0, 0, 0]
  3694. outact.dRot = [0, 0, 0]
  3695. if lq5on == 1:
  3696. if own['gt_cd2'] == 0:
  3697. own['gt_cd2'] = 60
  3698. if STANCE == True:
  3699. if own['footplant_on'] == True:
  3700. own.setLinearVelocity([(outvel.x + -bsoutvel), outvel.y, outvel.z], 1)
  3701. cont.activate(own.actuators["grindoutRight"])
  3702. if own['grind_out_type'] == None:
  3703. own['grind_out_type'] = 'bs fak back'
  3704. if STANCE == False:
  3705. if own['footplant_on'] == True:
  3706. own.setLinearVelocity([(outvel.x + bsoutvel), outvel.y, outvel.z], 1)
  3707. cont.activate(own.actuators["grindoutRight"])
  3708. if own['grind_out_type'] == None:
  3709. own['grind_out_type'] = 'bs reg back'
  3710. own["grindoutturn"] = gotcd
  3711. own['invert_on'] = 0
  3712. if lq1on == 1:
  3713. if own['gt_cd2'] == 0:
  3714. own['gt_cd2'] = 60
  3715. if STANCE == True:
  3716. if own['footplant_on'] == True:
  3717. own.setLinearVelocity([(outvel.x + bsoutvel), outvel.y, outvel.z], 1)
  3718. cont.activate(own.actuators["grindoutRight"])
  3719. if own['grind_out_type'] == None:
  3720. own['grind_out_type'] = 'bs fak forward'
  3721. if STANCE == False:
  3722. if own['footplant_on'] == True:
  3723. own.setLinearVelocity([(outvel.x + -bsoutvel), outvel.y, outvel.z], 1)
  3724. cont.activate(own.actuators["grindoutRight"])
  3725. if own['grind_out_type'] == None:
  3726. own['grind_out_type'] = 'bs reg forward'
  3727. own["grindoutturn"] = gotcd
  3728. own['invert_on'] = 0
  3729. if lq1on or lq2on or lq3on or lq4on or lq5on or lq6on or lq7on or lq8on:
  3730. gt_cd = own['gt_cd']
  3731. if gt_cd == 0:
  3732. gt_cd = 30
  3733. own['gt_cd'] = gt_cd
  3734. #else:
  3735. #else:
  3736. if own['grindoutturn'] == 0:
  3737. cont.deactivate(own.actuators["grindoutRight"])
  3738. own["grindoutturn"] = 0
  3739. gt_cd = own['gt_cd']
  3740. if gt_cd > 0:
  3741. own['gt_cd'] = gt_cd - 1
  3742. else:
  3743. own['gt_cd'] = 0
  3744. #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  3745. reg_move = .05
  3746. reg_rot = 0.02
  3747. reg_rot2 = .26
  3748. reg_move2 = .13
  3749. bsforce = 50
  3750. bs_dloc = .03
  3751. outvel = own.linearVelocity
  3752. if own['gt_cd2'] > 50 and own['jump_timer'] < 20:
  3753. if own['grind_out_type'] == 'reg right':
  3754. #print("do reg right")
  3755. own.applyMovement([0,reg_move,0], True)
  3756. own.applyRotation([0,0,reg_rot],True)
  3757. if own['grind_out_type'] == 'fak right':
  3758. own.applyMovement([0,-reg_move,0], True)
  3759. own.applyRotation([0,0,-reg_rot],True)
  3760. #print("do fak right")
  3761. if own['grind_out_type'] == 'reg left':
  3762. #print("do reg left")
  3763. own.applyMovement([0,-reg_move,0], True)
  3764. own.applyRotation([0,0,reg_rot],True)
  3765. if own['grind_out_type'] == 'fak left':
  3766. own.applyMovement([0,reg_move,0], True)
  3767. own.applyRotation([0,0,-reg_rot],True)
  3768. #print("do fak left")
  3769. if own['grind_out_type'] == 'reg fak right':
  3770. if own['gt_cd2'] > 55:
  3771. own.applyMovement([0,reg_move2,0], True)
  3772. own.applyRotation([0,0,reg_rot2],True)
  3773. #print("do reg fak right")
  3774. if own['grind_out_type'] == 'fak fak right':
  3775. if own['gt_cd2'] > 55:
  3776. own.applyMovement([0,-reg_move2,0], True)
  3777. own.applyRotation([0,0,reg_rot2],True)
  3778. #print("do fak fak right")
  3779. if own['grind_out_type'] == 'reg fak left':
  3780. if own['gt_cd2'] > 55:
  3781. own.applyMovement([0,-reg_move2,0], True)
  3782. own.applyRotation([0,0,-reg_rot2],True)
  3783. #print("do reg fak left")
  3784. if own['grind_out_type'] == 'fak fak left':
  3785. if own['gt_cd2'] > 55:
  3786. own.applyMovement([0,reg_move2,0], True)
  3787. own.applyRotation([0,0,-reg_rot2],True)
  3788. #print("do fak fak left")
  3789. if own['grind_out_type'] == 'reg right' or own['grind_out_type'] == 'reg left' or own['grind_out_type'] == 'fak right' or own['grind_out_type'] == 'fak left':
  3790. own.setLinearVelocity([outvel.x * 1.01, outvel.y, outvel.z], True)
  3791. if own['grind_out_type'] == 'reg fak right' or own['grind_out_type'] == 'reg fak left' or own['grind_out_type'] == 'fak fak right' or own['grind_out_type'] == 'fak fak left':
  3792. if own['gt_cd2'] == 51:
  3793. #print('outforce')
  3794. if STANCE == False:
  3795. own.applyForce([-200, 0, 0], True)
  3796. own['stance'] = True
  3797. STANCE = True
  3798. if STANCE == True:
  3799. own.applyForce([200, 0, 0], True)
  3800. own['stance'] = False
  3801. STANCE = False
  3802. if own['grind_out_type'] == 'bs reg back' or own['grind_out_type'] == 'bs fak forward':
  3803. if own['gt_cd2'] > 50:
  3804. if STANCE == True:
  3805. own.applyForce([bsforce, 0, 0], True)
  3806. if STANCE == False:
  3807. own.applyForce([bsforce, 0, 0], True)
  3808. own.applyMovement([bs_dloc,0,0], True)
  3809. if own['grind_out_type'] == 'bs fak back' or own['grind_out_type'] == 'bs reg forward':
  3810. if own['gt_cd2'] > 50:
  3811. if STANCE == True:
  3812. own.applyForce([-bsforce, 0, 0], True)
  3813. if STANCE == False:
  3814. own.applyForce([-bsforce, 0, 0], True)
  3815. own.applyMovement([-bs_dloc,0,0], True)
  3816. if own['gt_cd2'] > 0:
  3817. own['gt_cd2'] -= 1
  3818. if own['gt_cd2'] == 0:
  3819. own['grind_out_type'] = None
  3820. if own["grindoutturn"] > 0:
  3821. own["grindoutturn"] = own["grindoutturn"] - 1
  3822. def air_height():
  3823. height = own["air_height"]
  3824. if lf_ground == True and r_ground.triggered == False:
  3825. height = 0
  3826. #if
  3827. #wallride
  3828. def wallride():
  3829. wallride_off = own['wallride_off']
  3830. distance = own.getDistanceTo(gray.hitPosition)
  3831. upforce = 25
  3832. sideforce = 15
  3833. #distance = own["air_height"]
  3834. try:
  3835. obj = gray.hitObject
  3836. objpos = obj.worldPosition
  3837. ownpos = own.worldPosition
  3838. distance = ownpos.z - objpos.z
  3839. #print(distance)
  3840. except:
  3841. pass
  3842. if wallrideL.triggered and wallride_off == 0 and r_ground.triggered == False:
  3843. #print("wallrideL", distance)
  3844. own['jump_timer'] = 0
  3845. if r_ground.triggered == False:
  3846. own["wallride"] = "L"
  3847. #print(own["wallride"])
  3848. cont.activate(wallrideconstL)
  3849. force = [0,sideforce,upforce]
  3850. own.applyForce(force,1)
  3851. #own.alignAxisToVect(obj.worldPosition, 1, .9)
  3852. #align
  3853. if STANCE == 0:
  3854. own['requestAction'] = 'reg_wall_r'
  3855. #skater.playAction("reg_wall_r", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3856. else:
  3857. own['requestAction'] = 'fak_wall_l'
  3858. #skater.playAction("fak_wall_l", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3859. #deck.playAction("a_reg_wall_r", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3860. #trucks.playAction("a_reg_wall_r", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3861. else:
  3862. if own["wallride"] != "R":
  3863. own["wallride"] = None
  3864. cont.deactivate(wallrideconstL)
  3865. killact(3000)
  3866. killact(3001)
  3867. killact(3002)
  3868. if wallrideR.triggered and wallride_off == 0:
  3869. own['jump_timer'] = 0
  3870. #print("wallrideR", distance)
  3871. if r_ground.triggered == False:
  3872. own["wallride"] = "R"
  3873. cont.activate(wallrideconstR)
  3874. force = [0,-sideforce,upforce]
  3875. own.applyForce(force,1)
  3876. #own.alignAxisToVect(obj.worldPosition, 1, .9)
  3877. if STANCE == 0:
  3878. own['requestAction'] = 'reg_wall_l'
  3879. #skater.playAction("reg_wall_l", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3880. else:
  3881. own['requestAction'] = 'fak_wall_r'
  3882. #skater.playAction("fak_wall_r", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3883. #deck.playAction("a_reg_wall_l2", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3884. #trucks.playAction("a_reg_wall_l2", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3885. else:
  3886. if own["wallride"] != "L":
  3887. own["wallride"] = None
  3888. cont.deactivate(wallrideconstR)
  3889. killact(3003)
  3890. killact(3004)
  3891. killact(3005)
  3892. def wallride_sound():
  3893. sact = own.actuators["wallSound"]
  3894. if own["wallride"] != None and (own['actionState'] == 'reg_wall_r' or own['actionState'] == 'reg_wall_l' or own['actionState'] == 'fak_wall_r' or own['actionState'] == 'fak_wall_l'):
  3895. sact.volume = .2
  3896. cont.activate(own.actuators["wallSound"])
  3897. else:
  3898. sact.volume = .001
  3899. sact.stopSound()
  3900. if own['revert_timer'] > 0:
  3901. own['revert_timer'] = own['revert_timer'] - 1
  3902. def shutoff_timers():
  3903. #print(wallride)
  3904. if (LAST_GRIND == False and grindHit == True) or (jump_timer > 10 and own['wallride'] == None):
  3905. own["Q1oncd"] = 0
  3906. own["Q2oncd"] = 0
  3907. own["Q3oncd"] = 0
  3908. own["Q4oncd"] = 0
  3909. own["Q5oncd"] = 0
  3910. own["Q6oncd"] = 0
  3911. own["Q7oncd"] = 0
  3912. own["Q8oncd"] = 0
  3913. def grindout_cleanup():
  3914. lgf = own['last_grind_frame']
  3915. def trans_jump():
  3916. if own['jump_from_trans'] == 1:
  3917. ground_ray = cont.sensors['ground_look']
  3918. jump_obj = own['trans_jump_obj']
  3919. jump_obj = scene.objects[str(own['trans_jump_obj'])]
  3920. #print(jump_obj)
  3921. worldVect = [1, 0, 0]
  3922. vect = jump_obj.getAxisVect(worldVect)
  3923. go = jump_obj.worldOrientation
  3924. grinder_axis = [0,1,0]
  3925. player_pos = own.worldPosition
  3926. jump_obj = jump_obj.worldPosition
  3927. try:
  3928. delta = player_pos - jump_obj
  3929. except:
  3930. #print("delta broke: ", player_pos, grinder_pos)
  3931. pass
  3932. delta = delta.cross(vect)
  3933. deltamove = delta[1] * .25
  3934. move = [deltamove, 0, 0]
  3935. #print(deltamove)
  3936. if abs(deltamove) < 1 and delta[1] < 1:
  3937. own.applyMovement(move, True)
  3938. def air_mover():
  3939. if r_ground.triggered == False and jump_timer > 53 and frames_since_grinding > 50:
  3940. #print(lUD)
  3941. if lUD > 0.075:
  3942. #print("air_mover", jump_timer)
  3943. if STANCE == 0:
  3944. force2 = [120, 0, 10]
  3945. if STANCE == 1:
  3946. force2 = [-120, 0, 10]
  3947. own.applyForce(force2, True)
  3948. #own.applyForce([0,0,5], False)
  3949. own['no_grind_pull'] = 1
  3950. if r_ground.triggered == False and jump_timer > 10 and lUD > 0.075 and frames_since_grinding > 50:
  3951. #print(lUD)
  3952. #print("air_mover", jump_timer)
  3953. if STANCE == 0:
  3954. force2 = [7, 0, 10]
  3955. if STANCE == 1:
  3956. force2 = [-7, 0, 10]
  3957. own.applyForce(force2, True)
  3958. own.applyForce([0,0,5], False)
  3959. own['air_mover'] = True
  3960. own['no_grind_pull'] = 1
  3961. else:
  3962. own['air_mover'] = False
  3963. framenum = own['framenum']
  3964. last_ground_frame = own['lF_ground_frame']
  3965. lF_air_frame = own['lF_air_frame']
  3966. frames_since_ground = framenum - lF_air_frame
  3967. if framenum - lF_air_frame > 30:
  3968. own['no_grind_pull'] = 0
  3969. #if grindHit == 1:
  3970. # skater.applyRotation([0,0,.05], False)
  3971. # deck.applyRotation([0,0,.05], False)
  3972. # trucks.applyRotation([0,0,.05], False)
  3973. #else:
  3974. # skater.applyRotation([0,0,.0], False)
  3975. # deck.applyRotation([0,0,.0], False)
  3976. # trucks.applyRotation([0,0,.0], False)
  3977. #control_calib() #scene must be enabled in main
  3978. jump_Timer()
  3979. check_landing()
  3980. #SWAG()
  3981. #isplaying()
  3982. nextframe()
  3983. wheelroll()
  3984. rollsound()
  3985. reset_pos()
  3986. ylimit()
  3987. getoffboard()
  3988. #switchcam()
  3989. move_flycam()
  3990. move_followcam()
  3991. grind_turn()
  3992. air_height()
  3993. wallride()
  3994. wallride_sound()
  3995. shutoff_timers()
  3996. grindout_cleanup()
  3997. air_mover()
  3998. linvelx = own.getLinearVelocity(True)
  3999. own["linvelx"] = linvelx.x
  4000. LAST_STANCE = STANCE
  4001. LAST_STANCE = own["stance"]
  4002. own["last_stance"] = STANCE
  4003. own["lastGrab"] = GRAB_ON
  4004. own['ground'] = r_ground.triggered
  4005. own['last_ground'] = r_ground.triggered
  4006. own["LAST_GRIND"] = grindHit
  4007. own["rotz"] = rot.z
  4008. own['walk'] = 0
  4009. own['lasty'] = yBut
  4010. own['lastlts'] = ltsBut
  4011. own['lastrts'] = rtsBut
  4012. own["lF_ground2"] = own["lF_ground"]
  4013. own['last_invert'] = invert_on
  4014. own['lastbkBut'] = bkBut
  4015. own['grab_type'] = grab_type
  4016. own['last_last_manual'] = own['last_manual']
  4017. own['last_manual'] = own['manual']
  4018. own['last_reg_manual'] = own['reg_manual']
  4019. own['last_fak_manual'] = own['fak_manual']
  4020. own['last_fak_nmanual'] = own['fak_nmanual']
  4021. own['last_reg_nmanual'] = own['reg_nmanual']
  4022. if own['manual'] == 1:
  4023. own['last_manual_frame'] = frame
  4024. own['last_hippy'] = own['hippy']
  4025. if aBut == 1 and own["lasta"] == 0:
  4026. own["lastaf"] = frame
  4027. if xBut == 1 and own["lastx"] == 0:
  4028. own["lastxf"] = frame
  4029. own["lasta"] = aBut
  4030. own["lastx"] = xBut
  4031. own['lastaBut_ground'] = aBut_ground
  4032. own['lastxBut_ground'] = xBut_ground
  4033. own["last_sel"] = own["sel"]
  4034. own["sel"] = bkBut
  4035. if r_ground.triggered and own["jump_timer"] < 20:
  4036. force2 = [0.0, 0, -10]
  4037. own.applyForce(force2, True)
  4038. #print('grindtouch = ', own['grindTouch'])
  4039. if (grindDar == False and r_ground.triggered and own['grindTouch'] == False) or own['jump_timer'] > 40:
  4040. own['grindType'] = ''
  4041. #print(own['grindType'])