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

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