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

controller2.py 156KB

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