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

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