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

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