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

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