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

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