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

controller2.py 162KB

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