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

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