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

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