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

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