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 162KB

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