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

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