Shuvit game release repo.
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 175KB

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