Shuvit game master repo. http://shuvit.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

controller2.py 161KB

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