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

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