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

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