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

controller2.py 162KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332
  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 == 1:
  901. pass
  902. if jump_timer > 0:
  903. jump_timer = jump_timer - 1
  904. own['jump_timer'] = jump_timer
  905. if own['grindjumpturn'] == True:
  906. jump_timer = 30
  907. own['jump_timer'] = jump_timer
  908. def pump():
  909. velocity = own['velocity']
  910. #regular
  911. local = True
  912. downforce = -.1
  913. if linVelocity.x < MAX_VEL and linVelocity.x >= -0 and STANCE == 1 and grindHit == False:
  914. countdown = COUNTDOWN
  915. yvel = linVelocity.x + SPEEDPUMP
  916. yvel2 = linVelocity.x + SPEEDPUMPFAST
  917. own['countdown'] = countdown
  918. force = [(yvel), 0, linVelocity.z + downforce]
  919. force2 = [(yvel2), 0, linVelocity.z + downforce]
  920. if rot.z < PUMP_SENS and rot.z > PUMP_SPEED_SENS:
  921. own.setLinearVelocity(force, local)
  922. if rot.z < PUMP_SENS and rot.z <= PUMP_SPEED_SENS:
  923. own.setLinearVelocity(force2, local)
  924. own['requestAction'] = 'fak_pump'
  925. #switch
  926. if linVelocity.x > -MAX_VEL and linVelocity.x <= 0 and STANCE == 0 and grindHit == False:
  927. countdown = COUNTDOWN
  928. yvel = linVelocity.x - SPEEDPUMP
  929. yvel2 = linVelocity.x - SPEEDPUMPFAST
  930. own['countdown'] = countdown
  931. force = [(yvel), 0, linVelocity.z + downforce]
  932. force2 = [(yvel2), 0, linVelocity.z + downforce]
  933. if rot.z < PUMP_SENS and rot.z > PUMP_SPEED_SENS:
  934. own.setLinearVelocity(force, local)
  935. if rot.z < PUMP_SENS and rot.z <= PUMP_SPEED_SENS:
  936. own.setLinearVelocity(force2, local)
  937. own['requestAction'] = 'reg_pump'
  938. own["Pump"] = True
  939. own["lastPump"] = True
  940. def roll():
  941. if r_ground.triggered == 1:
  942. pass
  943. def stop():
  944. if r_ground.triggered == 1 and STANCE == False:
  945. skater.playAction("reg_stop", 1,30, layer=18, priority=59, blendin=10, play_mode=1, speed=.5)
  946. yvel = linVelocity.x * .985
  947. force = [(yvel), 0, linVelocity.z]
  948. own.setLinearVelocity(force, True)
  949. if lastStop == False:
  950. skater.playAction("reg_stopin", 1,15, layer=61, priority=3, blendin=10, play_mode=0, speed=.5)
  951. elif r_ground.triggered == 1 and STANCE == True:
  952. skater.playAction("fak_stop", 1,30, layer=19, priority=7, blendin=10, play_mode=1, speed=.5)
  953. yvel = linVelocity.x * .985
  954. force = [(yvel), 0, linVelocity.z]
  955. own.setLinearVelocity(force, True)
  956. if lastStop == False:
  957. skater.playAction("fak_stopin", 1,15, layer=62, priority=3, blendin=10, play_mode=0, speed=.5)
  958. own["lastStop"] = True
  959. if linVelocity.x < .05 and linVelocity.x > -.05 and own["lastStop"] == True:
  960. own["lastStop"] == False
  961. skater.stopAction(7)
  962. skater.stopAction(1)
  963. if STANCE == True:
  964. skater.playAction("fak_stopin", 15,1, layer=63, priority=3, blendin=10, play_mode=0, speed=.5)
  965. elif STANCE == False:
  966. skater.playAction("reg_stopin", 15,1, layer=64, priority=3, blendin=10, play_mode=0, speed=.5)
  967. def oposin():
  968. if skater.isPlayingAction(30) or skater.isPlayingAction(31):
  969. landing = 1
  970. else:
  971. landing = 0
  972. if (r_ground.triggered == 1) and STANCE == False and landing == 0 and own['manual'] == 0:
  973. if grindold == 0:
  974. own['requestAction'] = 'reg_opos'
  975. elif (r_ground.triggered == 1) and STANCE == True and own['manual'] == 0:
  976. if grindold == 0:
  977. own['requestAction'] = 'fak_opos'
  978. else:
  979. killact(65)
  980. killact(66)
  981. killact(67)
  982. killact(68)
  983. own["last_Opos"] = True
  984. def noposin():
  985. if skater.isPlayingAction(30) or skater.isPlayingAction(31):
  986. landing = 1
  987. else:
  988. landing = 0
  989. if (r_ground.triggered == 1) and STANCE == False and landing == 0 and own['manual'] == 0:
  990. if grindold == 0:
  991. own['requestAction'] = 'reg_nopos'
  992. elif (r_ground.triggered == 1) and STANCE == True and own['manual'] == 0:
  993. if grindold == 0:
  994. own['requestAction'] = 'fak_nopos'
  995. else:
  996. killact(71)
  997. killact(72)
  998. killact(73)
  999. killact(74)
  1000. own["last_nOpos"] = True
  1001. def aollie():
  1002. print("ollie")
  1003. dict['trick_string'] = 'Ollie'
  1004. r_ground = cont.sensors["r_Ground"]
  1005. trigger = r_ground.triggered
  1006. STANCE = own["stance"]
  1007. wallride = own["wallride"]
  1008. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1009. own["wallride_off"] = 1
  1010. own['requestAction'] = 'reg_ollie'
  1011. jump()
  1012. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1013. own["wallride_off"] = 1
  1014. own['requestAction'] = 'fak_ollie'
  1015. jump()
  1016. def nollie():
  1017. print("nollie")
  1018. dict['trick_string'] = 'Nollie'
  1019. r_ground = cont.sensors["r_Ground"]
  1020. trigger = r_ground.triggered
  1021. STANCE = own["stance"]
  1022. if (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1023. own['requestAction'] = 'fak_nollie'
  1024. own["wallride_off"] = 1
  1025. jump()
  1026. elif (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1027. own["wallride_off"] = 1
  1028. own['requestAction'] = 'reg_nollie'
  1029. jump()
  1030. def kickflip():
  1031. print("kickflip")
  1032. dict['trick_string'] = 'Kickflip'
  1033. STANCE = own["stance"]
  1034. print(flip_start_lay)
  1035. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1036. own["wallride_off"] = 1
  1037. own['requestAction'] = 'reg_kickflip'
  1038. jump()
  1039. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1040. own["wallride_off"] = 1
  1041. own['requestAction'] = 'fak_kickflip'
  1042. jump()
  1043. if own["wallride"] !=1: jump()
  1044. if r_ground.triggered == 0 and STANCE == False:
  1045. own["wallride_off"] = 1
  1046. own['requestAction'] = 'reg_kickflip'
  1047. if own["wallride"] != None:
  1048. jump()
  1049. elif r_ground.triggered == 0 and STANCE == True:
  1050. own["wallride_off"] = 1
  1051. own['requestAction'] = 'fak_kickflip'
  1052. if own["wallride"] != None:
  1053. jump()
  1054. def varial_kickflip():
  1055. print("varial kickflip")
  1056. dict['trick_string'] = 'Varial Kickflip'
  1057. STANCE = own["stance"]
  1058. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1059. own["wallride_off"] = 1
  1060. own['requestAction'] = 'reg_varial_kickflip'
  1061. jump()
  1062. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1063. own["wallride_off"] = 1
  1064. own['requestAction'] = 'fak_varial_kickflip'
  1065. jump()
  1066. if r_ground.triggered == 0 and STANCE == False:
  1067. own["wallride_off"] = 1
  1068. if own["wallride"] != None:
  1069. jump()
  1070. elif r_ground.triggered == 0 and STANCE == True:
  1071. own["wallride_off"] = 1
  1072. if own["wallride"] != None:
  1073. jump()
  1074. def nollie_varial_kickflip():
  1075. print("nollie varial kickflip")
  1076. dict['trick_string'] = 'Nollie Varial Kickflip'
  1077. STANCE = own["stance"]
  1078. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1079. own["wallride_off"] = 1
  1080. own['requestAction'] = 'reg_nollie_varial_kickflip'
  1081. jump()
  1082. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1083. own["wallride_off"] = 1
  1084. own['requestAction'] = 'fak_nollie_varial_kickflip'
  1085. jump()
  1086. if r_ground.triggered == 0 and STANCE == False:
  1087. own["wallride_off"] = 1
  1088. if own["wallride"] != None:
  1089. jump()
  1090. elif r_ground.triggered == 0 and STANCE == True:
  1091. own["wallride_off"] = 1
  1092. if own["wallride"] != None:
  1093. jump()
  1094. def nollie_varial_heelflip():
  1095. print("nollie varial heelflip")
  1096. dict['trick_string'] = 'Nollie Varial Heelflip'
  1097. STANCE = own["stance"]
  1098. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1099. own["wallride_off"] = 1
  1100. own['requestAction'] = 'reg_nollie_varial_heelflip'
  1101. jump()
  1102. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1103. own["wallride_off"] = 1
  1104. own['requestAction'] = 'fak_nollie_varial_heelflip'
  1105. jump()
  1106. if r_ground.triggered == 0 and STANCE == False:
  1107. own["wallride_off"] = 1
  1108. if own["wallride"] != None:
  1109. jump()
  1110. elif r_ground.triggered == 0 and STANCE == True:
  1111. own["wallride_off"] = 1
  1112. if own["wallride"] != None:
  1113. jump()
  1114. def varial_heelflip():
  1115. print("varial heelflip")
  1116. dict['trick_string'] = 'Varial Heelflip'
  1117. STANCE = own["stance"]
  1118. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1119. own["wallride_off"] = 1
  1120. own['requestAction'] = 'reg_varial_heelflip'
  1121. jump()
  1122. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1123. own["wallride_off"] = 1
  1124. own['requestAction'] = 'fak_varial_heelflip'
  1125. jump()
  1126. if r_ground.triggered == 0 and STANCE == False:
  1127. own["wallride_off"] = 1
  1128. if own["wallride"] != None:
  1129. jump()
  1130. elif r_ground.triggered == 0 and STANCE == True:
  1131. own["wallride_off"] = 1
  1132. if own["wallride"] != None:
  1133. jump()
  1134. def nollie_kickflip():
  1135. print("kickflip")
  1136. STANCE = own["stance"]
  1137. dict['trick_string'] = 'Nollie Kickflip'
  1138. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1139. own["wallride_off"] = 1
  1140. own['requestAction'] = 'reg_nollie_kickflip'
  1141. jump()
  1142. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1143. own["wallride_off"] = 1
  1144. own['requestAction'] = 'fak_nollie_kickflip'
  1145. jump()
  1146. if r_ground.triggered == 0 and STANCE == False:
  1147. own["wallride_off"] = 1
  1148. if own["wallride"] != None:
  1149. print("wall out trick")
  1150. #jump()
  1151. elif r_ground.triggered == 0 and STANCE == True:
  1152. own["wallride_off"] = 1
  1153. if own["wallride"] != None:
  1154. print("wall out trick")
  1155. #jump()
  1156. def heelflip():
  1157. print("heelflip")
  1158. dict['trick_string'] = 'Heelflip'
  1159. STANCE = own["stance"]
  1160. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1161. own["wallride_off"] = 1
  1162. own['requestAction'] = 'reg_heelflip'
  1163. jump()
  1164. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1165. own["wallride_off"] = 1
  1166. own['requestAction'] = 'fak_heelflip'
  1167. jump()
  1168. if r_ground.triggered == 0 and STANCE == False:
  1169. own["wallride_off"] = 1
  1170. if own["wallride"] != None:
  1171. print("wall out trick")
  1172. #jump()
  1173. elif r_ground.triggered == 0 and STANCE == True:
  1174. own["wallride_off"] = 1
  1175. if own["wallride"] != None:
  1176. print("wall out trick")
  1177. #jump()
  1178. def nollie_heelflip():
  1179. print("heelflip")
  1180. dict['trick_string'] = 'Nollie Heelflip'
  1181. STANCE = own["stance"]
  1182. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1183. own["wallride_off"] = 1
  1184. own['requestAction'] = 'reg_nollie_heelflip'
  1185. jump()
  1186. elif (r_ground.triggered == 1 and STANCE == True) or (grindHit == True and STANCE == True):
  1187. own["wallride_off"] = 1
  1188. own['requestAction'] = 'fak_nollie_heelflip'
  1189. jump()
  1190. if r_ground.triggered == 0 and STANCE == False:
  1191. own["wallride_off"] = 1
  1192. if own["wallride"] != None:
  1193. jump()
  1194. elif r_ground.triggered == 0 and STANCE == True:
  1195. own["wallride_off"] = 1
  1196. if own["wallride"] != None:
  1197. jump()
  1198. def shovit():
  1199. print("shovit")
  1200. dict['trick_string'] = 'Shovit'
  1201. STANCE = own["stance"]
  1202. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1203. own["wallride_off"] = 1
  1204. own['requestAction'] = 'reg_shovit'
  1205. jump()
  1206. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1207. own["wallride_off"] = 1
  1208. own['requestAction'] = 'fak_shovit'
  1209. jump()
  1210. if r_ground.triggered == 0 and STANCE == False:
  1211. if own["wallride"] != None:
  1212. jump()
  1213. elif r_ground.triggered == 0 and STANCE == True:
  1214. own["wallride_off"] = 1
  1215. if own["wallride"] != None:
  1216. jump()
  1217. def shovit360():
  1218. print("360shovit")
  1219. dict['trick_string'] = '360 Shovit'
  1220. STANCE = own["stance"]
  1221. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1222. own["wallride_off"] = 1
  1223. own['requestAction'] = 'reg_shovit360'
  1224. jump()
  1225. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1226. own["wallride_off"] = 1
  1227. own['requestAction'] = 'fak_shovit360'
  1228. jump()
  1229. if r_ground.triggered == 0 and STANCE == False:
  1230. own["wallride_off"] = 1
  1231. if own["wallride"] != None:
  1232. jump()
  1233. elif r_ground.triggered == 0 and STANCE == True:
  1234. own["wallride_off"] = 1
  1235. if own["wallride"] != None:
  1236. jump()
  1237. def fsshovit360():
  1238. print("360shovit")
  1239. dict['trick_string'] = '360 Shovit'
  1240. STANCE = own["stance"]
  1241. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1242. own["wallride_off"] = 1
  1243. own['requestAction'] = 'reg_fsshovit360'
  1244. jump()
  1245. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1246. own["wallride_off"] = 1
  1247. own['requestAction'] = 'fak_fsshovit360'
  1248. jump()
  1249. if r_ground.triggered == 0 and STANCE == False:
  1250. own["wallride_off"] = 1
  1251. if own["wallride"] != None:
  1252. jump()
  1253. elif r_ground.triggered == 0 and STANCE == True:
  1254. own["wallride_off"] = 1
  1255. if own["wallride"] != None:
  1256. jump()
  1257. def nollie_shovit():
  1258. print("shovit")
  1259. dict['trick_string'] = 'Nollie Shovit'
  1260. STANCE = own["stance"]
  1261. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1262. own["wallride_off"] = 1
  1263. own['requestAction'] = 'reg_nollie_shovit'
  1264. jump()
  1265. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1266. own["wallride_off"] = 1
  1267. own['requestAction'] = 'fak_nollie_shovit'
  1268. jump()
  1269. if r_ground.triggered == 0 and STANCE == False:
  1270. own["wallride_off"] = 1
  1271. if own["wallride"] != None:
  1272. jump()
  1273. elif r_ground.triggered == 0 and STANCE == True:
  1274. own["wallride_off"] = 1
  1275. if own["wallride"] != None:
  1276. jump()
  1277. def fsshovit():
  1278. dict['trick_string'] = 'Frontside Shovit'
  1279. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1280. own["wallride_off"] = 1
  1281. own['requestAction'] = 'reg_fsshovit'
  1282. jump()
  1283. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1284. own["wallride_off"] = 1
  1285. own['requestAction'] = 'fak_fsshovit'
  1286. jump()
  1287. if r_ground.triggered == 0 and STANCE == False:
  1288. own["wallride_off"] = 1
  1289. if own["wallride"] != None:
  1290. jump()
  1291. elif r_ground.triggered == 0 and STANCE == True:
  1292. own["wallride_off"] = 1
  1293. if own["wallride"] != None:
  1294. jump()
  1295. def nollie_fsshovit():
  1296. dict['trick_string'] = 'Nollie Frontside Shovit'
  1297. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1298. own["wallride_off"] = 1
  1299. own['requestAction'] = 'reg_nollie_fsshovit'
  1300. jump()
  1301. elif (r_ground.triggered == 1 and STANCE == True) or (grindHit == True and STANCE == True):
  1302. own["wallride_off"] = 1
  1303. own['requestAction'] = 'fak_nollie_fsshovit'
  1304. jump()
  1305. if r_ground.triggered == 0 and STANCE == False:
  1306. own["wallride_off"] = 1
  1307. if own["wallride"] != None:
  1308. jump()
  1309. elif r_ground.triggered == 0 and STANCE == True:
  1310. own["wallride_off"] = 1
  1311. if own["wallride"] != None:
  1312. jump()
  1313. #nollie_shovit360()
  1314. def nollie_shovit360():
  1315. dict['trick_string'] = 'Nollie Frontside Shovit 360'
  1316. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1317. own["wallride_off"] = 1
  1318. own['requestAction'] = 'reg_nollie_shovit360'
  1319. jump()
  1320. elif (r_ground.triggered == 1 and STANCE == True) or (grindHit == True and STANCE == True):
  1321. own["wallride_off"] = 1
  1322. own['requestAction'] = 'fak_nollie_shovit360'
  1323. jump()
  1324. if r_ground.triggered == 0 and STANCE == False:
  1325. own["wallride_off"] = 1
  1326. if own["wallride"] != None:
  1327. jump()
  1328. elif r_ground.triggered == 0 and STANCE == True:
  1329. own["wallride_off"] = 1
  1330. if own["wallride"] != None:
  1331. jump()
  1332. #nollie_fsshovit360()
  1333. def nollie_fsshovit360():
  1334. dict['trick_string'] = 'Nollie Frontside Shovit'
  1335. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1336. own["wallride_off"] = 1
  1337. own['requestAction'] = 'reg_nollie_fsshovit'
  1338. jump()
  1339. elif (r_ground.triggered == 1 and STANCE == True) or (grindHit == True and STANCE == True):
  1340. own["wallride_off"] = 1
  1341. own['requestAction'] = 'fak_nollie_fsshovit'
  1342. jump()
  1343. if r_ground.triggered == 0 and STANCE == False:
  1344. own["wallride_off"] = 1
  1345. if own["wallride"] != None:
  1346. jump()
  1347. elif r_ground.triggered == 0 and STANCE == True:
  1348. own["wallride_off"] = 1
  1349. if own["wallride"] != None:
  1350. jump()
  1351. def frontside_grab_on():
  1352. GRAB_PLAYED = own["GRAB_PLAYED"]
  1353. GRAB_ON = own["GRAB_ON"]
  1354. dict['trick_string'] = 'Mute Grab'
  1355. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1356. own['requestAction'] = 'frontside_grab'
  1357. #skater.playAction("reg_fg", 10,30, layer=400, priority=5, play_mode=1, speed=.5)
  1358. grablay2 = grablay + 1
  1359. GRAB_PLAYED = True
  1360. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1361. elif r_ground.triggered == 1:
  1362. killact(400)
  1363. killact(401)
  1364. def backside_grab_on():
  1365. GRAB_PLAYED = own["GRAB_PLAYED"]
  1366. GRAB_ON = own["GRAB_ON"]
  1367. if GRAB_ON == True and r_ground.triggered == 0 and aBut == True:
  1368. skater.playAction("reg_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  1369. deck.playAction("a_reg_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  1370. trucks.playAction("a_reg_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  1371. elif GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1372. own['requestAction'] = 'backside_grab'
  1373. GRAB_PLAYED = True
  1374. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1375. elif r_ground.triggered == 1:
  1376. killact(402)
  1377. def fakfrontside_grab_on():
  1378. GRAB_PLAYED = own["GRAB_PLAYED"]
  1379. GRAB_ON = own["GRAB_ON"]
  1380. if GRAB_ON == True and r_ground.triggered == 0 and aBut == True:
  1381. skater.playAction("fak_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  1382. deck.playAction("a_fak_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  1383. trucks.playAction("a_fak_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  1384. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1385. own['requestAction'] = 'fak_frontside_grab'
  1386. GRAB_PLAYED = True
  1387. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1388. elif r_ground.triggered == 1:
  1389. killact(403)
  1390. def fakbackside_grab_on():
  1391. GRAB_PLAYED = own["GRAB_PLAYED"]
  1392. GRAB_ON = own["GRAB_ON"]
  1393. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1394. own['requestAction'] = 'fak_backside_grab'
  1395. GRAB_PLAYED = True
  1396. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1397. elif r_ground.triggered == 1:
  1398. killact(404)
  1399. #nose/tail grabs
  1400. def frontside_nose_grab_on():
  1401. GRAB_PLAYED = own["GRAB_PLAYED"]
  1402. GRAB_ON = own["GRAB_ON"]
  1403. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1404. own['requestAction'] = 'frontside_nose_grab'
  1405. GRAB_PLAYED = True
  1406. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1407. elif r_ground.triggered == 1:
  1408. killact(400)
  1409. print("frontside nosegrab on")
  1410. def frontside_tail_grab_on():
  1411. GRAB_PLAYED = own["GRAB_PLAYED"]
  1412. GRAB_ON = own["GRAB_ON"]
  1413. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1414. own['requestAction'] = 'frontside_tail_grab'
  1415. GRAB_PLAYED = True
  1416. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1417. elif r_ground.triggered == 1:
  1418. killact(400)
  1419. print("frontside tailgrab on")
  1420. def backside_nose_grab_on():
  1421. GRAB_PLAYED = own["GRAB_PLAYED"]
  1422. GRAB_ON = own["GRAB_ON"]
  1423. #airwalk
  1424. if GRAB_ON == True and r_ground.triggered == 0 and (aBut == True):
  1425. print("airwalk")
  1426. skater.playAction("reg_airwalk", 10,30, layer=405, priority=5, blendin=5, play_mode=1, speed=.5)
  1427. deck.playAction("a_reg_airwalk", 10,30, layer=405, priority=5, blendin=5, play_mode=1, speed=.5)
  1428. trucks.playAction("a_reg_airwalk", 10,30, layer=405, priority=5, blendin=5, play_mode=1, speed=.5)
  1429. #norm
  1430. elif GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1431. own['requestAction'] = 'backside_nose_grab'
  1432. GRAB_PLAYED = True
  1433. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1434. elif r_ground.triggered == 1:
  1435. killact(405)
  1436. print("backside nosegrab on")
  1437. def backside_tail_grab_on():
  1438. GRAB_PLAYED = own["GRAB_PLAYED"]
  1439. GRAB_ON = own["GRAB_ON"]
  1440. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1441. own['requestAction'] = 'backside_tail_grab'
  1442. GRAB_PLAYED = True
  1443. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1444. elif r_ground.triggered == 1:
  1445. killact(411)
  1446. print("backside tailgrab on")
  1447. #switch
  1448. def fak_frontside_nose_grab_on():
  1449. GRAB_PLAYED = own["GRAB_PLAYED"]
  1450. GRAB_ON = own["GRAB_ON"]
  1451. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1452. own['requestAction'] = 'fak_frontside_nose_grab'
  1453. GRAB_PLAYED = True
  1454. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1455. elif r_ground.triggered == 1:
  1456. killact(406)
  1457. print("fak frontside nosegrab on")
  1458. def fak_frontside_tail_grab_on():
  1459. GRAB_PLAYED = own["GRAB_PLAYED"]
  1460. GRAB_ON = own["GRAB_ON"]
  1461. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1462. own['requestAction'] = 'fak_frontside_tail_grab'
  1463. GRAB_PLAYED = True
  1464. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1465. elif r_ground.triggered == 1:
  1466. killact(412)
  1467. print("fak frontside tailgrab on")
  1468. def fak_backside_nose_grab_on():
  1469. GRAB_PLAYED = own["GRAB_PLAYED"]
  1470. GRAB_ON = own["GRAB_ON"]
  1471. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1472. own['requestAction'] = 'fak_backside_nose_grab'
  1473. GRAB_PLAYED = True
  1474. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1475. elif r_ground.triggered == 1:
  1476. killact(408)
  1477. print("fak backside nosegrab on")
  1478. def fak_backside_tail_grab_on():
  1479. GRAB_PLAYED = own["GRAB_PLAYED"]
  1480. GRAB_ON = own["GRAB_ON"]
  1481. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1482. #cont.activate(fak_backsidegrab)
  1483. own['requestAction'] = 'fak_backside_tail_grab'
  1484. GRAB_PLAYED = True
  1485. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1486. elif r_ground.triggered == 1:
  1487. killact(410)
  1488. print("fak backside tailgrab on")
  1489. #--------------------
  1490. def SWAG():
  1491. if r_ground.triggered == 1:
  1492. SWAG = own["swag"]
  1493. SWAG = own.getLinearVelocity(True)
  1494. SWAG = SWAG[1]
  1495. own["swag"] = SWAG
  1496. #print(SWAG)
  1497. if STANCE == True:
  1498. if SWAG > 1 and SWAG < 2:
  1499. rotation = [ 0.0, 0, (SWAG / 200)]
  1500. own.applyRotation( rotation, True)
  1501. elif SWAG > 2:
  1502. rotation = [ 0.0, 0, (SWAG / 50)]
  1503. own.applyRotation( rotation, True)
  1504. elif SWAG < -1 and SWAG > -2:
  1505. rotation = [ 0.0, 0, (SWAG / 200)]
  1506. own.applyRotation( rotation, True)
  1507. elif SWAG < -2:
  1508. rotation = [ 0.0, 0, (SWAG / 50)]
  1509. own.applyRotation( rotation, True)
  1510. if STANCE == False:
  1511. if SWAG > 1 and SWAG < 2:
  1512. rotation = [ 0.0, 0, (-SWAG / 200)]
  1513. own.applyRotation( rotation, True)
  1514. elif SWAG > 2:
  1515. rotation = [ 0.0, 0, (-SWAG / 50)]
  1516. own.applyRotation( rotation, True)
  1517. elif SWAG < -1 and SWAG > -2:
  1518. rotation = [ 0.0, 0, (-SWAG / 200)]
  1519. own.applyRotation( rotation, True)
  1520. elif SWAG < -2:
  1521. rotation = [ 0.0, 0, (-SWAG / 50)]
  1522. own.applyRotation( rotation, True)
  1523. def air():
  1524. if r_ground.triggered == False and own['airup'] == 0:
  1525. distance = own.getDistanceTo(gray.hitPosition)
  1526. since_grind_buf = 3
  1527. if gray.hitObject != None and grindDar2.triggered == False and (frame - lgf) > since_grind_buf:
  1528. if distance < .5:
  1529. own.alignAxisToVect(gray.hitNormal, 2, .1)
  1530. elif distance >= .5 and distance < 1.75:
  1531. own.alignAxisToVect(gray.hitNormal, 2, .05)
  1532. elif distance >= 1.75:
  1533. own.alignAxisToVect([0.0,0.0,1.0], 2, .03)
  1534. if grindDar2.triggered and (frame - lgf) > since_grind_buf:
  1535. if distance < .5:
  1536. own.alignAxisToVect(gray.hitNormal, 2, .1)
  1537. elif distance >= .5 and distance < 1.75:
  1538. own.alignAxisToVect(gray.hitNormal, 2, .03)
  1539. elif distance >= 1.75:
  1540. own.alignAxisToVect([0.0,0.0,1.0], 2, .03)
  1541. elif r_ground.triggered == True:
  1542. pass
  1543. def stopAnims():
  1544. pass
  1545. def isplaying():
  1546. # for x in range(9000):
  1547. # l1 = deck.isPlayingAction(x)
  1548. # if l1 == True:
  1549. # print(x)
  1550. pass
  1551. def nextframe():
  1552. framenumber = own["framenum"]
  1553. framenumber = framenumber + 1
  1554. if framenumber == 900000:
  1555. framenumber = 0
  1556. own["framenum"] = framenumber
  1557. #print(framenumber)
  1558. def push():
  1559. local = True
  1560. #print("push")
  1561. linVelocity15 = own.linearVelocity
  1562. 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:
  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'] = 'fak_push_goof'
  1569. #switch
  1570. if linVelocity15.x > -MAX_VEL and linVelocity15.x < 0 and r_ground.triggered == True and own['hippy'] == 0 and own['last_hippy'] == 0:
  1571. countdown = COUNTDOWN
  1572. yvel = linVelocity15.x - SPEEDUP
  1573. own['countdown'] = countdown
  1574. force = [(yvel), 0, linVelocity15.z]
  1575. own.setLinearVelocity(force, local)
  1576. own['requestAction'] = 'reg_push'
  1577. def push_goof():
  1578. linVelocity15 = own.linearVelocity
  1579. local = True
  1580. #print("push goof")
  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'] = 'fak_push'
  1588. #switch
  1589. if linVelocity15.x > -MAX_VEL and linVelocity15.x < 0 and r_ground.triggered == True and own['hippy'] == 0 and own['last_hippy'] == 0:
  1590. countdown = COUNTDOWN
  1591. yvel = linVelocity15.x - SPEEDUP
  1592. own['countdown'] = countdown
  1593. force = [(yvel), 0, linVelocity15.z]
  1594. own.setLinearVelocity(force, local)
  1595. own['requestAction'] = 'reg_push_goof'
  1596. def brfoot():
  1597. lay = grablay + 40
  1598. if STANCE == 0:
  1599. skater.playAction("brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1600. deck.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1601. trucks.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1602. if STANCE == 1:
  1603. skater.playAction("fak_brfoot", 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. jump()
  1607. def frfoot():
  1608. lay = grablay + 40
  1609. killact(5)
  1610. if STANCE == 0:
  1611. skater.playAction("frfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1612. deck.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1613. trucks.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1614. if STANCE == 1:
  1615. skater.playAction("fakbfrfoot", 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. jump()
  1619. def blfoot():
  1620. lay = grablay + 40
  1621. killact(5)
  1622. if STANCE == 0:
  1623. skater.playAction("blfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1624. deck.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1625. trucks.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1626. if STANCE == 1:
  1627. skater.playAction("fakfrfoot.001", 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. jump()
  1631. def flfoot():
  1632. lay = grablay + 40
  1633. killact(5)
  1634. if STANCE == 0:
  1635. skater.playAction("flfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1636. deck.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1637. trucks.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1638. if STANCE == 1:
  1639. skater.playAction("fak_flfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1640. deck.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1641. trucks.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1642. jump()
  1643. def rollsound():
  1644. #onground
  1645. if r_ground.triggered == 1 and grindDar == 0 and own['invert_on'] == 0:
  1646. num1 = .05
  1647. num2 = .25
  1648. if linVelocity.x <= -num1 and linVelocity.x >= num1:
  1649. own.actuators["sroll"].volume = .0001
  1650. cont.deactivate(own.actuators["sroll"])
  1651. own.actuators["sroll"].stopSound()
  1652. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1653. own.actuators["sroll"].volume = .02
  1654. own.actuators["sroll"].pitch = .65
  1655. num1 = .25
  1656. num2 = .5
  1657. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1658. own.actuators["sroll"].volume = .03
  1659. own.actuators["sroll"].pitch = .7
  1660. num1 = .5
  1661. num2 = .75
  1662. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1663. own.actuators["sroll"].volume = .04
  1664. own.actuators["sroll"].pitch = .75
  1665. num1 = .75
  1666. num2 = 1
  1667. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1668. own.actuators["sroll"].volume = .05
  1669. own.actuators["sroll"].pitch = .8
  1670. num1 = 1
  1671. num2 = 1.5
  1672. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1673. own.actuators["sroll"].volume = .06
  1674. own.actuators["sroll"].pitch = .85
  1675. num1 = 1.5
  1676. num2 = 2
  1677. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1678. own.actuators["sroll"].volume = .07
  1679. own.actuators["sroll"].pitch = .9
  1680. num1 = 2
  1681. num2 = 3
  1682. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1683. own.actuators["sroll"].volume = .08
  1684. own.actuators["sroll"].pitch = .95
  1685. num1 = 3
  1686. num2 = 4
  1687. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1688. own.actuators["sroll"].volume = .09
  1689. own.actuators["sroll"].pitch = 1
  1690. num1 = 4
  1691. num2 = 5
  1692. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1693. own.actuators["sroll"].volume = .11
  1694. own.actuators["sroll"].pitch = 1.05
  1695. num1 = 5
  1696. num2 = 6
  1697. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1698. own.actuators["sroll"].volume = .1
  1699. own.actuators["sroll"].pitch = 1.1
  1700. own.actuators['sroll'].mode = 2
  1701. cont.activate(own.actuators["sroll"])
  1702. if grindDar == 1 or own['invert_on'] == 1:
  1703. own.actuators["sroll"].volume = .0001
  1704. cont.deactivate(own.actuators["sroll"])
  1705. own.actuators["sroll"].stopSound()
  1706. #in air
  1707. if r_ground.triggered == False:
  1708. own.actuators["sroll"].volume = .0001
  1709. cont.deactivate(own.actuators["sroll"])
  1710. own.actuators["sroll"].stopSound()
  1711. act = cont.actuators["sroll"]
  1712. own['sroll_vol'] = act.volume
  1713. own['sroll_pitch'] = act.pitch
  1714. def wheelroll():
  1715. #still
  1716. if linVelocity.x <= -0.05 and linVelocity.x >= 0.05:
  1717. wheel1.stopAction(2)
  1718. wheel2.stopAction(2)
  1719. wheel3.stopAction(2)
  1720. wheel4.stopAction(2)
  1721. #regular
  1722. if linVelocity.x > 0.05 and linVelocity.x < .5:
  1723. wheel2.playAction("roll1.001", 1,20, layer=2, play_mode=0, speed=.25)
  1724. wheel3.playAction("roll2.001", 1,20, layer=2, play_mode=0, speed=.25)
  1725. wheel4.playAction("roll3.001", 1,20, layer=2, play_mode=0, speed=.25)
  1726. wheel1.playAction("roll4.001", 1,20, layer=2, play_mode=0, speed=.25)
  1727. if linVelocity.x > 0.5 and linVelocity.x < 1:
  1728. wheel2.playAction("roll1.001", 1,20, layer=2, play_mode=1, speed=1)
  1729. wheel3.playAction("roll2.001", 1,20, layer=2, play_mode=1, speed=1)
  1730. wheel4.playAction("roll3.001", 1,20, layer=2, play_mode=1, speed=1)
  1731. wheel1.playAction("roll4.001", 1,20, layer=2, play_mode=1, speed=1)
  1732. if linVelocity.x > 1 and linVelocity.x < 4:
  1733. wheel2.playAction("roll1.001", 1,20, layer=2, play_mode=1, speed=1.5)
  1734. wheel3.playAction("roll2.001", 1,20, layer=2, play_mode=1, speed=1.5)
  1735. wheel4.playAction("roll3.001", 1,20, layer=2, play_mode=1, speed=1.5)
  1736. wheel1.playAction("roll4.001", 1,20, layer=2, play_mode=1, speed=1.5)
  1737. if linVelocity.x > 4:
  1738. wheel2.playAction("roll1.001", 1,20, layer=2, play_mode=1, speed=2)
  1739. wheel3.playAction("roll2.001", 1,20, layer=2, play_mode=1, speed=2)
  1740. wheel4.playAction("roll3.001", 1,20, layer=2, play_mode=1, speed=2)
  1741. wheel1.playAction("roll4.001", 1,20, layer=2, play_mode=1, speed=2)
  1742. #switch
  1743. if linVelocity.x < -0.05 and linVelocity.x > -.5:
  1744. wheel2.playAction("roll1.001", 20,1, layer=2, play_mode=0, speed=.25)
  1745. wheel3.playAction("roll2.001", 20,1, layer=2, play_mode=0, speed=.25)
  1746. wheel4.playAction("roll3.001", 20,1, layer=2, play_mode=0, speed=.25)
  1747. wheel1.playAction("roll4.001", 20,1, layer=2, play_mode=0, speed=.25)
  1748. if linVelocity.x < -0.5 and linVelocity.x > -1:
  1749. wheel2.playAction("roll1.001", 20,1, layer=2, play_mode=1, speed=1)
  1750. wheel3.playAction("roll2.001", 20,1, layer=2, play_mode=1, speed=1)
  1751. wheel4.playAction("roll3.001", 20,1, layer=2, play_mode=1, speed=1)
  1752. wheel1.playAction("roll4.001", 20,1, layer=2, play_mode=1, speed=1)
  1753. if linVelocity.x < -1 and linVelocity > -4:
  1754. wheel2.playAction("roll1.001", 20,1, layer=2, play_mode=1, speed=1.5)
  1755. wheel3.playAction("roll2.001", 20,1, layer=2, play_mode=1, speed=1.5)
  1756. wheel4.playAction("roll3.001", 20,1, layer=2, play_mode=1, speed=1.5)
  1757. wheel1.playAction("roll4.001", 20,1, layer=2, play_mode=1, speed=1.5)
  1758. if linVelocity.x < -4:
  1759. wheel2.playAction("roll1.001", 20,1, layer=2, play_mode=1, speed=2)
  1760. wheel3.playAction("roll2.001", 20,1, layer=2, play_mode=1, speed=2)
  1761. wheel4.playAction("roll3.001", 20,1, layer=2, play_mode=1, speed=2)
  1762. wheel1.playAction("roll4.001", 20,1, layer=2, play_mode=1, speed=2)
  1763. def transspeed():
  1764. num1 = .1
  1765. num2 = .4
  1766. speed = 20
  1767. def turn():
  1768. rotamt = .02
  1769. linVelocity2 = own.getLinearVelocity(True)
  1770. speed = .002
  1771. manual = 0
  1772. if own['manual_v2'] == 1:
  1773. manual = 1
  1774. if abs(linVelocity.x) < 2:
  1775. speed = .005
  1776. jumpstance = own['jump_stance']
  1777. if lLR > turnsens or lLR < -turnsens:
  1778. own["turn"] = 1
  1779. else:
  1780. own["turn"] = 0
  1781. if lUD > turnsens or lUD < -turnsens:
  1782. own["turnud"] = 1
  1783. else:
  1784. own["turnud"] = 0
  1785. #light
  1786. #if manual and grindhit = true
  1787. if lLR > turnsens and lLR < (turnsens * 1.3) and (grindHit == False or (manual == 1 and grindHit == True)):
  1788. rotation = [ 0.0, 0.0, (-rotamt)]
  1789. local = False # use world axis
  1790. own.applyRotation( rotation, local)
  1791. if r_ground.triggered == True:
  1792. #print("light turn")
  1793. if STANCE == 0:
  1794. own.setLinearVelocity([linVelocity2.x - speed, linVelocity2.y, linVelocity2.z], 1)
  1795. if STANCE == 1:
  1796. own.setLinearVelocity([linVelocity2.x + speed, linVelocity2.y, linVelocity2.z], 1)
  1797. if lLR < -turnsens and lLR > (turnsens * -1.3) and (grindHit == False or (manual == 1 and grindHit == True)):
  1798. rotation = [ 0.0, 0.0, rotamt]
  1799. local = False # use world axis
  1800. own.applyRotation( rotation, local)
  1801. if r_ground.triggered == True:
  1802. #print("light turn")
  1803. if STANCE == 0:
  1804. own.setLinearVelocity([linVelocity2.x - speed, linVelocity2.y, linVelocity2.z], 1)
  1805. if STANCE == 1:
  1806. own.setLinearVelocity([linVelocity2.x + speed, linVelocity2.y, linVelocity2.z], 1)
  1807. #medium
  1808. if lLR > (turnsens * 1.3) and (grindHit == False or (manual == 1 and grindHit == True)):
  1809. #turn left
  1810. if rot.z < .4:
  1811. rotation = [ 0.0, 0.0, (-rotamt * 5)]
  1812. if rot.z < .6 and rot.z > .4:
  1813. rotation = [ 0.0, 0.0, (-rotamt * 2)]
  1814. else:
  1815. rotation = [ 0.0, 0.0, (-rotamt * 1.6)]
  1816. local = True # use world axis
  1817. own.applyRotation( rotation, local)
  1818. if r_ground.triggered == True:
  1819. #print("med turn")
  1820. if STANCE == 0:
  1821. own.setLinearVelocity([linVelocity2.x - speed, linVelocity2.y, linVelocity2.z], 1)
  1822. if STANCE == 1:
  1823. own.setLinearVelocity([linVelocity2.x + speed, linVelocity2.y, linVelocity2.z], 1)
  1824. if lLR < (-turnsens * 1.3) and (grindHit == False or (manual == 1 and grindHit == True)):
  1825. #turn right
  1826. if rot.z < .4:
  1827. rotation = [ 0.0, 0.0, (rotamt * 5)]
  1828. if rot.z < .6 and rot.z > .4:
  1829. rotation = [ 0.0, 0.0, (rotamt * 2)]
  1830. else:
  1831. rotation = [ 0.0, 0.0, (rotamt * 1.6)]
  1832. local = True # use world axis
  1833. own.applyRotation( rotation, local)
  1834. if r_ground.triggered == True:
  1835. #print("med turn")
  1836. if STANCE == 0:
  1837. own.setLinearVelocity([linVelocity2.x - speed, linVelocity2.y, linVelocity2.z], 1)
  1838. if STANCE == 1:
  1839. own.setLinearVelocity([linVelocity2.x + speed, linVelocity2.y, linVelocity2.z], 1)
  1840. #air
  1841. if r_ground.triggered == False and lLR > turnsens and (grindHit == False or (manual == 1 and grindHit == True)) and own["wallride"] == None:
  1842. rotamt = .07
  1843. if STANCE == 0:
  1844. own.applyRotation([0,0,-rotamt], 1)
  1845. if STANCE == 1:
  1846. own.applyRotation([0,0,-rotamt], 1)
  1847. if r_ground.triggered == False and lLR < -turnsens and (grindHit == False or (manual == 1 and grindHit == True)) and own["wallride"] == None:
  1848. rotamt = .07
  1849. if STANCE == 0:
  1850. own.applyRotation([0,0,rotamt], 1)
  1851. if STANCE == 1:
  1852. own.applyRotation([0,0,rotamt], 1)
  1853. ###########
  1854. def grindsound():
  1855. dropin = own['dropinTimer']
  1856. lif = own['last_invert_frame']
  1857. if grindSound != None and grindHit == True and own['nogrindsound'] == 0:
  1858. if abs(linVelocity.x) > abs(linVelocity.y):
  1859. vel = linVelocity.x
  1860. elif abs(linVelocity.x) < abs(linVelocity.y):
  1861. vel = linVelocity.y
  1862. else:
  1863. vel = 0
  1864. if grindSound == "rail":
  1865. cont.deactivate(own.actuators['grind_cement'])
  1866. num1 = .000
  1867. num2 = .05
  1868. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1869. own.actuators["grind_rail"].volume = .0001
  1870. own.actuators["grind_rail"].pitch = .6
  1871. num1 = .05
  1872. num2 = .25
  1873. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1874. own.actuators["grind_rail"].volume = .05
  1875. own.actuators["grind_rail"].pitch = .7
  1876. num1 = .25
  1877. num2 = .5
  1878. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1879. own.actuators["grind_rail"].volume = .1
  1880. own.actuators["grind_rail"].pitch = .75
  1881. num1 = .5
  1882. num2 = .75
  1883. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1884. own.actuators["grind_rail"].volume = .14
  1885. own.actuators["grind_rail"].pitch = .8
  1886. num1 = .75
  1887. num2 = 1
  1888. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1889. own.actuators["grind_rail"].volume = .17
  1890. own.actuators["grind_rail"].pitch = .85
  1891. num1 = 1
  1892. num2 = 1.25
  1893. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1894. own.actuators["grind_rail"].volume = .18
  1895. own.actuators["grind_rail"].pitch = .9
  1896. num1 = 1.25
  1897. num2 = 2
  1898. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1899. own.actuators["grind_rail"].volume = .19
  1900. own.actuators["grind_rail"].pitch = .95
  1901. num1 = 2
  1902. num2 = 40
  1903. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1904. own.actuators["grind_rail"].volume = .19
  1905. own.actuators["grind_rail"].pitch = 1
  1906. cont.activate(own.actuators['grind_rail'])
  1907. if grindSound == "concrete":
  1908. #play sound
  1909. cont.deactivate(own.actuators['grind_rail'])
  1910. num1 = .000
  1911. num2 = .05
  1912. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1913. own.actuators["grind_cement"].volume = .01
  1914. own.actuators["grind_cement"].pitch = .6
  1915. num1 = .05
  1916. num2 = .25
  1917. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1918. own.actuators["grind_cement"].volume = .05
  1919. own.actuators["grind_cement"].pitch = .7
  1920. num1 = .25
  1921. num2 = .5
  1922. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1923. own.actuators["grind_cement"].volume = .1
  1924. own.actuators["grind_cement"].pitch = .75
  1925. num1 = .5
  1926. num2 = .75
  1927. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1928. own.actuators["grind_cement"].volume = .14
  1929. own.actuators["grind_cement"].pitch = .8
  1930. num1 = .75
  1931. num2 = 1
  1932. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1933. own.actuators["grind_cement"].volume = .17
  1934. own.actuators["grind_cement"].pitch = .85
  1935. num1 = 1
  1936. num2 = 1.25
  1937. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1938. own.actuators["grind_cement"].volume = .18
  1939. own.actuators["grind_cement"].pitch = .9
  1940. num1 = 1.25
  1941. num2 = 2
  1942. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1943. own.actuators["grind_cement"].volume = .19
  1944. own.actuators["grind_cement"].pitch = .95
  1945. num1 = 2
  1946. num2 = 40
  1947. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1948. own.actuators["grind_cement"].volume = .19
  1949. own.actuators["grind_cement"].pitch = 1
  1950. cont.activate(own.actuators['grind_cement'])
  1951. else:
  1952. cont.deactivate(own.actuators['grind_cement'])
  1953. cont.deactivate(own.actuators['grind_rail'])
  1954. def record_grindsound():
  1955. dropin = own['dropinTimer']
  1956. lif = own['last_invert_frame']
  1957. if grindHit == True and dropin == 0 and own['invert_on'] == 0 and own["LAST_GRIND"] == True and own["nogrindsound"] == 0 and (frame - lif > 13):
  1958. if grindSound == "concrete":
  1959. act = own.actuators["grind_cement"]
  1960. own['grindcement_vol'] = act.volume
  1961. own['grindcement_pitch'] = act.pitch
  1962. elif grindSound == "rail":
  1963. act = own.actuators["grind_rail"]
  1964. own['grindrail_vol'] = act.volume
  1965. own['grindrail_pitch'] = act.pitch
  1966. if own["LAST_GRIND"] == False:
  1967. own['grindcement_vol'] = 0
  1968. own['grindcement_pitch'] = 0
  1969. own['grindrail_vol'] = 0
  1970. own['grindrail_pitch'] = 0
  1971. def grind():
  1972. grindsound()
  1973. STANCE = own["stance"]
  1974. jumpstance = own["jump_stance"]
  1975. lif = frame - own['last_invert_frame']
  1976. if grindHit == True and own['invert_on'] == 0 and own['footplant_on'] == False and own['manual'] == 0 and lif > 40 and own['dropinTimer'] < 30:
  1977. gblend = 1
  1978. if LAST_GRIND == 0:
  1979. gt = own['grindType']
  1980. tempstance = 3
  1981. if jumpstance != 3:
  1982. tempstance = jumpstance
  1983. else:
  1984. tempstance = STANCE
  1985. grindpos = own['grindpos']
  1986. if grindpos == "reg_5050" and own['grindType'] == "empty":
  1987. own['grindType'] = grindpos
  1988. if own['grindType'] == "empty" and grindpos == 'reg_board':
  1989. if jumpstance == 1:
  1990. own['grindType'] = "fak_bsboard"
  1991. own["stance"] = True
  1992. STANCE = True
  1993. elif jumpstance == 0:
  1994. own['grindType'] = "reg_bsboard"
  1995. own["stance"] = False
  1996. STANCE = False
  1997. elif jumpstance == 3:
  1998. if STANCE == True:
  1999. own['grindType'] = "fak_bsboard"
  2000. else:
  2001. own['grindType'] = "reg_bsboard"
  2002. if STANCE == True:
  2003. if own['grindType'] == "reg_bsboard":
  2004. own['grind_stance'] = 0
  2005. own['requestAction'] = 'reg_bsboard'
  2006. elif own['grindType'] == "fak_bsboard":
  2007. own['grind_stance'] = 1
  2008. own['requestAction'] = 'fak_bsboard'
  2009. elif own['grindType'] == "reg_fsboard":
  2010. own['grind_stance'] = 0
  2011. own['requestAction'] = 'reg_fsboard'
  2012. elif own['grindType'] == "reg_tailg":
  2013. own['requestAction'] = 'reg_tailg'
  2014. elif own['grindType'] == "reg_tailgR":
  2015. own['requestAction'] = 'reg_tailgr'
  2016. elif own['grindType'] == "reg_tailgL":
  2017. own['requestAction'] = 'reg_tailgl'
  2018. elif own['grindType'] == "reg_noseg":
  2019. own['requestAction'] = 'reg_noseg'
  2020. elif own['grindType'] == "reg_nosegR":
  2021. own['requestAction'] = 'reg_nosegr'
  2022. elif own['grindType'] == "reg_nosegL":
  2023. own['requestAction'] = 'reg_nosegl'
  2024. elif own['grindType'] == "fak_noseg":
  2025. own['requestAction'] = 'fak_noseg'
  2026. elif own['grindType'] == "fak_nosegR":
  2027. own['requestAction'] = 'fak_nosegr'
  2028. elif own['grindType'] == "fak_nosegL":
  2029. own['requestAction'] = 'reg_nosegl'
  2030. elif own['grindType'] == "fak_tailg":
  2031. own['requestAction'] = 'fak_tailg'
  2032. elif own['grindType'] == "fak_tailgR":
  2033. own['requestAction'] = 'fak_tailgr'
  2034. elif own['grindType'] == "fak_tailgL":
  2035. own['requestAction'] = 'fak_tailgl'
  2036. elif own['grindType'] == "reg_tailslide":
  2037. own['requestAction'] = 'reg_tailslide'
  2038. own['grind_stance'] = 0
  2039. elif own['grindType'] == "fak_tailslide":
  2040. own['requestAction'] = 'fak_tailslide'
  2041. own['grind_stance'] = 1
  2042. elif own['grindType'] == "reg_noseslide":
  2043. own['requestAction'] = 'reg_noseslide'
  2044. own['grind_stance'] = 0
  2045. elif own['grindType'] == "fak_noseslide":
  2046. own['requestAction'] = 'fak_noseslide'
  2047. own['grind_stance'] = 1
  2048. elif own['grindType'] == "nose_stall":
  2049. own['requestAction'] = 'nose_stall'
  2050. skater.playAction("fak_nose_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2051. deck.playAction("a_fak_nose_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2052. trucks.playAction("a_fak_nose_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2053. elif own['grindType'] == "tail_stall":
  2054. own['requestAction'] = 'tail_stall'
  2055. skater.playAction("fak_tail_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2056. deck.playAction("a_fak_tail_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2057. trucks.playAction("a_fak_tail_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2058. else:
  2059. if STANCE == 0:
  2060. own['requestAction'] = 'reg_5050'
  2061. if STANCE == 1:
  2062. own['requestAction'] = 'fak_5050'
  2063. #elif STANCE == False and LAST_GRIND == False:
  2064. elif STANCE == False:
  2065. if own['grindType'] == "reg_bsboard":
  2066. own['grind_stance'] = 0
  2067. own['requestAction'] = 'reg_bsboard'
  2068. elif own['grindType'] == "fak_bsboard":
  2069. own['grind_stance'] = 1
  2070. own['requestAction'] = 'fak_bsboard'
  2071. elif own['grindType'] == "reg_tailg":
  2072. own['grind_stance'] = 0
  2073. own['requestAction'] = 'reg_tailg'
  2074. elif own['grindType'] == "reg_tailgR":
  2075. own['requestAction'] = 'reg_tailgr'
  2076. elif own['grindType'] == "reg_tailgL":
  2077. own['requestAction'] = 'reg_tailgl'
  2078. elif own['grindType'] == "reg_noseg":
  2079. own['requestAction'] = 'reg_noseg'
  2080. elif own['grindType'] == "reg_nosegR":
  2081. own['requestAction'] = 'reg_nosegr'
  2082. elif own['grindType'] == "reg_nosegL":
  2083. own['requestAction'] = 'reg_nosegl'
  2084. elif own['grindType'] == "fak_noseg":
  2085. own['requestAction'] = 'fak_noseg'
  2086. elif own['grindType'] == "fak_nosegR":
  2087. own['requestAction'] = 'fak_nosegr'
  2088. elif own['grindType'] == "fak_nosegL":
  2089. own['requestAction'] = 'fak_nosegl'
  2090. elif own['grindType'] == "fak_tailg":
  2091. own['requestAction'] = 'fak_tailg'
  2092. elif own['grindType'] == "fak_tailgR":
  2093. own['requestAction'] = 'fak_tailgr'
  2094. elif own['grindType'] == "fak_tailgL":
  2095. own['requestAction'] = 'fak_tailgl'
  2096. elif own['grindType'] == "reg_tailslide":
  2097. elif own['grindType'] == "fak_tailslide":
  2098. own['grind_stance'] = 1
  2099. own['requestAction'] = 'fak_tailslide'
  2100. elif own['grindType'] == "reg_noseslide":
  2101. own['grind_stance'] = 0
  2102. own['requestAction'] = 'reg_noseslide'
  2103. elif own['grindType'] == "fak_noseslide":
  2104. own['grind_stance'] = 1
  2105. own['requestAction'] = 'fak_noseslide'
  2106. elif own['grindType'] == "nose_stall":
  2107. skater.playAction("nose_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2108. deck.playAction("a_nose_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2109. trucks.playAction("a_nose_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2110. #print("nose_stall")
  2111. elif own['grindType'] == "tail_stall":
  2112. skater.playAction("reg_tail_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2113. deck.playAction("a_reg_tail_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2114. trucks.playAction("a_reg_tail_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2115. #print("reg_tail_stall")
  2116. else:
  2117. if STANCE == 0:
  2118. own['requestAction'] = 'reg_5050'
  2119. if STANCE == 1:
  2120. own['requestAction'] = 'fak_5050'
  2121. def rotmult():
  2122. if r_ground.triggered:
  2123. num = ((rot.z * -1) +1)
  2124. num = num * 100
  2125. def airup():
  2126. if r_ground.triggered == False:
  2127. pos = own.worldPosition
  2128. pos = own.worldPosition.z
  2129. last_pos = own['last_posz']
  2130. if last_pos - pos > 0:
  2131. own['airup'] = 0
  2132. if last_pos - pos < 0:
  2133. own['airup'] = 1
  2134. if pos > own['last_posz']:
  2135. own["air_height"] = pos
  2136. own['last_posz'] = pos
  2137. def onramp():
  2138. if r_ground.positive:
  2139. if 'ramp' in r_ground.hitObject:
  2140. own['onramp'] = 1
  2141. else:
  2142. own['onramp'] = 0
  2143. else:
  2144. own['onramp'] = 0
  2145. def grindtype(gtype):
  2146. own['grindType'] = gtype
  2147. def transmult():
  2148. lastrotz = own["rotz"]
  2149. linvel = own.getLinearVelocity(True)
  2150. newx = (linvel.x + (linvel.x * .039))
  2151. 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:
  2152. own.setLinearVelocity([newx, linvel.y, linvel.z], True)
  2153. def speedmult():
  2154. vel = own.getLinearVelocity(True)
  2155. xyz = own.worldOrientation.to_euler()
  2156. roty = math.degrees(xyz[1])
  2157. roty = abs(roty)
  2158. roty = roty * .0005
  2159. if abs(vel.x) > 1:
  2160. mult = .0015 + roty
  2161. else:
  2162. mult = .000
  2163. mult2 = .018
  2164. mult3 = .007
  2165. lastrotz = own["rotz"]
  2166. x = vel.x * mult
  2167. x2 = x + vel.x
  2168. x3 = vel.x * mult2
  2169. x4 = x3 + vel.x
  2170. x5 = vel.x * mult3
  2171. x6 = x5 + vel.x
  2172. if r_ground.triggered and vel.x < 4 and vel.x > -4:
  2173. own.setLinearVelocity([x2, vel.y, vel.z], True)
  2174. def coping():
  2175. if invertTouch.positive:
  2176. own["coping"] = 1
  2177. else:
  2178. own["coping"] = 0
  2179. def onboard():
  2180. if own['walk'] == 1:
  2181. cont.deactivate(cam.actuators['replayCam'])
  2182. cont.activate(cam.actuators['Camera'])
  2183. killall()
  2184. walklay = 40
  2185. fliplay3 = 2060
  2186. ob_speed = .5
  2187. if STANCE == 0:
  2188. skater.stopAction(fliplay)
  2189. deck.stopAction(fliplay)
  2190. trucks.stopAction(fliplay)
  2191. killall()
  2192. if own['dropinCol'] == True:
  2193. print("dropinanim")
  2194. own['requestAction'] = reg_dropin
  2195. else:
  2196. own['requestAction'] = 'reg_onboard'
  2197. force = (linVelocity.x -1, linVelocity.y, linVelocity.z)
  2198. own.setLinearVelocity(force, True)
  2199. own['dropinTimer'] = 60
  2200. if STANCE == 1:
  2201. skater.stopAction(fliplay)
  2202. deck.stopAction(fliplay)
  2203. trucks.stopAction(fliplay)
  2204. killall()
  2205. if own['dropinTimer'] > 30:
  2206. print("dropinanim2")
  2207. own['requestAction'] = fak_dropin
  2208. else:
  2209. own['requestAction'] = 'fak_onboard'
  2210. force = (linVelocity.x +1, linVelocity.y, linVelocity.z)
  2211. own.setLinearVelocity(force, True)
  2212. own['dropinTimer'] = 60
  2213. else:
  2214. num = own['dropinTimer']
  2215. if num > 0:
  2216. num = num - 1
  2217. own['dropinTimer'] = num
  2218. def offboard():
  2219. wheel1.stopAction(2)
  2220. wheel2.stopAction(2)
  2221. wheel3.stopAction(2)
  2222. wheel4.stopAction(2)
  2223. cont.deactivate(own.actuators["sroll"])
  2224. sact = own.actuators["sroll"]
  2225. sact.volume = .0001
  2226. own.actuators["sroll"].stopSound()
  2227. own['offboard_vel'] = own.linearVelocity
  2228. own['walk_timer'] = 0
  2229. def resetjumpstance():
  2230. if LAST_GRIND == True and grindHit == False:
  2231. own["lF_ground_frame"] = own['framenum']
  2232. lfg = own["lF_ground_frame"]
  2233. #print(lfg, "----- this?")
  2234. if own['jump_stance'] != 3:
  2235. own['jump_stance'] = 3
  2236. def grass():
  2237. try:
  2238. if 'grass' in r_ground.hitObject:
  2239. #print("grass")
  2240. linVel = own.getLinearVelocity(True)
  2241. linvelx = linVel.x * .98
  2242. own.setLinearVelocity((linvelx, linVel.y, linVel.z), 1)
  2243. except:
  2244. pass
  2245. def grindoutair():
  2246. skippy = 0
  2247. linVel = own.getLinearVelocity(True)
  2248. if own['LAST_GRIND'] == True and grindHit == True:
  2249. own['lg_stance'] = STANCE
  2250. lg_stance = own['lg_stance']
  2251. own.actuators["grindoutair"].useLocalLinV = True
  2252. if own['grindjumpturn'] == True and own['grindCountdown'] > 12 and skippy == 0:
  2253. grindoutspeed = .1
  2254. grindoutspeed2 = 5.4
  2255. if lLR > turnsens:
  2256. if own['last_grindpos'] == 'reg_5050':
  2257. if STANCE == 0:
  2258. own.actuators["grindoutair"].linV = [0, grindoutspeed, 0]
  2259. else:
  2260. own.actuators["grindoutair"].linV = [0, -grindoutspeed, 0]
  2261. cont.activate(own.actuators["grindoutair"])
  2262. if lLR < -turnsens:
  2263. if own['last_grindpos'] == 'reg_5050':
  2264. if STANCE == 0:
  2265. own.actuators["grindoutair"].linV = [0, -grindoutspeed, 0]
  2266. else:
  2267. own.actuators["grindoutair"].linV = [0, grindoutspeed, 0]
  2268. cont.activate(own.actuators["grindoutair"])
  2269. if lUD > turnsens:
  2270. js = own['lg_stance']
  2271. linvelx = own.getLinearVelocity(True)
  2272. if own['last_grindpos'] == 'reg_board':
  2273. if js == 1:
  2274. own.actuators["grindoutair"].linV = [-grindoutspeed, 0, 0]
  2275. cont.activate(own.actuators["grindoutair"])
  2276. else:
  2277. own.actuators["grindoutair"].linV = [grindoutspeed, 0, 0]
  2278. cont.activate(own.actuators["grindoutair"])
  2279. if lUD < -turnsens:
  2280. js = own['lg_stance']
  2281. if own['last_grindpos'] == 'reg_board':
  2282. if js == 0:
  2283. own.actuators["grindoutair"].linV = [-grindoutspeed, 0, 0]
  2284. cont.activate(own.actuators["grindoutair"])
  2285. else:
  2286. own.actuators["grindoutair"].linV = [grindoutspeed, 0, 0]
  2287. cont.activate(own.actuators["grindoutair"])
  2288. if LAST_GRIND == False and r_ground.triggered and own['grindjumpturn'] == True and own['grindCountdown'] < 1:
  2289. own['grindjumpturn'] = False
  2290. if r_ground.triggered:
  2291. own['grind_jump'] = False
  2292. if own['grindjumpturn'] == False or own['grindCountdown'] < 19:
  2293. cont.deactivate(own.actuators["grindoutair"])
  2294. def set_last_grindpos():
  2295. if own['grindpos'] != None:
  2296. own['last_grindpos'] = own['grindpos']
  2297. def air_pos():
  2298. grindpos = own['grindpos']
  2299. GRAB_ON = own["GRAB_ON"]
  2300. wr = own["wallride"]
  2301. if rUD > .040 and r_ground.triggered == False and GRAB_ON == False and wr == None and jump_timer < 50:
  2302. killact(2)
  2303. killact(4)
  2304. if STANCE == 0:
  2305. own['requestAction'] = 'reg_air_tail'
  2306. else:
  2307. own['requestAction'] = 'fak_air_tail'
  2308. elif rUD < -.040 and r_ground.triggered == False and GRAB_ON == False and wr == None and jump_timer < 50:
  2309. killact(2)
  2310. killact(4)
  2311. if STANCE == 0:
  2312. own['requestAction'] = 'reg_air_nose'
  2313. else:
  2314. own['requestAction'] = 'fak_air_nose'
  2315. def air_turn_boost():
  2316. pass
  2317. def revert():
  2318. own["Q3oncdl"] = 0
  2319. own["Q4oncdl"] = 0
  2320. own["Q5oncdl"] = 0
  2321. own["Q6oncdl"] = 0
  2322. own["Q7oncdl"] = 0
  2323. local = True
  2324. rot = [ 0.0, 0.0, 3.14]
  2325. own.applyRotation(rot,local)
  2326. if own['manual_v2_type'] == 'reg manual':
  2327. own['requestAction'] = 'reg_manual_revert_ccw'
  2328. print("reg")
  2329. elif own['manual_v2_type'] == 'reg nose manual':
  2330. skater.playAction("fak_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2331. deck.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2332. trucks.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2333. print("reg nose manual revert")
  2334. elif own['manual_v2_type'] == 'fak manual':
  2335. skater.playAction("fak_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2336. deck.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2337. trucks.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2338. print("fak manual revert")
  2339. elif own['manual_v2_type'] == 'fak nose manual':
  2340. skater.playAction("reg_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2341. deck.playAction("a_reg_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2342. trucks.playAction("a_reg_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2343. print("fak")
  2344. else:
  2345. own['requestAction'] = 'revert1'
  2346. own['revert_timer'] = 20
  2347. cont.activate(own.actuators["revertSound"])
  2348. def revert2():
  2349. own["Q3oncdl"] = 0
  2350. own["Q4oncdl"] = 0
  2351. own["Q5oncdl"] = 0
  2352. own["Q6oncdl"] = 0
  2353. own["Q7oncdl"] = 0
  2354. local = True
  2355. rot = [ 0.0, 0.0, -3.14]
  2356. own.applyRotation(rot,local)
  2357. if own['manual_v2_type'] == 'reg manual':
  2358. skater.playAction("reg_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2359. deck.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2360. trucks.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2361. print("reg")
  2362. elif own['manual_v2_type'] == 'reg nose manual':
  2363. skater.playAction("fak_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2364. deck.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2365. trucks.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2366. print("reg nose manual revert")
  2367. elif own['manual_v2_type'] == 'fak manual':
  2368. skater.playAction("fak_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2369. deck.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2370. trucks.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2371. print("fak manual revert")
  2372. elif own['manual_v2_type'] == 'fak nose manual':
  2373. skater.playAction("reg_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2374. deck.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2375. trucks.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2376. print("fak")
  2377. else:
  2378. own['requestAction'] = 'revert2'
  2379. own['revert_timer'] = 20
  2380. cont.activate(own.actuators["revertSound"])
  2381. def revert3():
  2382. own["Q7oncdl"] = 0
  2383. own["Q8oncdl"] = 0
  2384. own["Q1oncdl"] = 0
  2385. own["Q2oncdl"] = 0
  2386. own["Q3oncdl"] = 0
  2387. local = True
  2388. rot = [ 0.0, 0.0, 3.14]
  2389. own.applyRotation(rot,local)
  2390. print("real revert 3")
  2391. if own['manual_v2_type'] == 'reg manual':
  2392. skater.playAction("reg_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2393. deck.playAction("a_reg_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2394. trucks.playAction("a_reg_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2395. print("reg")
  2396. elif own['manual_v2_type'] == 'reg nose manual':
  2397. skater.playAction("fak_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2398. deck.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2399. trucks.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2400. print("reg nose manual revert")
  2401. elif own['manual_v2_type'] == 'fak manual':
  2402. skater.playAction("fak_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2403. deck.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2404. trucks.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2405. print("fak manual revert")
  2406. elif own['manual_v2_type'] == 'fak nose manual':
  2407. skater.playAction("reg_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2408. deck.playAction("a_reg_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2409. trucks.playAction("a_reg_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2410. print("fak")
  2411. else:
  2412. own['requestAction'] = 'revert3'
  2413. own['revert_timer'] = 20
  2414. cont.activate(own.actuators["revertSound"])
  2415. def revert4():
  2416. own["Q7oncdl"] = 0
  2417. own["Q8oncdl"] = 0
  2418. own["Q1oncdl"] = 0
  2419. own["Q2oncdl"] = 0
  2420. own["Q3oncdl"] = 0
  2421. local = True
  2422. rot = [ 0.0, 0.0, 3.14]
  2423. own.applyRotation(rot,local)
  2424. if own['manual_v2_type'] == 'reg manual':
  2425. skater.playAction("reg_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2426. deck.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2427. trucks.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2428. print("reg")
  2429. #elif own['reg_nmanual'] == 1:
  2430. elif own['manual_v2_type'] == 'reg nose manual':
  2431. skater.playAction("fak_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2432. deck.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2433. trucks.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2434. print("reg nose manual revert")
  2435. #elif own['fak_manual'] == 1 or own['fak_nmanual'] == 1:
  2436. elif own['manual_v2_type'] == 'fak manual':
  2437. skater.playAction("fak_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2438. deck.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2439. trucks.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2440. print("fak manual revert")
  2441. elif own['manual_v2_type'] == 'fak nose manual':
  2442. skater.playAction("reg_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2443. deck.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2444. trucks.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2445. print("fak")
  2446. else:
  2447. own['requestAction'] = 'revert4'
  2448. print("normal revert")
  2449. own['revert_timer'] = 20
  2450. cont.activate(own.actuators["revertSound"])
  2451. def powerslide():
  2452. own['powerslide_counter'] = own['powerslide_counter'] + 1
  2453. since_walk = own['framenum'] - own['last_walk_frame']
  2454. since_grind = own['framenum'] - own['last_grind_frame']
  2455. if own['powerslide_counter'] > 15 and since_walk > 100 and since_grind > 40:
  2456. own['powerslide_on'] = 1
  2457. if STANCE == 0:
  2458. own['powerslide'] = "reg2"
  2459. if STANCE == 1:
  2460. own['powerslide'] = "fak1"
  2461. linVelocity4 = own.getLinearVelocity(True)
  2462. if own['powerslide_counter'] > 15 and own['powerslide_counter'] < 18:
  2463. newx = linVelocity4.x * .9
  2464. else:
  2465. newx = linVelocity4.x * .98
  2466. force = [newx, linVelocity4.y, linVelocity4.z]
  2467. own.setLinearVelocity(force, True)
  2468. def powerslide2():
  2469. own['powerslide_counter'] = own['powerslide_counter'] + 1
  2470. since_walk = own['framenum'] - own['last_walk_frame']
  2471. since_grind = own['framenum'] - own['last_grind_frame']
  2472. if own['powerslide_counter'] > 15 and since_walk > 100 and since_grind > 100:
  2473. own['powerslide_on'] = 1
  2474. if STANCE == 0:
  2475. own['powerslide'] = "reg1"
  2476. if STANCE == 1:
  2477. own['powerslide'] = "fak2"
  2478. linVelocity4 = own.getLinearVelocity(True)
  2479. if own['powerslide_counter'] > 15 and own['powerslide_counter'] < 18:
  2480. newx = linVelocity4.x * .9
  2481. else:
  2482. newx = linVelocity4.x * .98
  2483. force = [newx, linVelocity4.y, linVelocity4.z]
  2484. own.setLinearVelocity(force, True)
  2485. def powerslide_state():
  2486. ####powerslide on#####
  2487. if own['powerslide_on'] == 1:
  2488. if own['powerslide'] == "reg2":
  2489. own['requestAction'] = 'reg_fs_powerslide'
  2490. if own['powerslide'] == "fak1":
  2491. own['requestAction'] = 'fak_fs_powerslide'
  2492. if own['powerslide'] == "reg1":
  2493. own['requestAction'] = 'reg_powerslide'
  2494. if own['powerslide'] == "fak2":
  2495. own['requestAction'] = 'fak_powerslide'
  2496. def powerslide_sound():
  2497. sact = own.actuators["powerslide_sound"]
  2498. if own['powerslide_on'] == 1:
  2499. sact = own.actuators["powerslide_sound"]
  2500. sact.volume = .2
  2501. new_pitch = (abs(linVelocity.x) / 3)
  2502. if new_pitch < 1.1 and new_pitch > .5:
  2503. sact.pitch = new_pitch
  2504. elif new_pitch <= .5:
  2505. sact.pitch = .5
  2506. else:
  2507. sact.pitch = 1.1
  2508. cont.activate(own.actuators["powerslide_sound"])
  2509. else:
  2510. sact.volume = .0
  2511. cont.deactivate(own.actuators["powerslide_sound"])
  2512. def check_powerslide():
  2513. try:
  2514. own['last_powerslide_on'] = own['powerslide_on']
  2515. except:
  2516. pass
  2517. psxvel = abs(linVelocity.x)
  2518. if (lUD > .08 or lUD < -.08) and own['manual_v2'] == False and r_ground.triggered == True and psxvel > .1:
  2519. if lUD > .08:
  2520. powerslide()
  2521. else:
  2522. powerslide2()
  2523. else:
  2524. own['powerslide_on'] = 0
  2525. own['powerslide_counter'] = 0
  2526. if own['last_powerslide_on'] == 0:
  2527. own['powerslide'] = None
  2528. def killmanuals():
  2529. if own['last_manual_v2'] == 1 and own['manual_v2'] == 0:
  2530. fak_manual_off()
  2531. reg_manual_off()
  2532. fak_nmanual_off()
  2533. reg_nmanual_off()
  2534. def killopos():
  2535. pass
  2536. stopAnims()
  2537. #nextframe()
  2538. air()
  2539. stance()
  2540. turn()
  2541. #grind()
  2542. rotmult()
  2543. airup()
  2544. onramp()
  2545. speedmult()
  2546. coping()
  2547. onboard()
  2548. resetjumpstance()
  2549. grass()
  2550. grindoutair()
  2551. set_last_grindpos()
  2552. air_pos()
  2553. air_turn_boost()
  2554. record_grindsound()
  2555. check_powerslide()
  2556. powerslide_state()
  2557. powerslide_sound()
  2558. killmanuals()
  2559. killopos()
  2560. grind()
  2561. ##################
  2562. ###realcontrols###
  2563. ##################
  2564. # q1
  2565. # q8 q2
  2566. # q7 q3
  2567. # q6 q4
  2568. # q5
  2569. ##################
  2570. #lq6
  2571. if lUD > .04 and lLR < -0.04 :
  2572. lq6on = 1
  2573. q6oncdl = countdown
  2574. own["Q6oncdl"] = q6oncdl
  2575. #print("lq6on")
  2576. elif q6oncdl > 0:
  2577. lq6on = 0
  2578. q6oncdl = q6oncdl - 1
  2579. own["Q6oncdl"] = q6oncdl
  2580. #lq8
  2581. if lUD < -.04 and lLR < -0.04 :
  2582. lq8on = 1
  2583. q8oncdl = countdown
  2584. own["Q8oncdl"] = q8oncdl
  2585. #print("lq8on")
  2586. elif q8oncdl > 0:
  2587. lq8on = 0
  2588. q8oncdl = q8oncdl - 1
  2589. own["Q8oncdl"] = q8oncdl
  2590. #lq2
  2591. if lUD < -.04 and lLR > 0.04 :
  2592. lq2on = 1
  2593. q2oncdl = countdown
  2594. own["Q2oncdl"] = q2oncdl
  2595. #print("lq2on")
  2596. elif q2oncdl > 0:
  2597. lq2on = 0
  2598. q2oncdl = q2oncdl - 1
  2599. own["Q2oncdl"] = q2oncdl
  2600. #q4
  2601. if lUD > 0.04 and lLR > 0.04 :
  2602. lq4on = 1
  2603. q4oncdl = countdown
  2604. own["Q4oncdl"] = q4oncdl
  2605. #print("lq4on")
  2606. elif q4oncdl > 0:
  2607. lq4on = 0
  2608. q4oncdl = q4oncdl - 1
  2609. own["Q4oncdl"] = q4oncdl
  2610. #q5
  2611. if lUD > .070 and lq4on == 0 and lq6on == 0:
  2612. lq5on = 1
  2613. q5oncdl = countdown
  2614. own["Q5oncdl"] = q5oncdl
  2615. #print("lq5on")
  2616. elif q5oncdl > 0:
  2617. lq5on = 0
  2618. q5oncdl = q5oncdl - 1
  2619. own["Q5oncdl"] = q5oncdl
  2620. #q1
  2621. if lUD < -0.070 and lq8on !=1 and lq2on != 1:
  2622. lq1on = 1
  2623. q1oncdl = countdown
  2624. own["Q1oncdl"] = q1oncdl
  2625. #print("lq1on")
  2626. elif q1oncdl > 0:
  2627. lq1on = 0
  2628. q1oncdl = q1oncdl - 1
  2629. own["Q1oncdl"] = q1oncdl
  2630. #q7
  2631. if lLR < -0.070 and lq8on != 1 and lq6on != 1:
  2632. lq7on = 1
  2633. q7oncdl = countdown
  2634. own["Q7oncdl"] = q7oncdl
  2635. #print("lq7on")
  2636. elif q7oncdl > 0:
  2637. lq7on = 0
  2638. q7oncdl = q7oncdl - 1
  2639. own["Q7oncdl"] = q7oncdl
  2640. #q3
  2641. if lLR > 0.070 and lq2on !=1 and lq4on != 1:
  2642. lq3on = 1
  2643. q3oncdl = countdown
  2644. own["Q3oncdl"] = q3oncdl
  2645. #print("lq3on")
  2646. elif q3oncdl > 0:
  2647. lq3on = 0
  2648. q3oncdl = q3oncdl - 1
  2649. own["Q3oncdl"] = q3oncdl
  2650. #34567
  2651. own['set_revert_timer'] = 0
  2652. if q3oncdl < q4oncdl < q5oncdl < q6oncdl < q7oncdl:
  2653. if r_ground.triggered == True:
  2654. print("REVERT!!!")
  2655. revert()
  2656. own['set_revert_timer'] = 1
  2657. if q3oncdl > q4oncdl > q5oncdl > q6oncdl > q7oncdl:
  2658. if r_ground.triggered == True:
  2659. print("REVERT2!!!")
  2660. revert2()
  2661. own['set_revert_timer'] = 1
  2662. if q7oncdl < q8oncdl < q1oncdl < q2oncdl < q3oncdl:
  2663. if r_ground.triggered == True:
  2664. print("REVERT3!!!")
  2665. revert3()
  2666. own['set_revert_timer'] = 1
  2667. if q7oncdl > q8oncdl > q1oncdl > q2oncdl > q3oncdl:
  2668. if r_ground.triggered == True:
  2669. print("REVERT4!!!")
  2670. revert4()
  2671. own['set_revert_timer'] = 1
  2672. ################
  2673. #q6
  2674. if rUD > .04 and rLR < -0.04 :
  2675. q6on = 1
  2676. q6oncd = countdown
  2677. own["Q6oncd"] = q6oncd
  2678. #print("q6on")
  2679. elif q6oncd > 0:
  2680. q6on = 0
  2681. q6oncd = q6oncd - 1
  2682. own["Q6oncd"] = q6oncd
  2683. #q8
  2684. if rUD < -.04 and rLR < -0.04 :
  2685. q8on = 1
  2686. q8oncd = countdown
  2687. own["Q8oncd"] = q8oncd
  2688. #print("q8on")
  2689. elif q8oncd > 0:
  2690. q8on = 0
  2691. q8oncd = q8oncd - 1
  2692. own["Q8oncd"] = q8oncd
  2693. #q2
  2694. if rUD < -.04 and rLR > 0.04 :
  2695. q2on = 1
  2696. q2oncd = countdown
  2697. own["Q2oncd"] = q2oncd
  2698. #print("q2on")
  2699. elif q2oncd > 0:
  2700. q2on = 0
  2701. q2oncd = q2oncd - 1
  2702. own["Q2oncd"] = q2oncd
  2703. #q4
  2704. if rUD > 0.04 and rLR > 0.04 :
  2705. q4on = 1
  2706. q4oncd = countdown
  2707. own["Q4oncd"] = q4oncd
  2708. #print("q4on")
  2709. elif q4oncd > 0:
  2710. q4on = 0
  2711. q4oncd = q4oncd - 1
  2712. own["Q4oncd"] = q4oncd
  2713. #q5
  2714. if rUD > .070:
  2715. if q4on == 0 and q6on == 0:
  2716. #print("q5on")
  2717. q5on = 1
  2718. q5oncd = countdown
  2719. own["Q5oncd"] = q5oncd
  2720. oposin()
  2721. if rUD > .02:
  2722. grindpos = own['grindpos']
  2723. jumpstance = own["jump_stance"]
  2724. if LAST_GRIND == False:
  2725. if grindpos == "reg_stall":
  2726. grindtype("nose_stall") #change
  2727. elif grindpos == "fak_stall":
  2728. grindtype("nose_stall")
  2729. elif grindpos == "reg_5050":
  2730. if jumpstance != 3:
  2731. if jumpstance == 0:
  2732. if rLR > .02:
  2733. grindtype("reg_tailgR")
  2734. elif rLR < -.02:
  2735. grindtype("reg_tailgL")
  2736. else:
  2737. grindtype("reg_tailg")
  2738. if jumpstance == 1:
  2739. if rLR > .02:
  2740. grindtype("fak_tailgR")
  2741. elif rLR < -.02:
  2742. grindtype("fak_tailgL")
  2743. else:
  2744. grindtype("fak_tailg")
  2745. else:
  2746. if STANCE == 0:
  2747. if rLR > .03:
  2748. grindtype("reg_tailgR")
  2749. elif rLR < -.02:
  2750. grindtype("reg_tailgL")
  2751. else:
  2752. grindtype("reg_tailg")
  2753. if STANCE == 1:
  2754. grindtype("fak_tailg")
  2755. elif grindpos == "reg_board":
  2756. if jumpstance != 3:
  2757. if jumpstance == 0:
  2758. grindtype("reg_tailslide")
  2759. if jumpstance == 1:
  2760. grindtype("fak_tailslide")
  2761. STANCE = jumpstance
  2762. own['stance'] = STANCE
  2763. else:
  2764. if STANCE == 0:
  2765. grindtype("reg_tailslide")
  2766. if STANCE == 1:
  2767. grindtype("fak_tailslide")
  2768. else:
  2769. if jumpstance == 0:
  2770. grindtype("reg_tailg")
  2771. if jumpstance == 1:
  2772. grindtype("fak_tailg")
  2773. elif q5oncd > 0:
  2774. q5on = 0
  2775. q5oncd = q5oncd - 1
  2776. own["Q5oncd"] = q5oncd
  2777. killact(65)
  2778. killact(66)
  2779. killact(67)
  2780. killact(68)
  2781. own["last_Opos"] = False
  2782. #q1
  2783. if rUD < -0.070:
  2784. if q2on == 0 and q8on == 0:
  2785. #print("q1on")
  2786. q1on = 1
  2787. q1oncd = countdown
  2788. own["Q1oncd"] = q1oncd
  2789. noposin()
  2790. if rUD < -0.020:
  2791. grindpos = own['grindpos']
  2792. jumpstance = own["jump_stance"]
  2793. if LAST_GRIND == False:
  2794. if grindpos == "reg_5050":
  2795. #print("nose something")
  2796. if jumpstance != 3:
  2797. if jumpstance == 0:
  2798. if rLR > .02:
  2799. grindtype("reg_nosegR")
  2800. elif rLR < -.02:
  2801. grindtype("reg_nosegL")
  2802. else:
  2803. #print("gtype reg_nosegR")
  2804. grindtype("reg_noseg")
  2805. if jumpstance == 1:
  2806. if rLR > .02:
  2807. grindtype("fak_nosegR")
  2808. elif rLR < -.02:
  2809. grindtype("fak_nosegL")
  2810. else:
  2811. grindtype("fak_noseg")
  2812. else:
  2813. if STANCE == 0:
  2814. if rLR > .02:
  2815. grindtype("reg_nosegR")
  2816. elif rLR < -.02:
  2817. grindtype("reg_nosegL")
  2818. else:
  2819. grindtype("reg_noseg")
  2820. if STANCE == 1:
  2821. if rLR > .02:
  2822. grindtype("fak_nosegR")
  2823. elif rLR < -.02:
  2824. grindtype("fak_nosegL")
  2825. else:
  2826. grindtype("fak_noseg")
  2827. elif grindpos == "reg_board":
  2828. #print("nose something")
  2829. if jumpstance != 3:
  2830. if jumpstance == 0:
  2831. grindtype("reg_noseslide")
  2832. if jumpstance == 1:
  2833. grindtype("fak_noseslide")
  2834. STANCE = jumpstance
  2835. own['stance'] = STANCE
  2836. else:
  2837. if STANCE == 0:
  2838. grindtype("reg_noseslide")
  2839. if STANCE == 1:
  2840. grindtype("fak_noseslide")
  2841. elif q1oncd > 0:
  2842. q1on = 0
  2843. q1oncd = q1oncd - 1
  2844. own["Q1oncd"] = q1oncd
  2845. killact(73)
  2846. killact(74)
  2847. killact(71)
  2848. killact(72)
  2849. own["last_nOpos"] = False
  2850. #q7
  2851. if rLR < -0.070:
  2852. if q8on == 0 and q6on == 0:
  2853. q7on = 1
  2854. q7oncd = countdown
  2855. own["Q7oncd"] = q7oncd
  2856. #print("q7on")
  2857. elif q7oncd > 0:
  2858. q7on = 0
  2859. q7oncd = q7oncd - 1
  2860. own["Q7oncd"] = q7oncd
  2861. #q3
  2862. if rLR > 0.070:
  2863. if q4on == 0 and q2on == 0:
  2864. q3on = 1
  2865. q3oncd = countdown
  2866. own["Q3oncd"] = q3oncd
  2867. #print("q3on")
  2868. elif q3oncd > 0:
  2869. q3on = 0
  2870. q3oncd = q3oncd - 1
  2871. own["Q3oncd"] = q3oncd
  2872. #trick calls
  2873. # 360 flip
  2874. # 3 > 4 > 5 > 8
  2875. # laser flip
  2876. # 7 > 6 > 5 > 2
  2877. #nollie 360 shovit
  2878. if q7oncd > 0 and q8oncd > 0 and q1oncd > 0 and q2oncd > 0 and q3oncd > 0 and q7oncd <= q8oncd <= q1oncd <= q2oncd <= q3oncd:
  2879. print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  2880. print ("Nollie 360 shovit")
  2881. dict['trick_string'] = 'Nollie 360 Shovit'
  2882. nollie_shovit360()
  2883. q7oncd = 0
  2884. q8oncd = 0
  2885. q1oncd = 0
  2886. q2oncd = 0
  2887. q3oncd = 0
  2888. own["Q7oncd"] = q7oncd
  2889. own["Q8oncd"] = q8oncd
  2890. own["Q1oncd"] = q1oncd
  2891. own["Q2oncd"] = q2oncd
  2892. own["Q3oncd"] = q3oncd
  2893. #nollie fs 360 shovit
  2894. if q7oncd > 0 and q8oncd > 0 and q1oncd > 0 and q2oncd > 0 and q3oncd > 0 and q3oncd <= q2oncd <= q1oncd <= q8oncd <= q7oncd:
  2895. #print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  2896. print ("Nollie Front Side 360 shovit")
  2897. dict['trick_string'] = 'Nollie FS 360 Shovit'
  2898. nollie_fsshovit360()
  2899. q7oncd = 0
  2900. q8oncd = 0
  2901. q1oncd = 0
  2902. q2oncd = 0
  2903. q3oncd = 0
  2904. own["Q7oncd"] = q7oncd
  2905. own["Q8oncd"] = q8oncd
  2906. own["Q1oncd"] = q1oncd
  2907. own["Q2oncd"] = q2oncd
  2908. own["Q3oncd"] = q3oncd
  2909. # varial heelflip
  2910. # 7 < 6 < 2
  2911. if q7oncd > 0 and q6oncd > 0 and q2oncd > 0 and q7oncd < q6oncd < q2oncd:
  2912. dict['trick_string'] = 'Varial Heelflip'
  2913. varial_heelflip()
  2914. reset_rtimers()
  2915. # varial kickflip
  2916. # 3 < 4 < 8
  2917. if q3oncd > 0 and q4oncd > 0 and q8oncd > 0 and q3oncd < q4oncd < q8oncd:
  2918. dict['trick_string'] = 'Varial Kickflip'
  2919. varial_kickflip()
  2920. reset_rtimers()
  2921. # nollie varial kickflip
  2922. # 3 < 2 < 6
  2923. if q3oncd > 0 and q2oncd > 0 and q6oncd > 0 and q3oncd <= q2oncd <= q6oncd:
  2924. dict['trick_string'] = 'Nollie Varial Kickflip'
  2925. print('Nollie Varial Kickflip')
  2926. nollie_varial_kickflip()
  2927. reset_rtimers()
  2928. # nollie varial heelflip
  2929. # 7 < 8 < 4
  2930. if q7oncd > 0 and q8oncd > 0 and q4oncd > 0 and q7oncd <= q8oncd <= q4oncd:
  2931. dict['trick_string'] = 'Nollie Varial Heelflip'
  2932. print('Nollie Varial Heelflip')
  2933. nollie_varial_heelflip()
  2934. reset_rtimers()
  2935. #360 shovit
  2936. if q3oncd > 0 and q4oncd > 0 and q5oncd > 0 and q6oncd > 0 and q7oncd > 0 and q7oncd >= q6oncd >= q5oncd >= q4oncd >= q3oncd:
  2937. # print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  2938. #print ("______-------360 shovit")
  2939. dict['trick_string'] = '360 Shovit'
  2940. shovit360()
  2941. q3oncd = 0
  2942. q4oncd = 0
  2943. q5oncd = 0
  2944. q6oncd = 0
  2945. q7oncd = 0
  2946. own["Q3oncd"] = q3oncd
  2947. own["Q4oncd"] = q4oncd
  2948. own["Q5oncd"] = q5oncd
  2949. own["Q6oncd"] = q6oncd
  2950. own["Q7oncd"] = q7oncd
  2951. #360 fs shovit
  2952. if q3oncd > 0 and q4oncd > 0 and q5oncd > 0 and q6oncd >= 0 and q7oncd > 0 and q7oncd <= q6oncd <= q5oncd <= q4oncd <= q3oncd:
  2953. # print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  2954. #print ("______-------360 shovit")
  2955. dict['trick_string'] = '360 Frontside Shovit'
  2956. fsshovit360()
  2957. q3oncd = 0
  2958. q4oncd = 0
  2959. q5oncd = 0
  2960. q6oncd = 0
  2961. q7oncd = 0
  2962. own["Q3oncd"] = q3oncd
  2963. own["Q4oncd"] = q4oncd
  2964. own["Q5oncd"] = q5oncd
  2965. own["Q6oncd"] = q6oncd
  2966. own["Q7oncd"] = q7oncd
  2967. #ollie
  2968. if q5oncd > 0 and q1oncd > 0 and q5oncd < q1oncd:
  2969. JUMPSTRENGTH = q1oncd - q5oncd
  2970. #4,7
  2971. if JUMPSTRENGTH <= 4:
  2972. JUMPSTRENGTH = 1.1
  2973. if JUMPSTRENGTH > 4 and JUMPSTRENGTH < 7:
  2974. JUMPSTRENGTH = 1
  2975. if JUMPSTRENGTH >= 7:
  2976. JUMPSTRENGTH = .9
  2977. aollie()
  2978. q1oncd = 0
  2979. q5oncd = 0
  2980. own["Q1oncd"] = q1oncd
  2981. own["Q5oncd"] = q5oncd
  2982. #nollie
  2983. if q5oncd > 0 and q1oncd > 0 and q5oncd > q1oncd:
  2984. JUMPSTRENGTH = q5oncd - q1oncd
  2985. #4,7
  2986. if JUMPSTRENGTH <= 4:
  2987. JUMPSTRENGTH = 1.1
  2988. if JUMPSTRENGTH > 4 and JUMPSTRENGTH < 7:
  2989. JUMPSTRENGTH = 1
  2990. if JUMPSTRENGTH >= 7:
  2991. JUMPSTRENGTH = .9
  2992. nollie()
  2993. q1oncd = 0
  2994. q5oncd = 0
  2995. own["Q1oncd"] = q1oncd
  2996. own["Q5oncd"] = q5oncd
  2997. print("nollie")
  2998. #kickflip
  2999. if q5oncd > 0 and q8oncd > 0 and q5oncd < q8oncd and q3oncd < 1:
  3000. kickflip()
  3001. q8oncd = 0
  3002. q5oncd = 0
  3003. own["Q8oncd"] = q8oncd
  3004. own["Q5oncd"] = q5oncd
  3005. #nollie kickflip
  3006. if q1oncd > 0 and q6oncd > 0 and q1oncd < q6oncd:
  3007. nollie_kickflip()
  3008. q6oncd = 0
  3009. q1oncd = 0
  3010. own["Q6oncd"] = q6oncd
  3011. own["Q1oncd"] = q1oncd
  3012. #heelflip
  3013. if q5oncd > 0 and q2oncd > 0 and q5oncd < q2oncd:
  3014. heelflip()
  3015. q2oncd = 0
  3016. q5oncd = 0
  3017. own["Q2oncd"] = q2oncd
  3018. own["Q5oncd"] = q5oncd
  3019. #nollie_heelflip
  3020. if q1oncd > 0 and q4oncd > 0 and q1oncd < q4oncd:
  3021. nollie_heelflip()
  3022. q1oncd = 0
  3023. q4oncd = 0
  3024. own["Q1oncd"] = q1oncd
  3025. own["Q4oncd"] = q4oncd
  3026. #shovit
  3027. if q4oncd > 0 and q5oncd > 0 and q6oncd > 0 and q4oncd <= q5oncd <= q6oncd and q3oncd < 1:
  3028. shovit()
  3029. q4oncd = 0
  3030. q5oncd = 0
  3031. q6oncd = 0
  3032. own["Q4oncd"] = q4oncd
  3033. own["Q5oncd"] = q5oncd
  3034. own["Q6oncd"] = q6oncd
  3035. #nollie_shovit
  3036. if q2oncd > 0 and q1oncd > 0 and q8oncd > 0 and q2oncd <= q1oncd <= q8oncd and q3oncd == 0:
  3037. nollie_shovit()
  3038. print('nollie shuvit')
  3039. #nollie_fsshovit()
  3040. q2oncd = 0
  3041. q1oncd = 0
  3042. q8oncd = 0
  3043. own["Q2oncd"] = q2oncd
  3044. own["Q1oncd"] = q1oncd
  3045. own["Q8oncd"] = q8oncd
  3046. #fsshovit
  3047. if q4oncd > 0 and q5oncd > 0 and q6oncd > 0 and q6oncd <= q5oncd <= q4oncd and q7oncd < 1:
  3048. # print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  3049. # print ("^%*^%*^%*^%fsshovit")
  3050. fsshovit()
  3051. q4oncd = 0
  3052. q5oncd = 0
  3053. q6oncd = 0
  3054. own["Q4oncd"] = q4oncd
  3055. own["Q5oncd"] = q5oncd
  3056. own["Q6oncd"] = q6oncd
  3057. #nollie_fsshovit
  3058. if q8oncd > 0 and q1oncd > 0 and q2oncd > 0 and q8oncd <= q1oncd <= q2oncd and q7oncd == 0:
  3059. # print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  3060. print ("nollie fsshovit")
  3061. nollie_fsshovit()
  3062. #nollie_shovit()
  3063. q8oncd = 0
  3064. q1oncd = 0
  3065. q2oncd = 0
  3066. own["Q8oncd"] = q4oncd
  3067. own["Q1oncd"] = q5oncd
  3068. own["Q2oncd"] = q6oncd
  3069. #360 shovit
  3070. # 360 shovit
  3071. # 3 > 4 > 5 >6 > 7
  3072. # fs 360 shovit
  3073. # 7 > 6 > 5 > 4 > 3
  3074. def hippy_jump():
  3075. STANCE = own["stance"]
  3076. if own['hippy'] == 1 and own['last_hippy'] == 0:
  3077. if STANCE == 0:
  3078. skater.playAction("reg_hippy", 1,10, layer=1101, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3079. if STANCE == 1:
  3080. skater.playAction("fak_hippy", 1,10, layer=1101, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3081. if own['hippy'] == 1 and own['last_hippy'] == 1:
  3082. if STANCE == 0:
  3083. skater.playAction("reg_hippy", 10,10, layer=1100, priority=0, layer_weight=0, play_mode=1, speed=.5)
  3084. if STANCE == 1:
  3085. skater.playAction("fak_hippy", 10,10, layer=1100, priority=0, layer_weight=0, play_mode=1, speed=.5)
  3086. if own['hippy'] == 0 and own['last_hippy'] == 1:
  3087. killact(1100)
  3088. if rLR > turnsens:
  3089. local = True
  3090. rot = [ 0.0, 0.0, 3.14]
  3091. own.applyRotation(rot,local)
  3092. print("hippy turn")
  3093. if STANCE == 0:
  3094. skater.playAction("reg_hippy_ncw", 10,40, layer=1102, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3095. print('%hip1')
  3096. if STANCE == 1:
  3097. skater.playAction("fak_hippy_ncw", 10,40, layer=1102, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3098. print('%hip2')
  3099. elif rLR < -turnsens:
  3100. local = True
  3101. rot = [ 0.0, 0.0, -3.14]
  3102. own.applyRotation(rot,local)
  3103. print("hippy turn neg")
  3104. if STANCE == 0:
  3105. skater.playAction("fak_hippy_nccw", 10,40, layer=1102, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3106. print('%hip3')
  3107. if STANCE == 1:
  3108. skater.playAction("reg_hippy_nccw", 10,40, layer=1102, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3109. print('%hip4')
  3110. ##straight
  3111. else:
  3112. if STANCE == 0:
  3113. skater.playAction("reg_hippy", 10,40, layer=1102, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3114. if STANCE == 1:
  3115. skater.playAction("fak_hippy", 10,40, layer=1102, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3116. #pushing and hippy jumps
  3117. since_a = frame - lastaf
  3118. since_x = frame - lastxf
  3119. cush = 10
  3120. hippy = 0
  3121. own['hippy'] = 0
  3122. #print(since_a, "a", since_x, "x")
  3123. #if xBut == 1 and aBut == 1 and since_a <= cush and since_x <= cush and (lTrig < 0.02 and rTrig < 0.02):
  3124. if xBut == 1 and aBut == 1 and (lTrig < 0.02 and rTrig < 0.02) and r_ground.triggered == True:
  3125. #F"hippy")
  3126. hippy = 1
  3127. own['hippy'] = 1
  3128. #hippy_jump()
  3129. #print(hippy)
  3130. hippy_jump()
  3131. if since_a > cush and aBut == 1 and lasta == 1 and (lTrig < 0.02 and rTrig < 0.02) and own['last_hippy'] == 0:
  3132. #print("apush suckka", since_a)
  3133. if xBut == 0 and hippy == 0 and lastaBut_ground == True:
  3134. push()
  3135. if since_x > cush and xBut == 1 and lastx == 1 and (lTrig < 0.02 and rTrig < 0.02) and own['last_hippy'] == 0:
  3136. #print("push suckka", since_x)
  3137. if aBut == 0 and hippy == 0 and lastxBut_ground == True:
  3138. push_goof()
  3139. #cavemans
  3140. if LAST_GRIND == False and grindHit == False and r_ground.triggered:
  3141. if (aBut ==0 and own['lastaBut_ground'] == 1) and lTrig > 0.02:
  3142. brfoot()
  3143. if (aBut ==0 and own['lastaBut_ground'] == 1) and rTrig > 0.02:
  3144. frfoot()
  3145. if (xBut ==0 and own['lastxBut_ground'] == 1) and lTrig > 0.02:
  3146. blfoot()
  3147. if (xBut ==0 and own['lastxBut_ground'] == 1) and rTrig > 0.02:
  3148. flfoot()
  3149. #push b button
  3150. if (bBut == 0 and own["lastStop"] == True) or (bBut == 1 and own["lastStop"] == False):
  3151. skater.stopAction(7)
  3152. skater.stopAction(1)
  3153. killact(18)
  3154. killact(19)
  3155. if bBut == 0 and own["lastStop"] == True:
  3156. if STANCE == True:
  3157. skater.playAction("fak_stopin", 15,1, layer=6, priority=3, blendin=10, play_mode=0, speed=.5)
  3158. elif STANCE == False:
  3159. skater.playAction("reg_stopin", 15,1, layer=7, priority=3, blendin=10, play_mode=0, speed=.5)
  3160. if bBut == 1:
  3161. #print("push suckka")
  3162. if linVelocity.x > .05 or linVelocity.x < -.05:
  3163. stop()
  3164. elif linVelocity.x < .05 or linVelocity.x > -.05:
  3165. if own["lastStop"] == True:
  3166. if STANCE == True:
  3167. skater.playAction("fak_stopin", 15,1, layer=8, priority=3, blendin=10, play_mode=0, speed=.5)
  3168. elif STANCE == False:
  3169. skater.playAction("reg_stopin", 15,1, layer=9, priority=3, blendin=10, play_mode=0, speed=.5)
  3170. own["lastStop"] = False
  3171. elif bBut ==0:
  3172. own["lastStop"] = False
  3173. ##### falls
  3174. if own['fall'] == 1:
  3175. offboard()
  3176. own['getoffboard'] = True
  3177. ####
  3178. #y button
  3179. if own['lasty'] == 1 and yBut ==0:
  3180. offboard()
  3181. if own["GRAB_ON"] == True:
  3182. playing = skater.isPlayingAction(fliplay)
  3183. if playing == 1:
  3184. frame = skater.getActionFrame(fliplay)
  3185. #print("Flipping frame: ", frame)
  3186. if frame > 16:
  3187. skater.stopAction(fliplay)
  3188. #frontside grab
  3189. flipping = skater.isPlayingAction(fliplay)
  3190. if rTrig > 0.02 and r_ground.triggered == 0 and flipping == False:
  3191. GRAB_ON = True
  3192. own["GRAB_ON"] = GRAB_ON
  3193. #print(rTrig, GRAB_ON)
  3194. if STANCE == False and rUD >= -.07 and rUD <= .07:
  3195. frontside_grab_on()
  3196. elif STANCE == True and rUD >= -.07 and rUD <= .07:
  3197. fakbackside_grab_on()
  3198. #front_nose
  3199. if STANCE == True and rUD < -0.070:
  3200. fak_backside_nose_grab_on()
  3201. #front_tail
  3202. elif STANCE == True and rUD > 0.07:
  3203. fak_backside_tail_grab_on()
  3204. #
  3205. if STANCE == False and rUD < -0.070:
  3206. frontside_nose_grab_on()
  3207. #front_tail
  3208. elif STANCE == False and rUD > 0.07:
  3209. frontside_tail_grab_on()
  3210. #backside grab
  3211. #if lTrig > 0.02 and GRAB_ON == False and r_ground.triggered == 0:
  3212. if lTrig > 0.02 and r_ground.triggered == 0 and flipping == False:
  3213. GRAB_ON = True
  3214. own["GRAB_ON"] = GRAB_ON
  3215. #print(rTrig)
  3216. if STANCE == False and rUD >= -.07 and rUD <= .07:
  3217. backside_grab_on()
  3218. elif STANCE == True and rUD >= -.07 and rUD <= .07:
  3219. fakfrontside_grab_on()
  3220. #front_nose
  3221. if STANCE == True and rUD < -0.070:
  3222. fak_frontside_nose_grab_on()
  3223. #front_tail
  3224. elif STANCE == True and rUD > 0.07:
  3225. fak_frontside_tail_grab_on()
  3226. #front_nose
  3227. if STANCE == False and rUD < -0.070:
  3228. backside_nose_grab_on()
  3229. #front_tail
  3230. elif STANCE == False and rUD > 0.07:
  3231. backside_tail_grab_on()
  3232. #kill grabs
  3233. if lTrig <= 0.02 and GRAB_ON == True and lTrig >= -.02 and rTrig <= .02 and rTrig >= -.2:
  3234. GRAB_ON = False
  3235. own["GRAB_ON"] = GRAB_ON
  3236. GRAB_PLAYED = False
  3237. own["GRAB_PLAYED"] = GRAB_PLAYED
  3238. #frontside pump #backside pump
  3239. 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):
  3240. pump()
  3241. else:
  3242. own["lastPump"] = False
  3243. own["Pump"] = False
  3244. def footplant():
  3245. framenum = own['framenum']
  3246. last_ground_frame = own['lF_ground_frame']
  3247. lF_air_frame = own['lF_air_frame']
  3248. frames_since_ground = framenum - lF_air_frame
  3249. frames_since_grind = framenum - own['last_grind_frame']
  3250. #print(frames_since_ground, "fsg")
  3251. if LAST_GRIND == False and grindHit == True and aBut == True and frames_since_ground < 40 and touched:
  3252. own.setLinearVelocity([0,0,0],0)
  3253. killall()
  3254. if STANCE == 0:
  3255. skater.playAction("reg_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3256. deck.playAction("a_reg_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3257. trucks.playAction("a_reg_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3258. skater.playAction("reg_fp_rback", 1,10, layer=2928, priority=8, play_mode=0, speed=1)
  3259. deck.playAction("a_reg_fp_rback", 1,10, layer=2928, priority=8, play_mode=0, speed=1)
  3260. trucks.playAction("a_reg_fp_rback", 1,10, layer=2928, priority=8, play_mode=0, speed=1)
  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. skater.playAction("fak_fp_rback", 1,10, layer=2928, priority=8, play_mode=0, speed=1)
  3266. deck.playAction("a_fak_fp_rback", 1,10, layer=2928, priority=8, play_mode=0, speed=1)
  3267. trucks.playAction("a_fak_fp_rback", 1,10, layer=2928, priority=8, play_mode=0, speed=1)
  3268. own['footplant_on'] = 1
  3269. if grindHit == False:
  3270. own['footplant_on'] = 0
  3271. if own['footplant_on'] == True and rUD < turnsens and rUD > -turnsens:
  3272. own.setLinearVelocity([0,0,0],0)
  3273. if own['footplant_on'] == 1 and own['last_footplant'] == True:
  3274. if skater.isPlayingAction(2925) == False:
  3275. if STANCE == 0:
  3276. skater.playAction("reg_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3277. deck.playAction("a_reg_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3278. trucks.playAction("a_reg_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3279. if STANCE == 1:
  3280. skater.playAction("fak_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3281. deck.playAction("a_fak_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3282. trucks.playAction("a_fak_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3283. if own['last_footplant'] == True and own['footplant_on'] == 0:
  3284. killall()
  3285. if STANCE == 0:
  3286. skater.playAction("reg_fp_rback", 10,20, layer=2928, priority=8, play_mode=0, speed=1)
  3287. deck.playAction("a_reg_fp_rback", 10,20, layer=2928, priority=8, play_mode=0, speed=1)
  3288. trucks.playAction("a_reg_fp_rback", 10,20, layer=2928, priority=8, play_mode=0, speed=1)
  3289. if STANCE == 1:
  3290. skater.playAction("fak_fp_rback", 10,20, layer=2928, priority=8, play_mode=0, speed=1)
  3291. deck.playAction("a_fak_fp_rback", 10,20, layer=2928, priority=8, play_mode=0, speed=1)
  3292. trucks.playAction("a_fak_fp_rback", 10,20, layer=2928, priority=8, play_mode=0, speed=1)
  3293. def invert():
  3294. if LAST_GRIND == False and grindHit == True and own['grindpos'] == 'reg_board':
  3295. if lBump == 1:
  3296. #print("invert")
  3297. #if coping_on ==1 and lBump == 1:
  3298. print("IIIIIINVVERT")
  3299. own['invert_on'] = 1
  3300. own.setLinearVelocity([0,0,0],0)
  3301. if own["coping"] == 1 and invert_on == 1:
  3302. killact(25)
  3303. killact(24)
  3304. if own['invert_on'] == 1 and own['last_invert'] == False:
  3305. killall()
  3306. cont.activate(own.actuators['invertOn_sound'])
  3307. if STANCE == False:
  3308. own['invert_type'] = "reg_back_invert_in"
  3309. skater.playAction("reg_back_invert_in", 10,30, layer=303, play_mode=0, speed=1)
  3310. deck.playAction("a_reg_back_invert_in", 10,30, layer=303, play_mode=0, speed=1)
  3311. trucks.playAction("a_reg_back_invert_in", 10,30, layer=303, play_mode=0, speed=1)
  3312. if STANCE == True:
  3313. own['invert_type'] = "fak_fr_invert"
  3314. skater.playAction("fak_fr_invert", 10,30, layer=303, play_mode=0, speed=1)
  3315. deck.playAction("a_fak_fr_invert", 10,30, layer=303, play_mode=0, speed=1)
  3316. trucks.playAction("a_fak_fr_invert", 10,30, layer=303, play_mode=0, speed=1)
  3317. if invert_on == 0 and own['last_invert'] == True:
  3318. #print("kill invert")
  3319. own['last_invert_frame'] = frame
  3320. cont.activate(own.actuators['invertOff_Sound'])
  3321. killact(300)
  3322. killact(301)
  3323. killact(302)
  3324. killact(303)
  3325. killact(304)
  3326. killact(305)
  3327. killact(700)
  3328. killact(700)
  3329. killact(700)
  3330. killact(290)
  3331. killact(291)
  3332. killact(292)
  3333. if own['invert_type'] == "reg_back_invert_in":
  3334. skater.playAction("reg_back_invert_in", 20,0, layer=306, play_mode=0, speed=1)
  3335. deck.playAction("a_reg_back_invert_in", 20,0, layer=306, play_mode=0, speed=1)
  3336. trucks.playAction("a_reg_back_invert_in", 20,0, layer=306, play_mode=0, speed=1)
  3337. if own['invert_type'] == "fak_fr_invert":
  3338. skater.playAction("fak_fr_invert", 20,0, layer=306, play_mode=0, speed=1)
  3339. deck.playAction("a_fak_fr_invert", 20,0, layer=306, play_mode=0, speed=1)
  3340. trucks.playAction("a_fak_fr_invert", 20,0, layer=306, play_mode=0, speed=1)
  3341. if invert_on == 1:
  3342. if own['invert_type'] == "reg_back_invert_in":
  3343. skater.playAction("reg_back_invert_in", 30,30, layer=290, play_mode=1, speed=1)
  3344. deck.playAction("a_reg_back_invert_in", 30,30, layer=290, play_mode=1, speed=1)
  3345. trucks.playAction("a_reg_back_invert_in", 30,30, layer=290, play_mode=1, speed=1)
  3346. if own['invert_type'] == "fak_fr_invert":
  3347. skater.playAction("fak_fr_invert", 30,30, layer=290, play_mode=1, speed=1)
  3348. deck.playAction("a_fak_fr_invert", 30,30, layer=290, play_mode=1, speed=1)
  3349. trucks.playAction("a_fak_fr_invert", 30,30, layer=290, play_mode=1, speed=1)
  3350. lif = own['last_invert_frame']
  3351. if frame - lif > 3 and invert_on == 0:
  3352. own['invert_type'] = None
  3353. invert()
  3354. footplant()
  3355. if own['invert_on'] == 0:
  3356. killact(900)
  3357. def reset_pos():
  3358. #reset
  3359. if ddPad == 1:
  3360. spawn_pos = own['spawn_pos']
  3361. spawn_rot = own['spawn_rot']
  3362. try:
  3363. own.worldPosition = (spawn_pos[0], spawn_pos[1], (spawn_pos[2] + .1))
  3364. 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]]
  3365. except:
  3366. own.worldPosition = (0, 0, .1)
  3367. own.worldOrientation = [[1.0, 0.0, 0.0], [ 0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]
  3368. if own["spawn_stance"] == 1:
  3369. own.setLinearVelocity([.1,0,0], 1)
  3370. #cam.worldPosition = (spawn_pos[0], spawn_pos[1], (spawn_pos[2] + .25))
  3371. #cam.applyMovement([0,-1,0], True)
  3372. #lx = cam.localPosition[1]
  3373. #lx = lx - 4
  3374. #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]]
  3375. #cam.localPosition[1] = lx
  3376. else:
  3377. own.setLinearVelocity([-.1,0,0], 1)
  3378. #cam.worldPosition = (spawn_pos[0], spawn_pos[1], (spawn_pos[2] + .25))
  3379. #cam.applyMovement([0,1,0], True)
  3380. #lx = cam.localPosition[1]
  3381. #lx = lx - 4
  3382. #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]]
  3383. #cam.localPosition[1] = lx
  3384. if udPad == 1:
  3385. own['spawn_pos'] = [own.worldPosition[0], own.worldPosition[1], own.worldPosition[2]]
  3386. 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]]
  3387. stance = own["stance"]
  3388. own["spawn_stance"] = stance
  3389. #start button
  3390. if stBut == True:
  3391. own.actuators["sroll"].volume = .0001
  3392. cont.deactivate(own.actuators["sroll"])
  3393. own.actuators["sroll"].stopSound()
  3394. def ylimit():
  3395. lgf = own['last_grind_frame']
  3396. frame = own['framenum']
  3397. frames_since_grinding = frame - lgf
  3398. if r_ground.triggered and touched == False and grindHit == 0 and frames_since_grinding > 20:
  3399. linVelocity4 = own.getLinearVelocity(True)
  3400. newy = linVelocity4.y * .8 #.4
  3401. force = [linVelocity4.x, newy, linVelocity4.z]
  3402. own.setLinearVelocity(force, True)
  3403. #print("limitting y")
  3404. # own["linVely"] = linVelocity.y
  3405. def getoffboard():
  3406. lasty = own['lasty']
  3407. getoffboard = own['getoffboard']
  3408. if getoffboard == 1 and own['fall'] == False:
  3409. own['getoffboard'] = 0
  3410. if yBut == False and lasty == True:
  3411. own['getoffboard'] = 1
  3412. def switchcam():
  3413. pass
  3414. # if ltsBut == False and own['lastlts'] == True and rtsBut == False:
  3415. # if own['camera'] == 1:
  3416. # own['camera'] = 0
  3417. # else:
  3418. # own['camera'] = 1
  3419. # if rtsBut == False and own['lastrts'] == True and ltsBut == False:
  3420. # if own['camera'] == 2:
  3421. # own['camera'] = 0
  3422. # else:
  3423. # own['camera'] = 2
  3424. #followcam
  3425. def move_followcam():
  3426. if own['camera'] == 2:
  3427. #if rtsBut == False and own['lastrts'] == True:
  3428. if own['lastbkBut'] == True and bkBut == False:
  3429. #print("activate move followcam")
  3430. if own['move_followcam'] == False:
  3431. own['move_followcam'] = True
  3432. else:
  3433. own['move_followcam'] = False
  3434. if own['move_followcam'] == True:
  3435. #act = followcam.actuators[
  3436. camspeed1 = .015
  3437. camspeed2 = .055
  3438. camrot1 = .005
  3439. camrot2 = .02
  3440. #up
  3441. if lUD < -0.080:
  3442. followcam.actuators["up"].dLoc = [ 0, 0, -camspeed2]
  3443. cont.activate(followcam.actuators["up"])
  3444. #print("fastup")
  3445. else:
  3446. cont.deactivate(followcam.actuators["up"])
  3447. # #down
  3448. if lUD > .080:
  3449. followcam.actuators["down"].dLoc = [ 0, 0, camspeed2]
  3450. cont.activate(followcam.actuators["down"])
  3451. else:
  3452. cont.deactivate(followcam.actuators["down"])
  3453. # #left
  3454. if lLR < -0.080:
  3455. followcam.actuators["left"].dLoc = [-camspeed2, 0, 0]
  3456. cont.activate(followcam.actuators["left"])
  3457. else:
  3458. cont.deactivate(followcam.actuators["left"])
  3459. # #right
  3460. if lLR > 0.080:
  3461. followcam.actuators["right"].dLoc = [camspeed2, 0, 0]
  3462. cont.activate(followcam.actuators["right"])
  3463. else:
  3464. cont.deactivate(followcam.actuators["right"])
  3465. #up
  3466. if rUD < -0.080:
  3467. followcam.actuators["rotup"].dLoc = [0, 0, camrot2]
  3468. cont.activate(followcam.actuators["rotup"])
  3469. #print("uppppppppppppppppppppppppppp")
  3470. else:
  3471. cont.deactivate(followcam.actuators["rotup"])
  3472. # #down
  3473. if rUD > .080:
  3474. followcam.actuators["rotdown"].dLoc = [0, 0, -camrot2]
  3475. cont.activate(followcam.actuators["rotdown"])
  3476. else:
  3477. cont.deactivate(followcam.actuators["rotdown"])
  3478. # #left
  3479. if rLR < -0.080:
  3480. followcam.actuators["rotleft"].dRot = [0, 0, camrot2]
  3481. cont.activate(followcam.actuators["rotleft"])
  3482. else:
  3483. cont.deactivate(followcam.actuators["rotleft"])
  3484. # #right
  3485. if rLR > 0.080:
  3486. followcam.actuators["rotright"].dRot = [0, 0, -camrot2]
  3487. cont.activate(followcam.actuators["rotright"])
  3488. else:
  3489. cont.deactivate(followcam.actuators["rotright"])
  3490. #*********************************************
  3491. if lUD > -0.080 and lUD < -0.030:
  3492. followcam.actuators["up"].dLoc = [ 0, 0, -camspeed1]
  3493. cont.activate(followcam.actuators["up"])
  3494. #print(lUD)
  3495. else:
  3496. cont.deactivate(followcam.actuators["up"])
  3497. # #down
  3498. if lUD < .080 and lUD > .03:
  3499. followcam.actuators["down"].dLoc = [ 0, 0, camspeed1]
  3500. cont.activate(followcam.actuators["down"])
  3501. else:
  3502. cont.deactivate(followcam.actuators["down"])
  3503. # #left
  3504. if lLR > -0.080 and lLR < -0.030:
  3505. followcam.actuators["left"].dLoc = [-camspeed1, 0, 0]
  3506. cont.activate(followcam.actuators["left"])
  3507. else:
  3508. cont.deactivate(followcam.actuators["left"])
  3509. # #right
  3510. if lLR < .080 and lLR > .03:
  3511. followcam.actuators["right"].dLoc = [camspeed1, 0, 0]
  3512. cont.activate(followcam.actuators["right"])
  3513. else:
  3514. cont.deactivate(followcam.actuators["right"])
  3515. #up
  3516. if rUD > -0.080 and rUD < -0.030:
  3517. followcam.actuators["rotup"].dRot = [camrot1, 0, 0]
  3518. cont.activate(followcam.actuators["rotup"])
  3519. else:
  3520. cont.deactivate(followcam.actuators["rotup"])
  3521. # #down
  3522. if rUD < .080 and rUD > .03:
  3523. followcam.actuators["rotdown"].dRot = [-camrot1, 0, 0]
  3524. cont.activate(followcam.actuators["rotdown"])
  3525. else:
  3526. cont.deactivate(followcam.actuators["rotdown"])
  3527. # #left
  3528. if rLR > -0.080 and rLR < -0.030:
  3529. followcam.actuators["rotleft"].dRot = [0, 0, camrot1]
  3530. cont.activate(followcam.actuators["rotleft"])
  3531. else:
  3532. cont.deactivate(followcam.actuators["rotleft"])
  3533. # #right
  3534. if rLR < .080 and rLR > .03:
  3535. followcam.actuators["rotright"].dRot = [0, 0, -camrot1]
  3536. cont.activate(followcam.actuators["rotright"])
  3537. else:
  3538. cont.deactivate(followcam.actuators["rotright"])
  3539. def move_flycam():
  3540. if own['camera'] == 1:
  3541. #if rtsBut == False and own['lastrts'] == True:
  3542. if own['lastbkBut'] == True and bkBut == False:
  3543. if own['move_freecam'] == False:
  3544. own['move_freecam'] = True
  3545. else:
  3546. own['move_freecam'] = False
  3547. if own['move_freecam'] == True:
  3548. #act = freecam.actuators[
  3549. camspeed1 = .015
  3550. camspeed2 = .055
  3551. camrot1 = .005
  3552. camrot2 = .02
  3553. #up
  3554. if lUD < -0.080:
  3555. freecam.actuators["up"].dLoc = [ 0, 0, -camspeed2]
  3556. cont.activate(freecam.actuators["up"])
  3557. #print("fastup")
  3558. else:
  3559. cont.deactivate(freecam.actuators["up"])
  3560. # #down
  3561. if lUD > .080:
  3562. freecam.actuators["down"].dLoc = [ 0, 0, camspeed2]
  3563. cont.activate(freecam.actuators["down"])
  3564. else:
  3565. cont.deactivate(freecam.actuators["down"])
  3566. # #left
  3567. if lLR < -0.080:
  3568. freecam.actuators["left"].dLoc = [-camspeed2, 0, 0]
  3569. cont.activate(freecam.actuators["left"])
  3570. else:
  3571. cont.deactivate(freecam.actuators["left"])
  3572. # #right
  3573. if lLR > 0.080:
  3574. freecam.actuators["right"].dLoc = [camspeed2, 0, 0]
  3575. cont.activate(freecam.actuators["right"])
  3576. else:
  3577. cont.deactivate(freecam.actuators["right"])
  3578. #up
  3579. if rUD < -0.080:
  3580. freecam.actuators["rotup"].dRot = [camrot2, 0, 0]
  3581. cont.activate(freecam.actuators["rotup"])
  3582. else:
  3583. cont.deactivate(freecam.actuators["rotup"])
  3584. # #down
  3585. if rUD > .080:
  3586. freecam.actuators["rotdown"].dRot = [-camrot2, 0, 0]
  3587. cont.activate(freecam.actuators["rotdown"])
  3588. else:
  3589. cont.deactivate(freecam.actuators["rotdown"])
  3590. # #left
  3591. if rLR < -0.080:
  3592. freecam.actuators["rotleft"].dRot = [0, 0, camrot2]
  3593. cont.activate(freecam.actuators["rotleft"])
  3594. else:
  3595. cont.deactivate(freecam.actuators["rotleft"])
  3596. # #right
  3597. if rLR > 0.080:
  3598. freecam.actuators["rotright"].dRot = [0, 0, -camrot2]
  3599. cont.activate(freecam.actuators["rotright"])
  3600. else:
  3601. cont.deactivate(freecam.actuators["rotright"])
  3602. #*********************************************
  3603. if lUD > -0.080 and lUD < -0.030:
  3604. freecam.actuators["up"].dLoc = [ 0, 0, -camspeed1]
  3605. cont.activate(freecam.actuators["up"])
  3606. #print(lUD)
  3607. else:
  3608. cont.deactivate(freecam.actuators["up"])
  3609. # #down
  3610. if lUD < .080 and lUD > .03:
  3611. freecam.actuators["down"].dLoc = [ 0, 0, camspeed1]
  3612. cont.activate(freecam.actuators["down"])
  3613. else:
  3614. cont.deactivate(freecam.actuators["down"])
  3615. # #left
  3616. if lLR > -0.080 and lLR < -0.030:
  3617. freecam.actuators["left"].dLoc = [-camspeed1, 0, 0]
  3618. cont.activate(freecam.actuators["left"])
  3619. else:
  3620. cont.deactivate(freecam.actuators["left"])
  3621. # #right
  3622. if lLR < .080 and lLR > .03:
  3623. freecam.actuators["right"].dLoc = [camspeed1, 0, 0]
  3624. cont.activate(freecam.actuators["right"])
  3625. else:
  3626. cont.deactivate(freecam.actuators["right"])
  3627. #up
  3628. if rUD > -0.080 and rUD < -0.030:
  3629. freecam.actuators["rotup"].dRot = [camrot1, 0, 0]
  3630. cont.activate(freecam.actuators["rotup"])
  3631. else:
  3632. cont.deactivate(freecam.actuators["rotup"])
  3633. # #down
  3634. if rUD < .080 and rUD > .03:
  3635. freecam.actuators["rotdown"].dRot = [-camrot1, 0, 0]
  3636. cont.activate(freecam.actuators["rotdown"])
  3637. else:
  3638. cont.deactivate(freecam.actuators["rotdown"])
  3639. # #left
  3640. if rLR > -0.080 and rLR < -0.030:
  3641. freecam.actuators["rotleft"].dRot = [0, 0, camrot1]
  3642. cont.activate(freecam.actuators["rotleft"])
  3643. else:
  3644. cont.deactivate(freecam.actuators["rotleft"])
  3645. # #right
  3646. if rLR < .080 and rLR > .03:
  3647. freecam.actuators["rotright"].dRot = [0, 0, -camrot1]
  3648. cont.activate(freecam.actuators["rotright"])
  3649. else:
  3650. cont.deactivate(freecam.actuators["rotright"])
  3651. if r_ground.triggered == False:
  3652. own["lF_air_frame"] = own["framenum"]
  3653. if r_ground.triggered == True:
  3654. own["lF_ground_frame"] = own["framenum"]
  3655. if own['LAST_GRIND'] == True:
  3656. own['last_grind_frame'] = own['framenum']
  3657. if own['LAST_GRIND'] == False and r_ground.triggered and own['jump_timer'] == 0:
  3658. if own['jump_stance'] != 3:
  3659. own['jump_stance'] = 3
  3660. def control_calib():
  3661. #controller calibration test
  3662. scenes = bge.logic.getSceneList()
  3663. controller_calib = [scene for scene in scenes if scene.name=="controller_calib"][0]
  3664. cq1 = controller_calib.objects['q1']
  3665. cq2 = controller_calib.objects['q2']
  3666. cq3 = controller_calib.objects['q3']
  3667. cq4 = controller_calib.objects['q4']
  3668. cq5 = controller_calib.objects['q5']
  3669. cq6 = controller_calib.objects['q6']
  3670. cq7 = controller_calib.objects['q7']
  3671. cq8 = controller_calib.objects['q8']
  3672. if lq1on == 1:
  3673. cq1["q1"] = 1
  3674. else:
  3675. cq1["q1"] = 0
  3676. if lq2on == 1:
  3677. cq2["q2"] = 1
  3678. else:
  3679. cq2["q2"] = 0
  3680. if lq3on == 1:
  3681. cq3["q3"] = 1
  3682. else:
  3683. cq3["q3"] = 0
  3684. if lq4on == 1:
  3685. cq4["q4"] = 1
  3686. else:
  3687. cq4["q4"] = 0
  3688. if lq5on == 1:
  3689. cq5["q5"] = 1
  3690. else:
  3691. cq5["q5"] = 0
  3692. if lq6on == 1:
  3693. cq6["q6"] = 1
  3694. else:
  3695. cq6["q6"] = 0
  3696. if lq7on == 1:
  3697. cq7["q7"] = 1
  3698. else:
  3699. cq7["q7"] = 0
  3700. if lq8on == 1:
  3701. cq8["q8"] = 1
  3702. else:
  3703. cq8["q8"] = 0
  3704. def grind_turn():
  3705. jumping = None
  3706. gotcd = 25
  3707. force = [0,0,0]
  3708. grindHit = own['grindTouch']
  3709. if rUD > turnsens or rLR > turnsens or rUD < -turnsens or rLR < -turnsens:
  3710. jumping = True
  3711. if grindHit == False:
  3712. cont.deactivate(own.actuators['grindoutRight'])
  3713. cont.deactivate(own.actuators['grindoutLeft'])
  3714. if grindHit == True and jumping == None:
  3715. outloc = 0.022
  3716. bsoutloc = .07
  3717. bsoutvel = .1
  3718. outrot = .02 #0.012
  3719. outrot2 = .24
  3720. outact = own.actuators["grindoutRight"]
  3721. if own['grindpos'] == 'reg_5050':
  3722. if lq3on == 1 or lq2on:
  3723. if own['gt_cd2'] == 0:
  3724. own['gt_cd2'] = 60
  3725. if STANCE == True:
  3726. if own['grind_out_type'] == None:
  3727. own['grind_out_type'] = 'fak right'
  3728. if STANCE == False:
  3729. if own['grind_out_type'] == None:
  3730. own['grind_out_type'] = 'reg right'
  3731. own["grindoutturn"] = gotcd
  3732. if lq7on == 1 or lq8on:
  3733. if own['gt_cd2'] == 0:
  3734. own['gt_cd2'] = 60
  3735. if STANCE == True:
  3736. if own['grind_out_type'] == None:
  3737. own['grind_out_type'] = 'fak left'
  3738. if STANCE == False:
  3739. if own['grind_out_type'] == None:
  3740. own['grind_out_type'] = 'reg left'
  3741. own["grindoutturn"] = gotcd
  3742. if lq4on == 1:
  3743. if own['gt_cd2'] == 0:
  3744. own['gt_cd2'] = 60
  3745. if STANCE == True:
  3746. if own['grind_out_type'] == None:
  3747. own['grind_out_type'] = 'fak fak right'
  3748. if STANCE == False:
  3749. if own['grind_out_type'] == None:
  3750. own['grind_out_type'] = 'reg fak right'
  3751. own["grindoutturn"] = gotcd
  3752. if lq6on == 1:
  3753. if own['gt_cd2'] == 0:
  3754. own['gt_cd2'] = 60
  3755. if STANCE == True:
  3756. if own['grind_out_type'] == None:
  3757. own['grind_out_type'] = 'fak fak left'
  3758. if STANCE == False:
  3759. if own['grind_out_type'] == None:
  3760. own['grind_out_type'] = 'reg fak left'
  3761. own["grindoutturn"] = gotcd
  3762. #use stance for 5050 and grindstance for boards
  3763. if own['grindpos'] == 'reg_board':
  3764. outvel = own.getLinearVelocity(1)
  3765. outact.dLoc = [0, 0, 0]
  3766. outact.dRot = [0, 0, 0]
  3767. if lq5on == 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 back'
  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 back'
  3782. own["grindoutturn"] = gotcd
  3783. own['invert_on'] = 0
  3784. if lq1on == 1:
  3785. if own['gt_cd2'] == 0:
  3786. own['gt_cd2'] = 60
  3787. if own['grind_stance'] == True:
  3788. if own['footplant_on'] == True:
  3789. own.setLinearVelocity([(outvel.x + bsoutvel), outvel.y, outvel.z], 1)
  3790. cont.activate(own.actuators["grindoutRight"])
  3791. if own['grind_out_type'] == None:
  3792. own['grind_out_type'] = 'bs fak forward'
  3793. if own['grind_stance'] == False:
  3794. if own['footplant_on'] == True:
  3795. own.setLinearVelocity([(outvel.x + -bsoutvel), outvel.y, outvel.z], 1)
  3796. cont.activate(own.actuators["grindoutRight"])
  3797. if own['grind_out_type'] == None:
  3798. own['grind_out_type'] = 'bs reg forward'
  3799. own["grindoutturn"] = gotcd
  3800. own['invert_on'] = 0
  3801. if lq1on or lq2on or lq3on or lq4on or lq5on or lq6on or lq7on or lq8on:
  3802. gt_cd = own['gt_cd']
  3803. if gt_cd == 0:
  3804. gt_cd = 30
  3805. own['gt_cd'] = gt_cd
  3806. #else:
  3807. #else:
  3808. if own['grindoutturn'] == 0:
  3809. cont.deactivate(own.actuators["grindoutRight"])
  3810. own["grindoutturn"] = 0
  3811. gt_cd = own['gt_cd']
  3812. if gt_cd > 0:
  3813. own['gt_cd'] = gt_cd - 1
  3814. else:
  3815. own['gt_cd'] = 0
  3816. #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  3817. reg_move = .05
  3818. reg_rot = 0.01
  3819. reg_rot2 = .26
  3820. reg_move2 = .13
  3821. bsforce = 50
  3822. bs_dloc = .03
  3823. outvel = own.linearVelocity
  3824. if own['gt_cd2'] > 50:
  3825. if own['grind_out_type'] == 'reg right':
  3826. #print("do reg right")
  3827. own.applyMovement([0,reg_move,0], True)
  3828. own.applyRotation([0,0,reg_rot],True)
  3829. if own['grind_out_type'] == 'fak right':
  3830. own.applyMovement([0,-reg_move,0], True)
  3831. own.applyRotation([0,0,-reg_rot],True)
  3832. #print("do fak right")
  3833. if own['grind_out_type'] == 'reg left':
  3834. #print("do reg left")
  3835. own.applyMovement([0,-reg_move,0], True)
  3836. own.applyRotation([0,0,reg_rot],True)
  3837. if own['grind_out_type'] == 'fak left':
  3838. own.applyMovement([0,reg_move,0], True)
  3839. own.applyRotation([0,0,-reg_rot],True)
  3840. #print("do fak left")
  3841. if own['grind_out_type'] == 'reg fak right':
  3842. if own['gt_cd2'] > 55:
  3843. own.applyMovement([0,reg_move2,0], True)
  3844. own.applyRotation([0,0,reg_rot2],True)
  3845. #print("do reg fak right")
  3846. if own['grind_out_type'] == 'fak fak right':
  3847. if own['gt_cd2'] > 55:
  3848. own.applyMovement([0,-reg_move2,0], True)
  3849. own.applyRotation([0,0,reg_rot2],True)
  3850. #print("do fak fak right")
  3851. if own['grind_out_type'] == 'reg fak left':
  3852. if own['gt_cd2'] > 55:
  3853. own.applyMovement([0,-reg_move2,0], True)
  3854. own.applyRotation([0,0,-reg_rot2],True)
  3855. #print("do reg fak left")
  3856. if own['grind_out_type'] == 'fak fak left':
  3857. if own['gt_cd2'] > 55:
  3858. own.applyMovement([0,reg_move2,0], True)
  3859. own.applyRotation([0,0,-reg_rot2],True)
  3860. #print("do fak fak left")
  3861. 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':
  3862. own.setLinearVelocity([outvel.x * 1.01, outvel.y, outvel.z], True)
  3863. 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':
  3864. if own['gt_cd2'] == 51:
  3865. #print('outforce')
  3866. if STANCE == 0:
  3867. own.applyForce([-200, 0, 0], True)
  3868. if STANCE == 1:
  3869. own.applyForce([200, 0, 0], True)
  3870. if own['grind_out_type'] == 'bs reg back' or own['grind_out_type'] == 'bs fak forward':
  3871. if own['gt_cd2'] > 50:
  3872. if STANCE == True:
  3873. own.applyForce([bsforce, 0, 0], True)
  3874. if STANCE == False:
  3875. own.applyForce([bsforce, 0, 0], True)
  3876. own.applyMovement([bs_dloc,0,0], True)
  3877. if own['grind_out_type'] == 'bs fak back' or own['grind_out_type'] == 'bs reg forward':
  3878. if own['gt_cd2'] > 50:
  3879. if STANCE == True:
  3880. own.applyForce([-bsforce, 0, 0], True)
  3881. if STANCE == False:
  3882. own.applyForce([-bsforce, 0, 0], True)
  3883. own.applyMovement([-bs_dloc,0,0], True)
  3884. #print("setting linvel", own.linearVelocity, outvel)
  3885. if own['gt_cd2'] > 0:
  3886. own['gt_cd2'] -= 1
  3887. if own['gt_cd2'] == 0:
  3888. own['grind_out_type'] = None
  3889. #print(own['grind_out_type'])
  3890. #print(own["gt_cd"])
  3891. if own["grindoutturn"] > 0:
  3892. own["grindoutturn"] = own["grindoutturn"] - 1
  3893. def air_height():
  3894. height = own["air_height"]
  3895. if lf_ground == True and r_ground.triggered == False:
  3896. height = 0
  3897. #if
  3898. #wallride
  3899. def wallride():
  3900. wallride_off = own['wallride_off']
  3901. distance = own.getDistanceTo(gray.hitPosition)
  3902. upforce = 25
  3903. sideforce = 15
  3904. #distance = own["air_height"]
  3905. try:
  3906. obj = gray.hitObject
  3907. objpos = obj.worldPosition
  3908. ownpos = own.worldPosition
  3909. distance = ownpos.z - objpos.z
  3910. #print(distance)
  3911. except:
  3912. pass
  3913. if wallrideL.triggered and wallride_off == 0 and r_ground.triggered == False:
  3914. #print("wallrideL", distance)
  3915. own['jump_timer'] = 0
  3916. if r_ground.triggered == False:
  3917. own["wallride"] = "L"
  3918. #print(own["wallride"])
  3919. cont.activate(wallrideconstL)
  3920. force = [0,sideforce,upforce]
  3921. own.applyForce(force,1)
  3922. #own.alignAxisToVect(obj.worldPosition, 1, .9)
  3923. #align
  3924. if STANCE == 0:
  3925. skater.playAction("reg_wall_r", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3926. else:
  3927. skater.playAction("fak_wall_l", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3928. deck.playAction("a_reg_wall_r", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3929. trucks.playAction("a_reg_wall_r", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3930. else:
  3931. if own["wallride"] != "R":
  3932. own["wallride"] = None
  3933. cont.deactivate(wallrideconstL)
  3934. killact(3000)
  3935. killact(3001)
  3936. killact(3002)
  3937. if wallrideR.triggered and wallride_off == 0:
  3938. own['jump_timer'] = 0
  3939. #print("wallrideR", distance)
  3940. if r_ground.triggered == False:
  3941. own["wallride"] = "R"
  3942. cont.activate(wallrideconstR)
  3943. force = [0,-sideforce,upforce]
  3944. own.applyForce(force,1)
  3945. #own.alignAxisToVect(obj.worldPosition, 1, .9)
  3946. if STANCE == 0:
  3947. skater.playAction("reg_wall_l", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3948. else:
  3949. skater.playAction("fak_wall_r", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3950. deck.playAction("a_reg_wall_l2", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3951. trucks.playAction("a_reg_wall_l2", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3952. else:
  3953. if own["wallride"] != "L":
  3954. own["wallride"] = None
  3955. cont.deactivate(wallrideconstR)
  3956. killact(3003)
  3957. killact(3004)
  3958. killact(3005)
  3959. def wallride_sound():
  3960. sact = own.actuators["wallSound"]
  3961. if own["wallride"] != None:
  3962. sact.volume = .2
  3963. cont.activate(own.actuators["wallSound"])
  3964. else:
  3965. sact.volume = .001
  3966. sact.stopSound()
  3967. if own['revert_timer'] > 0:
  3968. own['revert_timer'] = own['revert_timer'] - 1
  3969. def shutoff_timers():
  3970. #print(wallride)
  3971. if (LAST_GRIND == False and grindHit == True) or (jump_timer > 10 and own['wallride'] == None):
  3972. own["Q1oncd"] = 0
  3973. own["Q2oncd"] = 0
  3974. own["Q3oncd"] = 0
  3975. own["Q4oncd"] = 0
  3976. own["Q5oncd"] = 0
  3977. own["Q6oncd"] = 0
  3978. own["Q7oncd"] = 0
  3979. own["Q8oncd"] = 0
  3980. def grindout_cleanup():
  3981. lgf = own['last_grind_frame']
  3982. def trans_jump():
  3983. if own['jump_from_trans'] == 1:
  3984. ground_ray = cont.sensors['ground_look']
  3985. jump_obj = own['trans_jump_obj']
  3986. jump_obj = scene.objects[str(own['trans_jump_obj'])]
  3987. #print(jump_obj)
  3988. worldVect = [1, 0, 0]
  3989. vect = jump_obj.getAxisVect(worldVect)
  3990. go = jump_obj.worldOrientation
  3991. grinder_axis = [0,1,0]
  3992. player_pos = own.worldPosition
  3993. jump_obj = jump_obj.worldPosition
  3994. try:
  3995. delta = player_pos - jump_obj
  3996. except:
  3997. #print("delta broke: ", player_pos, grinder_pos)
  3998. pass
  3999. delta = delta.cross(vect)
  4000. deltamove = delta[1] * .25
  4001. move = [deltamove, 0, 0]
  4002. #print(deltamove)
  4003. if abs(deltamove) < 1 and delta[1] < 1:
  4004. own.applyMovement(move, True)
  4005. #print(deltamove, delta, "delta.......")
  4006. #pos = ground_ray.hitPosition
  4007. #print(pos)
  4008. #linvelloc6 = own.getLinearVelocity(True)
  4009. #xvel6 = linvelloc6.x * .95
  4010. #force = (xvel6, linvelloc6.y, linvelloc6.z)
  4011. #own.setLinearVelocity(force, True)
  4012. #control_calib() #scene must be enabled in main
  4013. jump_Timer()
  4014. check_landing()
  4015. #SWAG()
  4016. #isplaying()
  4017. nextframe()
  4018. wheelroll()
  4019. rollsound()
  4020. reset_pos()
  4021. ylimit()
  4022. getoffboard()
  4023. #switchcam()
  4024. move_flycam()
  4025. move_followcam()
  4026. grind_turn()
  4027. air_height()
  4028. wallride()
  4029. wallride_sound()
  4030. shutoff_timers()
  4031. grindout_cleanup()
  4032. #trans_jump()
  4033. #printplaying()
  4034. #transmult()
  4035. linvelx = own.getLinearVelocity(True)
  4036. #print(linvelx)
  4037. own["linvelx"] = linvelx.x
  4038. LAST_STANCE = STANCE
  4039. LAST_STANCE = own["stance"]
  4040. own["last_stance"] = STANCE
  4041. own["lastGrab"] = GRAB_ON
  4042. own['ground'] = r_ground.triggered
  4043. own['last_ground'] = r_ground.triggered
  4044. own["LAST_GRIND"] = grindHit
  4045. own["rotz"] = rot.z
  4046. own['walk'] = 0
  4047. own['lasty'] = yBut
  4048. own['lastlts'] = ltsBut
  4049. own['lastrts'] = rtsBut
  4050. own["lF_ground2"] = own["lF_ground"]
  4051. own['last_invert'] = invert_on
  4052. own['lastbkBut'] = bkBut
  4053. own['grab_type'] = grab_type
  4054. own['last_last_manual'] = own['last_manual']
  4055. own['last_manual'] = own['manual']
  4056. own['last_reg_manual'] = own['reg_manual']
  4057. own['last_fak_manual'] = own['fak_manual']
  4058. own['last_fak_nmanual'] = own['fak_nmanual']
  4059. own['last_reg_nmanual'] = own['reg_nmanual']
  4060. if own['manual'] == 1:
  4061. own['last_manual_frame'] = frame
  4062. #print(own['hippy'], own['last_hippy'])
  4063. own['last_hippy'] = own['hippy']
  4064. #last pressed down frame
  4065. if aBut == 1 and own["lasta"] == 0:
  4066. own["lastaf"] = frame
  4067. if xBut == 1 and own["lastx"] == 0:
  4068. own["lastxf"] = frame
  4069. own["lasta"] = aBut
  4070. own["lastx"] = xBut
  4071. own['lastaBut_ground'] = aBut_ground
  4072. own['lastxBut_ground'] = xBut_ground
  4073. own["last_sel"] = own["sel"]
  4074. own["sel"] = bkBut
  4075. if r_ground.triggered and own["jump_timer"] < 20:
  4076. force2 = [0.0, 0, -10]
  4077. own.applyForce(force2, True)