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

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