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

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