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

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