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

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