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 159KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271
  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 > .03 and rUD < .08) or (rUD < -.03 and rUD > -.08):
  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 > .03 and rUD < .08 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 <= .03 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 > .03 and rUD < .08 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 <= .03 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 < -.03 and rUD > -.08 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 >= -.03 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 < -.03 and rUD > -.08 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 >= -.03 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['requestAction'] = 'fak_noseslide'
  1974. own['grind_stance'] = 0
  1975. elif own['grindType'] == "fak_tailslide":
  1976. own['requestAction'] = 'fak_tailslide'
  1977. own['grind_stance'] = 1
  1978. elif own['grindType'] == "reg_noseslide":
  1979. #own['requestAction'] = 'reg_noseslide'
  1980. own['requestAction'] = 'fak_tailslide'
  1981. own['grind_stance'] = 0
  1982. elif own['grindType'] == "fak_noseslide":
  1983. own['requestAction'] = 'fak_noseslide'
  1984. own['grind_stance'] = 1
  1985. # elif own['grindType'] == "nose_stall":
  1986. # own['requestAction'] = 'nose_stall'
  1987. # skater.playAction("fak_nose_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  1988. # deck.playAction("a_fak_nose_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  1989. # trucks.playAction("a_fak_nose_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  1990. # elif own['grindType'] == "tail_stall":
  1991. # own['requestAction'] = 'tail_stall'
  1992. # skater.playAction("fak_tail_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  1993. # deck.playAction("a_fak_tail_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  1994. # trucks.playAction("a_fak_tail_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  1995. else:
  1996. if STANCE == 0:
  1997. own['requestAction'] = 'reg_5050'
  1998. if STANCE == 1:
  1999. own['requestAction'] = 'fak_5050'
  2000. #elif STANCE == False and LAST_GRIND == False:
  2001. elif STANCE == False:
  2002. if own['grindType'] == "reg_bsboard":
  2003. own['grind_stance'] = 0
  2004. own['requestAction'] = 'reg_bsboard'
  2005. elif own['grindType'] == "fak_bsboard":
  2006. own['grind_stance'] = 1
  2007. own['requestAction'] = 'fak_bsboard'
  2008. elif own['grindType'] == "reg_tailg":
  2009. own['grind_stance'] = 0
  2010. own['requestAction'] = 'reg_tailg'
  2011. elif own['grindType'] == "reg_tailgR":
  2012. own['requestAction'] = 'reg_tailgr'
  2013. elif own['grindType'] == "reg_tailgL":
  2014. own['requestAction'] = 'reg_tailgl'
  2015. elif own['grindType'] == "reg_noseg":
  2016. own['requestAction'] = 'reg_noseg'
  2017. elif own['grindType'] == "reg_nosegR":
  2018. own['requestAction'] = 'reg_nosegr'
  2019. elif own['grindType'] == "reg_nosegL":
  2020. own['requestAction'] = 'reg_nosegl'
  2021. elif own['grindType'] == "fak_noseg":
  2022. own['requestAction'] = 'fak_noseg'
  2023. elif own['grindType'] == "fak_nosegR":
  2024. own['requestAction'] = 'fak_nosegr'
  2025. elif own['grindType'] == "fak_nosegL":
  2026. own['requestAction'] = 'fak_nosegl'
  2027. elif own['grindType'] == "fak_tailg":
  2028. own['requestAction'] = 'fak_tailg'
  2029. elif own['grindType'] == "fak_tailgR":
  2030. own['requestAction'] = 'fak_tailgr'
  2031. elif own['grindType'] == "fak_tailgL":
  2032. own['requestAction'] = 'fak_tailgl'
  2033. elif own['grindType'] == "reg_tailslide":
  2034. own['requestAction'] = 'reg_tailslide'
  2035. elif own['grindType'] == "fak_tailslide":
  2036. own['grind_stance'] = 1
  2037. #own['requestAction'] = 'fak_tailslide'
  2038. own['requestAction'] = 'reg_noseslide'
  2039. print('mod slide')
  2040. elif own['grindType'] == "reg_noseslide":
  2041. own['grind_stance'] = 0
  2042. own['requestAction'] = 'reg_noseslide'
  2043. elif own['grindType'] == "fak_noseslide":
  2044. own['grind_stance'] = 1
  2045. #own['requestAction'] = 'fak_noseslide'
  2046. own['requestAction'] = 'reg_tailslide'
  2047. # elif own['grindType'] == "nose_stall":
  2048. # skater.playAction("nose_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2049. # deck.playAction("a_nose_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2050. # trucks.playAction("a_nose_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2051. # #print("nose_stall")
  2052. # elif own['grindType'] == "tail_stall":
  2053. # skater.playAction("reg_tail_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2054. # deck.playAction("a_reg_tail_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2055. # trucks.playAction("a_reg_tail_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2056. #print("reg_tail_stall")
  2057. else:
  2058. if STANCE == 0:
  2059. own['requestAction'] = 'reg_5050'
  2060. if STANCE == 1:
  2061. own['requestAction'] = 'fak_5050'
  2062. def rotmult():
  2063. if r_ground.triggered:
  2064. num = ((rot.z * -1) +1)
  2065. num = num * 100
  2066. def airup():
  2067. if r_ground.triggered == False:
  2068. pos = own.worldPosition
  2069. pos = own.worldPosition.z
  2070. last_pos = own['last_posz']
  2071. if last_pos - pos > 0:
  2072. own['airup'] = 0
  2073. if last_pos - pos < 0:
  2074. own['airup'] = 1
  2075. if pos > own['last_posz']:
  2076. own["air_height"] = pos
  2077. own['last_posz'] = pos
  2078. def onramp():
  2079. if r_ground.positive:
  2080. if 'ramp' in r_ground.hitObject:
  2081. own['onramp'] = 1
  2082. else:
  2083. own['onramp'] = 0
  2084. else:
  2085. own['onramp'] = 0
  2086. def grindtype(gtype):
  2087. own['grindType'] = gtype
  2088. def transmult():
  2089. lastrotz = own["rotz"]
  2090. linvel = own.getLinearVelocity(True)
  2091. newx = (linvel.x + (linvel.x * .039))
  2092. 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:
  2093. own.setLinearVelocity([newx, linvel.y, linvel.z], True)
  2094. def speedmult():
  2095. vel = own.getLinearVelocity(True)
  2096. xyz = own.worldOrientation.to_euler()
  2097. roty = math.degrees(xyz[1])
  2098. roty = abs(roty)
  2099. roty = roty * .0005
  2100. if abs(vel.x) > 1:
  2101. mult = .0015 + roty
  2102. else:
  2103. mult = .000
  2104. mult2 = .018
  2105. mult3 = .007
  2106. lastrotz = own["rotz"]
  2107. x = vel.x * mult
  2108. x2 = x + vel.x
  2109. x3 = vel.x * mult2
  2110. x4 = x3 + vel.x
  2111. x5 = vel.x * mult3
  2112. x6 = x5 + vel.x
  2113. if r_ground.triggered and vel.x < 4 and vel.x > -4:
  2114. own.setLinearVelocity([x2, vel.y, vel.z], True)
  2115. def coping():
  2116. if invertTouch.positive:
  2117. own["coping"] = 1
  2118. else:
  2119. own["coping"] = 0
  2120. def onboard():
  2121. if own['walk'] == 1:
  2122. cont.deactivate(cam.actuators['replayCam'])
  2123. cont.activate(cam.actuators['Camera'])
  2124. killall()
  2125. walklay = 40
  2126. fliplay3 = 2060
  2127. ob_speed = .5
  2128. if STANCE == 0:
  2129. skater.stopAction(fliplay)
  2130. deck.stopAction(fliplay)
  2131. trucks.stopAction(fliplay)
  2132. killall()
  2133. if own['dropinCol'] == True:
  2134. print("dropinanim")
  2135. own['requestAction'] = reg_dropin
  2136. else:
  2137. own['requestAction'] = 'reg_onboard'
  2138. force = (linVelocity.x -1, linVelocity.y, linVelocity.z)
  2139. own.setLinearVelocity(force, True)
  2140. own['dropinTimer'] = 60
  2141. if STANCE == 1:
  2142. skater.stopAction(fliplay)
  2143. deck.stopAction(fliplay)
  2144. trucks.stopAction(fliplay)
  2145. killall()
  2146. if own['dropinTimer'] > 30:
  2147. print("dropinanim2")
  2148. own['requestAction'] = fak_dropin
  2149. else:
  2150. own['requestAction'] = 'fak_onboard'
  2151. force = (linVelocity.x +1, linVelocity.y, linVelocity.z)
  2152. own.setLinearVelocity(force, True)
  2153. own['dropinTimer'] = 60
  2154. else:
  2155. num = own['dropinTimer']
  2156. if num > 0:
  2157. num = num - 1
  2158. own['dropinTimer'] = num
  2159. def offboard():
  2160. wheel1.stopAction(2)
  2161. wheel2.stopAction(2)
  2162. wheel3.stopAction(2)
  2163. wheel4.stopAction(2)
  2164. cont.deactivate(own.actuators["sroll"])
  2165. sact = own.actuators["sroll"]
  2166. sact.volume = .0001
  2167. own.actuators["sroll"].stopSound()
  2168. own['offboard_vel'] = own.linearVelocity
  2169. own['walk_timer'] = 0
  2170. def resetjumpstance():
  2171. if LAST_GRIND == True and grindHit == False:
  2172. own["lF_ground_frame"] = own['framenum']
  2173. lfg = own["lF_ground_frame"]
  2174. #print(lfg, "----- this?")
  2175. if own['jump_stance'] != 3:
  2176. own['jump_stance'] = 3
  2177. def grass():
  2178. try:
  2179. if 'grass' in r_ground.hitObject:
  2180. #print("grass")
  2181. linVel = own.getLinearVelocity(True)
  2182. linvelx = linVel.x * .98
  2183. own.setLinearVelocity((linvelx, linVel.y, linVel.z), 1)
  2184. except:
  2185. pass
  2186. def grindoutair():
  2187. skippy = 0
  2188. linVel = own.getLinearVelocity(True)
  2189. if own['LAST_GRIND'] == True and grindHit == True:
  2190. own['lg_stance'] = STANCE
  2191. lg_stance = own['lg_stance']
  2192. own.actuators["grindoutair"].useLocalLinV = True
  2193. if own['grindjumpturn'] == True and own['grindCountdown'] > 12 and skippy == 0:
  2194. grindoutspeed = .1
  2195. grindoutspeed2 = 5.4
  2196. if lLR > turnsens:
  2197. if own['last_grindpos'] == 'reg_5050':
  2198. if STANCE == 0:
  2199. own.actuators["grindoutair"].linV = [0, grindoutspeed, 0]
  2200. else:
  2201. own.actuators["grindoutair"].linV = [0, -grindoutspeed, 0]
  2202. cont.activate(own.actuators["grindoutair"])
  2203. if lLR < -turnsens:
  2204. if own['last_grindpos'] == 'reg_5050':
  2205. if STANCE == 0:
  2206. own.actuators["grindoutair"].linV = [0, -grindoutspeed, 0]
  2207. else:
  2208. own.actuators["grindoutair"].linV = [0, grindoutspeed, 0]
  2209. cont.activate(own.actuators["grindoutair"])
  2210. if lUD > turnsens:
  2211. js = own['lg_stance']
  2212. linvelx = own.getLinearVelocity(True)
  2213. if own['last_grindpos'] == 'reg_board':
  2214. if js == 1:
  2215. own.actuators["grindoutair"].linV = [-grindoutspeed, 0, 0]
  2216. cont.activate(own.actuators["grindoutair"])
  2217. else:
  2218. own.actuators["grindoutair"].linV = [grindoutspeed, 0, 0]
  2219. cont.activate(own.actuators["grindoutair"])
  2220. if lUD < -turnsens:
  2221. js = own['lg_stance']
  2222. if own['last_grindpos'] == 'reg_board':
  2223. if js == 0:
  2224. own.actuators["grindoutair"].linV = [-grindoutspeed, 0, 0]
  2225. cont.activate(own.actuators["grindoutair"])
  2226. else:
  2227. own.actuators["grindoutair"].linV = [grindoutspeed, 0, 0]
  2228. cont.activate(own.actuators["grindoutair"])
  2229. if LAST_GRIND == False and r_ground.triggered and own['grindjumpturn'] == True and own['grindCountdown'] < 1:
  2230. own['grindjumpturn'] = False
  2231. if r_ground.triggered:
  2232. own['grind_jump'] = False
  2233. if own['grindjumpturn'] == False or own['grindCountdown'] < 19:
  2234. cont.deactivate(own.actuators["grindoutair"])
  2235. def set_last_grindpos():
  2236. if own['grindpos'] != None:
  2237. own['last_grindpos'] = own['grindpos']
  2238. def air_pos():
  2239. grindpos = own['grindpos']
  2240. GRAB_ON = own["GRAB_ON"]
  2241. wr = own["wallride"]
  2242. jump_timer = own['jump_timer']
  2243. if rUD > .040 and r_ground.triggered == False and GRAB_ON == False and wr == None and jump_timer < 30:
  2244. killact(2)
  2245. killact(4)
  2246. if STANCE == 0:
  2247. own['requestAction'] = 'reg_air_tail'
  2248. print("reg_air_tail")
  2249. else:
  2250. own['requestAction'] = 'fak_air_tail'
  2251. print("fak_air_tail")
  2252. elif rUD < -.040 and r_ground.triggered == False and GRAB_ON == False and wr == None and jump_timer < 30:
  2253. killact(2)
  2254. killact(4)
  2255. if STANCE == 0:
  2256. own['requestAction'] = 'reg_air_nose'
  2257. print("reg_air_nose")
  2258. else:
  2259. own['requestAction'] = 'fak_air_nose'
  2260. print("fak_air_nose")
  2261. def air_turn_boost():
  2262. pass
  2263. def revert():
  2264. own["Q3oncdl"] = 0
  2265. own["Q4oncdl"] = 0
  2266. own["Q5oncdl"] = 0
  2267. own["Q6oncdl"] = 0
  2268. own["Q7oncdl"] = 0
  2269. local = True
  2270. rot = [ 0.0, 0.0, 3.14]
  2271. own.applyRotation(rot,local)
  2272. if own['manual_v2_type'] == 'reg manual':
  2273. own['requestAction'] = 'reg_manual_revert_ccw'
  2274. print("reg")
  2275. elif own['manual_v2_type'] == 'reg nose manual':
  2276. own['requestAction'] = 'fak_manual_revert_ccw'
  2277. #skater.playAction("fak_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2278. #deck.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2279. #trucks.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2280. print("reg nose manual revert")
  2281. elif own['manual_v2_type'] == 'fak manual':
  2282. own['requestAction'] = 'fak_manual_revert_ccw'
  2283. #skater.playAction("fak_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2284. #deck.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2285. #trucks.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2286. print("fak manual revert")
  2287. elif own['manual_v2_type'] == 'fak nose manual':
  2288. own['requestAction'] = 'reg_manual_revert_ccw'
  2289. #skater.playAction("reg_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2290. #deck.playAction("a_reg_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2291. #trucks.playAction("a_reg_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2292. print("fak")
  2293. else:
  2294. own['requestAction'] = 'revert1'
  2295. own['revert_timer'] = 20
  2296. cont.activate(own.actuators["revertSound"])
  2297. def revert2():
  2298. own["Q3oncdl"] = 0
  2299. own["Q4oncdl"] = 0
  2300. own["Q5oncdl"] = 0
  2301. own["Q6oncdl"] = 0
  2302. own["Q7oncdl"] = 0
  2303. local = True
  2304. rot = [ 0.0, 0.0, -3.14]
  2305. own.applyRotation(rot,local)
  2306. if own['manual_v2_type'] == 'reg manual':
  2307. own['requestAction'] = 'reg_manual_revert_cw'
  2308. #skater.playAction("reg_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2309. #deck.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2310. #trucks.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2311. print("reg")
  2312. elif own['manual_v2_type'] == 'reg nose manual':
  2313. own['requestAction'] = 'fak_manual_revert_cw'
  2314. #skater.playAction("fak_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2315. #deck.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2316. #trucks.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2317. print("reg nose manual revert")
  2318. elif own['manual_v2_type'] == 'fak manual':
  2319. own['requestAction'] = 'fak_manual_revert_cw'
  2320. #skater.playAction("fak_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2321. #deck.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2322. #trucks.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2323. print("fak manual revert")
  2324. elif own['manual_v2_type'] == 'fak nose manual':
  2325. own['requestAction'] = 'reg_manual_revert_cw'
  2326. #skater.playAction("reg_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2327. #deck.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2328. #trucks.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2329. print("fak")
  2330. else:
  2331. own['requestAction'] = 'revert2'
  2332. own['revert_timer'] = 20
  2333. cont.activate(own.actuators["revertSound"])
  2334. def revert3():
  2335. own["Q7oncdl"] = 0
  2336. own["Q8oncdl"] = 0
  2337. own["Q1oncdl"] = 0
  2338. own["Q2oncdl"] = 0
  2339. own["Q3oncdl"] = 0
  2340. local = True
  2341. rot = [ 0.0, 0.0, 3.14]
  2342. own.applyRotation(rot,local)
  2343. print("real revert 3")
  2344. if own['manual_v2_type'] == 'reg manual':
  2345. own['requestAction'] = 'reg_manual_revert_ccw'
  2346. #skater.playAction("reg_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2347. #deck.playAction("a_reg_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2348. #trucks.playAction("a_reg_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2349. print("reg")
  2350. elif own['manual_v2_type'] == 'reg nose manual':
  2351. own['requestAction'] = 'fak_manual_revert_ccw'
  2352. #skater.playAction("fak_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2353. #deck.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2354. #trucks.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2355. print("reg nose manual revert")
  2356. elif own['manual_v2_type'] == 'fak manual':
  2357. own['requestAction'] = 'fak_manual_revert_ccw'
  2358. #skater.playAction("fak_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2359. #deck.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2360. #trucks.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2361. print("fak manual revert")
  2362. elif own['manual_v2_type'] == 'fak nose manual':
  2363. own['requestAction'] = 'reg_manual_revert_ccw'
  2364. #skater.playAction("reg_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2365. #deck.playAction("a_reg_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2366. #trucks.playAction("a_reg_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2367. print("fak")
  2368. else:
  2369. own['requestAction'] = 'revert3'
  2370. own['revert_timer'] = 20
  2371. cont.activate(own.actuators["revertSound"])
  2372. def revert4():
  2373. own["Q7oncdl"] = 0
  2374. own["Q8oncdl"] = 0
  2375. own["Q1oncdl"] = 0
  2376. own["Q2oncdl"] = 0
  2377. own["Q3oncdl"] = 0
  2378. local = True
  2379. rot = [ 0.0, 0.0, 3.14]
  2380. own.applyRotation(rot,local)
  2381. if own['manual_v2_type'] == 'reg manual':
  2382. own['requestAction'] = 'reg_manual_revert_cw'
  2383. #skater.playAction("reg_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2384. #deck.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2385. #trucks.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2386. print("reg")
  2387. #elif own['reg_nmanual'] == 1:
  2388. elif own['manual_v2_type'] == 'reg nose manual':
  2389. own['requestAction'] = 'fak_manual_revert_cw'
  2390. #skater.playAction("fak_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2391. #deck.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2392. #trucks.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2393. print("reg nose manual revert")
  2394. #elif own['fak_manual'] == 1 or own['fak_nmanual'] == 1:
  2395. elif own['manual_v2_type'] == 'fak manual':
  2396. own['requestAction'] = 'fak_manual_revert_cw'
  2397. #skater.playAction("fak_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2398. #deck.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2399. #trucks.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2400. print("fak manual revert")
  2401. elif own['manual_v2_type'] == 'fak nose manual':
  2402. own['requestAction'] = 'reg_manual_revert_cw'
  2403. #skater.playAction("reg_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2404. #deck.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2405. #trucks.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2406. print("fak")
  2407. else:
  2408. own['requestAction'] = 'revert4'
  2409. print("normal revert")
  2410. own['revert_timer'] = 20
  2411. cont.activate(own.actuators["revertSound"])
  2412. def powerslide():
  2413. own['powerslide_counter'] = own['powerslide_counter'] + 1
  2414. since_walk = own['framenum'] - own['last_walk_frame']
  2415. since_grind = own['framenum'] - own['last_grind_frame']
  2416. if own['powerslide_counter'] > 15 and since_walk > 100 and since_grind > 40:
  2417. own['powerslide_on'] = 1
  2418. if STANCE == 0:
  2419. own['powerslide'] = "reg2"
  2420. if STANCE == 1:
  2421. own['powerslide'] = "fak1"
  2422. linVelocity4 = own.getLinearVelocity(True)
  2423. if own['powerslide_counter'] > 15 and own['powerslide_counter'] < 18:
  2424. newx = linVelocity4.x * .9
  2425. else:
  2426. newx = linVelocity4.x * .98
  2427. force = [newx, linVelocity4.y, linVelocity4.z]
  2428. own.setLinearVelocity(force, True)
  2429. def powerslide2():
  2430. own['powerslide_counter'] = own['powerslide_counter'] + 1
  2431. since_walk = own['framenum'] - own['last_walk_frame']
  2432. since_grind = own['framenum'] - own['last_grind_frame']
  2433. if own['powerslide_counter'] > 15 and since_walk > 100 and since_grind > 100:
  2434. own['powerslide_on'] = 1
  2435. if STANCE == 0:
  2436. own['powerslide'] = "reg1"
  2437. if STANCE == 1:
  2438. own['powerslide'] = "fak2"
  2439. linVelocity4 = own.getLinearVelocity(True)
  2440. if own['powerslide_counter'] > 15 and own['powerslide_counter'] < 18:
  2441. newx = linVelocity4.x * .9
  2442. else:
  2443. newx = linVelocity4.x * .98
  2444. force = [newx, linVelocity4.y, linVelocity4.z]
  2445. own.setLinearVelocity(force, True)
  2446. def powerslide_state():
  2447. ####powerslide on#####
  2448. if own['powerslide_on'] == 1:
  2449. if own['powerslide'] == "reg2":
  2450. own['requestAction'] = 'reg_fs_powerslide'
  2451. if own['powerslide'] == "fak1":
  2452. own['requestAction'] = 'fak_fs_powerslide'
  2453. if own['powerslide'] == "reg1":
  2454. own['requestAction'] = 'reg_powerslide'
  2455. if own['powerslide'] == "fak2":
  2456. own['requestAction'] = 'fak_powerslide'
  2457. def powerslide_sound():
  2458. sact = own.actuators["powerslide_sound"]
  2459. if own['powerslide_on'] == 1:
  2460. sact = own.actuators["powerslide_sound"]
  2461. sact.volume = .2
  2462. new_pitch = (abs(linVelocity.x) / 3)
  2463. if new_pitch < 1.1 and new_pitch > .5:
  2464. sact.pitch = new_pitch
  2465. elif new_pitch <= .5:
  2466. sact.pitch = .5
  2467. else:
  2468. sact.pitch = 1.1
  2469. cont.activate(own.actuators["powerslide_sound"])
  2470. else:
  2471. sact.volume = .0
  2472. cont.deactivate(own.actuators["powerslide_sound"])
  2473. def check_powerslide():
  2474. try:
  2475. own['last_powerslide_on'] = own['powerslide_on']
  2476. except:
  2477. pass
  2478. psxvel = abs(linVelocity.x)
  2479. if (lUD > .08 or lUD < -.08) and own['manual_v2'] == False and r_ground.triggered == True and psxvel > .1:
  2480. if lUD > .08:
  2481. powerslide()
  2482. else:
  2483. powerslide2()
  2484. else:
  2485. own['powerslide_on'] = 0
  2486. own['powerslide_counter'] = 0
  2487. if own['last_powerslide_on'] == 0:
  2488. own['powerslide'] = None
  2489. def killmanuals():
  2490. if own['last_manual_v2'] == 1 and own['manual_v2'] == 0:
  2491. fak_manual_off()
  2492. reg_manual_off()
  2493. fak_nmanual_off()
  2494. reg_nmanual_off()
  2495. def killopos():
  2496. pass
  2497. stopAnims()
  2498. #nextframe()
  2499. air()
  2500. stance()
  2501. turn()
  2502. #grind()
  2503. rotmult()
  2504. airup()
  2505. onramp()
  2506. speedmult()
  2507. coping()
  2508. onboard()
  2509. resetjumpstance()
  2510. grass()
  2511. grindoutair()
  2512. set_last_grindpos()
  2513. air_pos()
  2514. air_turn_boost()
  2515. record_grindsound()
  2516. check_powerslide()
  2517. powerslide_state()
  2518. powerslide_sound()
  2519. killmanuals()
  2520. killopos()
  2521. grind()
  2522. ##################
  2523. ###realcontrols###
  2524. ##################
  2525. # q1
  2526. # q8 q2
  2527. # q7 q3
  2528. # q6 q4
  2529. # q5
  2530. ##################
  2531. #lq6
  2532. if lUD > .04 and lLR < -0.04 :
  2533. lq6on = 1
  2534. q6oncdl = countdown
  2535. own["Q6oncdl"] = q6oncdl
  2536. #print("lq6on")
  2537. elif q6oncdl > 0:
  2538. lq6on = 0
  2539. q6oncdl = q6oncdl - 1
  2540. own["Q6oncdl"] = q6oncdl
  2541. #lq8
  2542. if lUD < -.04 and lLR < -0.04 :
  2543. lq8on = 1
  2544. q8oncdl = countdown
  2545. own["Q8oncdl"] = q8oncdl
  2546. #print("lq8on")
  2547. elif q8oncdl > 0:
  2548. lq8on = 0
  2549. q8oncdl = q8oncdl - 1
  2550. own["Q8oncdl"] = q8oncdl
  2551. #lq2
  2552. if lUD < -.04 and lLR > 0.04 :
  2553. lq2on = 1
  2554. q2oncdl = countdown
  2555. own["Q2oncdl"] = q2oncdl
  2556. #print("lq2on")
  2557. elif q2oncdl > 0:
  2558. lq2on = 0
  2559. q2oncdl = q2oncdl - 1
  2560. own["Q2oncdl"] = q2oncdl
  2561. #q4
  2562. if lUD > 0.04 and lLR > 0.04 :
  2563. lq4on = 1
  2564. q4oncdl = countdown
  2565. own["Q4oncdl"] = q4oncdl
  2566. #print("lq4on")
  2567. elif q4oncdl > 0:
  2568. lq4on = 0
  2569. q4oncdl = q4oncdl - 1
  2570. own["Q4oncdl"] = q4oncdl
  2571. #q5
  2572. if lUD > .070 and lq4on == 0 and lq6on == 0:
  2573. lq5on = 1
  2574. q5oncdl = countdown
  2575. own["Q5oncdl"] = q5oncdl
  2576. #print("lq5on")
  2577. elif q5oncdl > 0:
  2578. lq5on = 0
  2579. q5oncdl = q5oncdl - 1
  2580. own["Q5oncdl"] = q5oncdl
  2581. #q1
  2582. if lUD < -0.070 and lq8on !=1 and lq2on != 1:
  2583. lq1on = 1
  2584. q1oncdl = countdown
  2585. own["Q1oncdl"] = q1oncdl
  2586. #print("lq1on")
  2587. elif q1oncdl > 0:
  2588. lq1on = 0
  2589. q1oncdl = q1oncdl - 1
  2590. own["Q1oncdl"] = q1oncdl
  2591. #q7
  2592. if lLR < -0.070 and lq8on != 1 and lq6on != 1:
  2593. lq7on = 1
  2594. q7oncdl = countdown
  2595. own["Q7oncdl"] = q7oncdl
  2596. #print("lq7on")
  2597. elif q7oncdl > 0:
  2598. lq7on = 0
  2599. q7oncdl = q7oncdl - 1
  2600. own["Q7oncdl"] = q7oncdl
  2601. #q3
  2602. if lLR > 0.070 and lq2on !=1 and lq4on != 1:
  2603. lq3on = 1
  2604. q3oncdl = countdown
  2605. own["Q3oncdl"] = q3oncdl
  2606. #print("lq3on")
  2607. elif q3oncdl > 0:
  2608. lq3on = 0
  2609. q3oncdl = q3oncdl - 1
  2610. own["Q3oncdl"] = q3oncdl
  2611. #34567
  2612. own['set_revert_timer'] = 0
  2613. if q3oncdl < q4oncdl < q5oncdl < q6oncdl < q7oncdl:
  2614. if r_ground.triggered == True:
  2615. print("REVERT!!!")
  2616. revert()
  2617. own['set_revert_timer'] = 1
  2618. if q3oncdl > q4oncdl > q5oncdl > q6oncdl > q7oncdl:
  2619. if r_ground.triggered == True:
  2620. print("REVERT2!!!")
  2621. revert2()
  2622. own['set_revert_timer'] = 1
  2623. if q7oncdl < q8oncdl < q1oncdl < q2oncdl < q3oncdl:
  2624. if r_ground.triggered == True:
  2625. print("REVERT3!!!")
  2626. revert3()
  2627. own['set_revert_timer'] = 1
  2628. if q7oncdl > q8oncdl > q1oncdl > q2oncdl > q3oncdl:
  2629. if r_ground.triggered == True:
  2630. print("REVERT4!!!")
  2631. revert4()
  2632. own['set_revert_timer'] = 1
  2633. ################
  2634. #q6
  2635. if rUD > .04 and rLR < -0.04 :
  2636. q6on = 1
  2637. q6oncd = countdown
  2638. own["Q6oncd"] = q6oncd
  2639. #print("q6on")
  2640. elif q6oncd > 0:
  2641. q6on = 0
  2642. q6oncd = q6oncd - 1
  2643. own["Q6oncd"] = q6oncd
  2644. #q8
  2645. if rUD < -.04 and rLR < -0.04 :
  2646. q8on = 1
  2647. q8oncd = countdown
  2648. own["Q8oncd"] = q8oncd
  2649. #print("q8on")
  2650. elif q8oncd > 0:
  2651. q8on = 0
  2652. q8oncd = q8oncd - 1
  2653. own["Q8oncd"] = q8oncd
  2654. #q2
  2655. if rUD < -.04 and rLR > 0.04 :
  2656. q2on = 1
  2657. q2oncd = countdown
  2658. own["Q2oncd"] = q2oncd
  2659. #print("q2on")
  2660. elif q2oncd > 0:
  2661. q2on = 0
  2662. q2oncd = q2oncd - 1
  2663. own["Q2oncd"] = q2oncd
  2664. #q4
  2665. if rUD > 0.04 and rLR > 0.04 :
  2666. q4on = 1
  2667. q4oncd = countdown
  2668. own["Q4oncd"] = q4oncd
  2669. #print("q4on")
  2670. elif q4oncd > 0:
  2671. q4on = 0
  2672. q4oncd = q4oncd - 1
  2673. own["Q4oncd"] = q4oncd
  2674. #q5
  2675. if rUD > .070:
  2676. if q4on == 0 and q6on == 0:
  2677. #print("q5on")
  2678. q5on = 1
  2679. q5oncd = countdown
  2680. own["Q5oncd"] = q5oncd
  2681. oposin()
  2682. ground_since = own["framenum"] - own['lF_air_frame']
  2683. 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) and ground_since > 10:
  2684. pump()
  2685. else:
  2686. own["lastPump"] = False
  2687. own["Pump"] = False
  2688. own['jump_stance'] = STANCE
  2689. if rUD > .02:
  2690. grindpos = own['grindpos']
  2691. jumpstance = own["jump_stance"]
  2692. if LAST_GRIND == False:
  2693. if grindpos == "reg_stall":
  2694. grindtype("nose_stall") #change
  2695. elif grindpos == "fak_stall":
  2696. grindtype("nose_stall")
  2697. elif grindpos == "reg_5050":
  2698. if jumpstance != 3:
  2699. if jumpstance == 0:
  2700. if rLR > .02:
  2701. grindtype("reg_tailgR")
  2702. elif rLR < -.02:
  2703. grindtype("reg_tailgL")
  2704. else:
  2705. grindtype("reg_tailg")
  2706. if jumpstance == 1:
  2707. if rLR > .02:
  2708. grindtype("fak_tailgR")
  2709. elif rLR < -.02:
  2710. grindtype("fak_tailgL")
  2711. else:
  2712. grindtype("fak_tailg")
  2713. else:
  2714. if STANCE == 0:
  2715. if rLR > .03:
  2716. grindtype("reg_tailgR")
  2717. elif rLR < -.02:
  2718. grindtype("reg_tailgL")
  2719. else:
  2720. grindtype("reg_tailg")
  2721. if STANCE == 1:
  2722. grindtype("fak_tailg")
  2723. elif grindpos == "reg_board":
  2724. if jumpstance != 3:
  2725. if jumpstance == 0:
  2726. grindtype("reg_tailslide")
  2727. if jumpstance == 1:
  2728. grindtype("fak_tailslide")
  2729. STANCE = jumpstance
  2730. own['stance'] = STANCE
  2731. else:
  2732. if STANCE == 0:
  2733. grindtype("reg_tailslide")
  2734. if STANCE == 1:
  2735. grindtype("fak_tailslide")
  2736. else:
  2737. if jumpstance == 0:
  2738. grindtype("reg_tailg")
  2739. if jumpstance == 1:
  2740. grindtype("fak_tailg")
  2741. if q5oncd > 0:
  2742. q5on = 0
  2743. q5oncd = q5oncd - 1
  2744. own["Q5oncd"] = q5oncd
  2745. own["last_Opos"] = False
  2746. #q1
  2747. if rUD < -0.070:
  2748. if q2on == 0 and q8on == 0:
  2749. #print("q1on")
  2750. q1on = 1
  2751. q1oncd = countdown
  2752. own["Q1oncd"] = q1oncd
  2753. noposin()
  2754. if rUD < -0.020:
  2755. grindpos = own['grindpos']
  2756. jumpstance = own["jump_stance"]
  2757. if LAST_GRIND == False:
  2758. if grindpos == "reg_5050":
  2759. #print("nose something")
  2760. if jumpstance != 3:
  2761. if jumpstance == 0:
  2762. if rLR > .02:
  2763. grindtype("reg_nosegR")
  2764. elif rLR < -.02:
  2765. grindtype("reg_nosegL")
  2766. else:
  2767. grindtype("reg_noseg")
  2768. if jumpstance == 1:
  2769. if rLR > .02:
  2770. grindtype("fak_nosegR")
  2771. elif rLR < -.02:
  2772. grindtype("fak_nosegL")
  2773. else:
  2774. grindtype("fak_noseg")
  2775. else:
  2776. if STANCE == 0:
  2777. if rLR > .02:
  2778. grindtype("reg_nosegR")
  2779. elif rLR < -.02:
  2780. grindtype("reg_nosegL")
  2781. else:
  2782. grindtype("reg_noseg")
  2783. if STANCE == 1:
  2784. if rLR > .02:
  2785. grindtype("fak_nosegR")
  2786. elif rLR < -.02:
  2787. grindtype("fak_nosegL")
  2788. else:
  2789. grindtype("fak_noseg")
  2790. elif grindpos == "reg_board":
  2791. if jumpstance != 3:
  2792. if jumpstance == 0:
  2793. grindtype("reg_noseslide")
  2794. if jumpstance == 1:
  2795. grindtype("fak_noseslide")
  2796. STANCE = jumpstance
  2797. own['stance'] = STANCE
  2798. else:
  2799. if STANCE == 0:
  2800. grindtype("reg_noseslide")
  2801. if STANCE == 1:
  2802. grindtype("fak_noseslide")
  2803. if rUD > -0.020 and rUD <= .020 and LAST_GRIND == False:
  2804. if own['grindpos'] == 'reg_5050':
  2805. grindtype("reg_5050")
  2806. if own['grindpos'] == 'fak_5050':
  2807. grindtype("fak_5050")
  2808. if q1oncd > 0:
  2809. q1on = 0
  2810. q1oncd = q1oncd - 1
  2811. own["Q1oncd"] = q1oncd
  2812. own["last_nOpos"] = False
  2813. #print(q1oncd)
  2814. #q7
  2815. if rLR < -0.070:
  2816. if q8on == 0 and q6on == 0:
  2817. q7on = 1
  2818. q7oncd = countdown
  2819. own["Q7oncd"] = q7oncd
  2820. #print("q7on")
  2821. elif q7oncd > 0:
  2822. q7on = 0
  2823. q7oncd = q7oncd - 1
  2824. own["Q7oncd"] = q7oncd
  2825. #q3
  2826. if rLR > 0.070:
  2827. if q4on == 0 and q2on == 0:
  2828. q3on = 1
  2829. q3oncd = countdown
  2830. own["Q3oncd"] = q3oncd
  2831. #print("q3on")
  2832. elif q3oncd > 0:
  2833. q3on = 0
  2834. q3oncd = q3oncd - 1
  2835. own["Q3oncd"] = q3oncd
  2836. #trick calls
  2837. # 360 flip
  2838. # 3 > 4 > 5 > 8
  2839. # laser flip
  2840. # 7 > 6 > 5 > 2
  2841. #nollie 360 shovit
  2842. if q7oncd > 0 and q8oncd > 0 and q1oncd > 0 and q2oncd > 0 and q3oncd > 0 and q7oncd <= q8oncd <= q1oncd <= q2oncd <= q3oncd:
  2843. print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  2844. print ("Nollie 360 shovit")
  2845. dict['trick_string'] = 'Nollie 360 Shovit'
  2846. nollie_shovit360()
  2847. q7oncd = 0
  2848. q8oncd = 0
  2849. q1oncd = 0
  2850. q2oncd = 0
  2851. q3oncd = 0
  2852. own["Q7oncd"] = q7oncd
  2853. own["Q8oncd"] = q8oncd
  2854. own["Q1oncd"] = q1oncd
  2855. own["Q2oncd"] = q2oncd
  2856. own["Q3oncd"] = q3oncd
  2857. #nollie fs 360 shovit
  2858. if q7oncd > 0 and q8oncd > 0 and q1oncd > 0 and q2oncd > 0 and q3oncd > 0 and q3oncd <= q2oncd <= q1oncd <= q8oncd <= q7oncd:
  2859. #print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  2860. print ("Nollie Front Side 360 shovit")
  2861. dict['trick_string'] = 'Nollie FS 360 Shovit'
  2862. nollie_fsshovit360()
  2863. q7oncd = 0
  2864. q8oncd = 0
  2865. q1oncd = 0
  2866. q2oncd = 0
  2867. q3oncd = 0
  2868. own["Q7oncd"] = q7oncd
  2869. own["Q8oncd"] = q8oncd
  2870. own["Q1oncd"] = q1oncd
  2871. own["Q2oncd"] = q2oncd
  2872. own["Q3oncd"] = q3oncd
  2873. # varial heelflip
  2874. # 7 < 6 < 2
  2875. if q7oncd > 0 and q6oncd > 0 and q2oncd > 0 and q7oncd < q6oncd < q2oncd:
  2876. dict['trick_string'] = 'Varial Heelflip'
  2877. varial_heelflip()
  2878. reset_rtimers()
  2879. # varial kickflip
  2880. # 3 < 4 < 8
  2881. if q3oncd > 0 and q4oncd > 0 and q8oncd > 0 and q3oncd < q4oncd < q8oncd:
  2882. dict['trick_string'] = 'Varial Kickflip'
  2883. varial_kickflip()
  2884. reset_rtimers()
  2885. # nollie varial kickflip
  2886. # 3 < 2 < 6
  2887. if q3oncd > 0 and q2oncd > 0 and q6oncd > 0 and q3oncd <= q2oncd <= q6oncd:
  2888. dict['trick_string'] = 'Nollie Varial Kickflip'
  2889. print('Nollie Varial Kickflip')
  2890. nollie_varial_kickflip()
  2891. reset_rtimers()
  2892. # nollie varial heelflip
  2893. # 7 < 8 < 4
  2894. if q7oncd > 0 and q8oncd > 0 and q4oncd > 0 and q7oncd <= q8oncd <= q4oncd:
  2895. dict['trick_string'] = 'Nollie Varial Heelflip'
  2896. print('Nollie Varial Heelflip')
  2897. nollie_varial_heelflip()
  2898. reset_rtimers()
  2899. #360 shovit
  2900. if q3oncd > 0 and q4oncd > 0 and q5oncd > 0 and q6oncd > 0 and q7oncd > 0 and q7oncd >= q6oncd >= q5oncd >= q4oncd >= q3oncd:
  2901. # print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  2902. #print ("______-------360 shovit")
  2903. dict['trick_string'] = '360 Shovit'
  2904. shovit360()
  2905. q3oncd = 0
  2906. q4oncd = 0
  2907. q5oncd = 0
  2908. q6oncd = 0
  2909. q7oncd = 0
  2910. own["Q3oncd"] = q3oncd
  2911. own["Q4oncd"] = q4oncd
  2912. own["Q5oncd"] = q5oncd
  2913. own["Q6oncd"] = q6oncd
  2914. own["Q7oncd"] = q7oncd
  2915. #360 fs shovit
  2916. if q3oncd > 0 and q4oncd > 0 and q5oncd > 0 and q6oncd >= 0 and q7oncd > 0 and q7oncd <= q6oncd <= q5oncd <= q4oncd <= q3oncd:
  2917. # print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  2918. #print ("______-------360 shovit")
  2919. dict['trick_string'] = '360 Frontside Shovit'
  2920. fsshovit360()
  2921. q3oncd = 0
  2922. q4oncd = 0
  2923. q5oncd = 0
  2924. q6oncd = 0
  2925. q7oncd = 0
  2926. own["Q3oncd"] = q3oncd
  2927. own["Q4oncd"] = q4oncd
  2928. own["Q5oncd"] = q5oncd
  2929. own["Q6oncd"] = q6oncd
  2930. own["Q7oncd"] = q7oncd
  2931. #ollie
  2932. if q5oncd > 0 and q1oncd > 0 and q5oncd < q1oncd:
  2933. JUMPSTRENGTH = q1oncd - q5oncd
  2934. #4,7
  2935. if JUMPSTRENGTH <= 4:
  2936. JUMPSTRENGTH = 1.1
  2937. if JUMPSTRENGTH > 4 and JUMPSTRENGTH < 7:
  2938. JUMPSTRENGTH = 1
  2939. if JUMPSTRENGTH >= 7:
  2940. JUMPSTRENGTH = .9
  2941. aollie()
  2942. q1oncd = 0
  2943. q5oncd = 0
  2944. own["Q1oncd"] = q1oncd
  2945. own["Q5oncd"] = q5oncd
  2946. #nollie
  2947. if q5oncd > 0 and q1oncd > 0 and q5oncd > q1oncd:
  2948. JUMPSTRENGTH = q5oncd - q1oncd
  2949. #4,7
  2950. if JUMPSTRENGTH <= 4:
  2951. JUMPSTRENGTH = 1.1
  2952. if JUMPSTRENGTH > 4 and JUMPSTRENGTH < 7:
  2953. JUMPSTRENGTH = 1
  2954. if JUMPSTRENGTH >= 7:
  2955. JUMPSTRENGTH = .9
  2956. nollie()
  2957. q1oncd = 0
  2958. q5oncd = 0
  2959. own["Q1oncd"] = q1oncd
  2960. own["Q5oncd"] = q5oncd
  2961. print("nollie")
  2962. #kickflip
  2963. if q5oncd > 0 and q8oncd > 0 and q5oncd < q8oncd and q3oncd < 1:
  2964. kickflip()
  2965. q8oncd = 0
  2966. q5oncd = 0
  2967. own["Q8oncd"] = q8oncd
  2968. own["Q5oncd"] = q5oncd
  2969. #nollie kickflip
  2970. if q1oncd > 0 and q6oncd > 0 and q1oncd < q6oncd:
  2971. nollie_kickflip()
  2972. q6oncd = 0
  2973. q1oncd = 0
  2974. own["Q6oncd"] = q6oncd
  2975. own["Q1oncd"] = q1oncd
  2976. #heelflip
  2977. if q5oncd > 0 and q2oncd > 0 and q5oncd < q2oncd:
  2978. heelflip()
  2979. q2oncd = 0
  2980. q5oncd = 0
  2981. own["Q2oncd"] = q2oncd
  2982. own["Q5oncd"] = q5oncd
  2983. #nollie_heelflip
  2984. if q1oncd > 0 and q4oncd > 0 and q1oncd < q4oncd:
  2985. nollie_heelflip()
  2986. q1oncd = 0
  2987. q4oncd = 0
  2988. own["Q1oncd"] = q1oncd
  2989. own["Q4oncd"] = q4oncd
  2990. #shovit
  2991. if q4oncd > 0 and q5oncd > 0 and q6oncd > 0 and q4oncd <= q5oncd <= q6oncd and q3oncd < 1:
  2992. shovit()
  2993. q4oncd = 0
  2994. q5oncd = 0
  2995. q6oncd = 0
  2996. own["Q4oncd"] = q4oncd
  2997. own["Q5oncd"] = q5oncd
  2998. own["Q6oncd"] = q6oncd
  2999. #nollie_shovit
  3000. if q2oncd > 0 and q1oncd > 0 and q8oncd > 0 and q2oncd <= q1oncd <= q8oncd and q3oncd == 0:
  3001. nollie_shovit()
  3002. print('nollie shuvit')
  3003. #nollie_fsshovit()
  3004. q2oncd = 0
  3005. q1oncd = 0
  3006. q8oncd = 0
  3007. own["Q2oncd"] = q2oncd
  3008. own["Q1oncd"] = q1oncd
  3009. own["Q8oncd"] = q8oncd
  3010. #fsshovit
  3011. if q4oncd > 0 and q5oncd > 0 and q6oncd > 0 and q6oncd <= q5oncd <= q4oncd and q7oncd < 1:
  3012. # print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  3013. # print ("^%*^%*^%*^%fsshovit")
  3014. fsshovit()
  3015. q4oncd = 0
  3016. q5oncd = 0
  3017. q6oncd = 0
  3018. own["Q4oncd"] = q4oncd
  3019. own["Q5oncd"] = q5oncd
  3020. own["Q6oncd"] = q6oncd
  3021. #nollie_fsshovit
  3022. if q8oncd > 0 and q1oncd > 0 and q2oncd > 0 and q8oncd <= q1oncd <= q2oncd and q7oncd == 0:
  3023. # print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  3024. print ("nollie fsshovit")
  3025. nollie_fsshovit()
  3026. #nollie_shovit()
  3027. q8oncd = 0
  3028. q1oncd = 0
  3029. q2oncd = 0
  3030. own["Q8oncd"] = q4oncd
  3031. own["Q1oncd"] = q5oncd
  3032. own["Q2oncd"] = q6oncd
  3033. #360 shovit
  3034. # 360 shovit
  3035. # 3 > 4 > 5 >6 > 7
  3036. # fs 360 shovit
  3037. # 7 > 6 > 5 > 4 > 3
  3038. def hippy_jump():
  3039. STANCE = own["stance"]
  3040. if own['hippy'] == 1 and own['last_hippy'] == 0:
  3041. if STANCE == 0:
  3042. #own['requestAction'] = 'reg_hippy'
  3043. own['requestAction'] = 'reg_hippy_in'
  3044. #skater.playAction("reg_hippy", 1,10, layer=1101, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3045. if STANCE == 1:
  3046. own['requestAction'] = 'fak_hippy_in'
  3047. #skater.playAction("fak_hippy", 1,10, layer=1101, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3048. if own['hippy'] == 1 and own['last_hippy'] == 1:
  3049. if STANCE == 0:
  3050. own['requestAction'] = 'reg_hippy_in'
  3051. #skater.playAction("reg_hippy", 10,10, layer=1100, priority=0, layer_weight=0, play_mode=1, speed=.5)
  3052. if STANCE == 1:
  3053. own['requestAction'] = 'fak_hippy_in'
  3054. #skater.playAction("fak_hippy", 10,10, layer=1100, priority=0, layer_weight=0, play_mode=1, speed=.5)
  3055. if own['hippy'] == 0 and own['last_hippy'] == 1:
  3056. killact(1100)
  3057. if rLR > turnsens:
  3058. local = True
  3059. rot = [ 0.0, 0.0, 3.14]
  3060. own.applyRotation(rot,local)
  3061. print("hippy turn")
  3062. if STANCE == 0:
  3063. own['requestAction'] = 'reg_hippy_ncw'
  3064. #skater.playAction("reg_hippy_ncw", 10,40, layer=1102, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3065. print('%hip1')
  3066. if STANCE == 1:
  3067. own['requestAction'] = 'fak_hippy_ncw'
  3068. #skater.playAction("fak_hippy_ncw", 10,40, layer=1102, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3069. print('%hip2')
  3070. elif rLR < -turnsens:
  3071. local = True
  3072. rot = [ 0.0, 0.0, -3.14]
  3073. own.applyRotation(rot,local)
  3074. print("hippy turn neg")
  3075. if STANCE == 0:
  3076. own['requestAction'] = 'fak_hippy_nccw'
  3077. #skater.playAction("fak_hippy_nccw", 10,40, layer=1102, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3078. print('%hip3')
  3079. if STANCE == 1:
  3080. own['requestAction'] = 'reg_hippy_nccw'
  3081. #skater.playAction("reg_hippy_nccw", 10,40, layer=1102, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3082. print('%hip4')
  3083. ##straight
  3084. else:
  3085. if STANCE == 0:
  3086. #skater.playAction("reg_hippy", 10,40, layer=1102, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3087. own['requestAction'] = 'reg_hippy'
  3088. if STANCE == 1:
  3089. own['requestAction'] = 'fak_hippy'
  3090. #skater.playAction("fak_hippy", 10,40, layer=1102, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3091. #pushing and hippy jumps
  3092. since_a = frame - lastaf
  3093. since_x = frame - lastxf
  3094. cush = 10
  3095. hippy = 0
  3096. own['hippy'] = 0
  3097. #print(since_a, "a", since_x, "x")
  3098. #if xBut == 1 and aBut == 1 and since_a <= cush and since_x <= cush and (lTrig < 0.02 and rTrig < 0.02):
  3099. if xBut == 1 and aBut == 1 and (lTrig < 0.02 and rTrig < 0.02) and r_ground.triggered == True:
  3100. #F"hippy")
  3101. hippy = 1
  3102. own['hippy'] = 1
  3103. #hippy_jump()
  3104. #print(hippy)
  3105. hippy_jump()
  3106. if since_a > cush and aBut == 1 and lasta == 1 and (lTrig < 0.02 and rTrig < 0.02) and own['last_hippy'] == 0:
  3107. #print("apush suckka", since_a)
  3108. if xBut == 0 and hippy == 0 and lastaBut_ground == True:
  3109. push()
  3110. if since_x > cush and xBut == 1 and lastx == 1 and (lTrig < 0.02 and rTrig < 0.02) and own['last_hippy'] == 0:
  3111. #print("push suckka", since_x)
  3112. if aBut == 0 and hippy == 0 and lastxBut_ground == True:
  3113. push_goof()
  3114. #cavemans
  3115. if LAST_GRIND == False and grindHit == False and r_ground.triggered:
  3116. if (aBut ==0 and own['lastaBut_ground'] == 1) and lTrig > 0.02:
  3117. brfoot()
  3118. if (aBut ==0 and own['lastaBut_ground'] == 1) and rTrig > 0.02:
  3119. frfoot()
  3120. if (xBut ==0 and own['lastxBut_ground'] == 1) and lTrig > 0.02:
  3121. blfoot()
  3122. if (xBut ==0 and own['lastxBut_ground'] == 1) and rTrig > 0.02:
  3123. flfoot()
  3124. #push b button
  3125. if bBut == 1:
  3126. #print("push suckka")
  3127. if linVelocity.x > .05 or linVelocity.x < -.05:
  3128. stop()
  3129. elif linVelocity.x < .05 or linVelocity.x > -.05:
  3130. if own["lastStop"] == True:
  3131. own["lastStop"] = False
  3132. elif bBut ==0:
  3133. own["lastStop"] = False
  3134. ##### falls
  3135. if own['fall'] == 1:
  3136. offboard()
  3137. own['getoffboard'] = True
  3138. ####
  3139. #y button
  3140. if own['lasty'] == 1 and yBut ==0:
  3141. offboard()
  3142. if own["GRAB_ON"] == True:
  3143. playing = skater.isPlayingAction(fliplay)
  3144. if playing == 1:
  3145. frame = skater.getActionFrame(fliplay)
  3146. #print("Flipping frame: ", frame)
  3147. if frame > 16:
  3148. skater.stopAction(fliplay)
  3149. #frontside grab
  3150. flipping = skater.isPlayingAction(fliplay)
  3151. if rTrig > 0.02 and r_ground.triggered == 0 and flipping == False:
  3152. GRAB_ON = True
  3153. own["GRAB_ON"] = GRAB_ON
  3154. #print(rTrig, GRAB_ON)
  3155. if STANCE == False and rUD >= -.07 and rUD <= .07:
  3156. frontside_grab_on()
  3157. elif STANCE == True and rUD >= -.07 and rUD <= .07:
  3158. fakbackside_grab_on()
  3159. #front_nose
  3160. if STANCE == True and rUD < -0.070:
  3161. fak_backside_nose_grab_on()
  3162. #front_tail
  3163. elif STANCE == True and rUD > 0.07:
  3164. fak_backside_tail_grab_on()
  3165. #
  3166. if STANCE == False and rUD < -0.070:
  3167. frontside_nose_grab_on()
  3168. #front_tail
  3169. elif STANCE == False and rUD > 0.07:
  3170. frontside_tail_grab_on()
  3171. #backside grab
  3172. #if lTrig > 0.02 and GRAB_ON == False and r_ground.triggered == 0:
  3173. if lTrig > 0.02 and r_ground.triggered == 0 and flipping == False:
  3174. GRAB_ON = True
  3175. own["GRAB_ON"] = GRAB_ON
  3176. #print(rTrig)
  3177. if STANCE == False and rUD >= -.07 and rUD <= .07:
  3178. backside_grab_on()
  3179. elif STANCE == True and rUD >= -.07 and rUD <= .07:
  3180. fakfrontside_grab_on()
  3181. #front_nose
  3182. if STANCE == True and rUD < -0.070:
  3183. fak_frontside_nose_grab_on()
  3184. #front_tail
  3185. elif STANCE == True and rUD > 0.07:
  3186. fak_frontside_tail_grab_on()
  3187. #front_nose
  3188. if STANCE == False and rUD < -0.070:
  3189. backside_nose_grab_on()
  3190. #front_tail
  3191. elif STANCE == False and rUD > 0.07:
  3192. backside_tail_grab_on()
  3193. #kill grabs
  3194. if lTrig <= 0.02 and GRAB_ON == True and lTrig >= -.02 and rTrig <= .02 and rTrig >= -.2:
  3195. GRAB_ON = False
  3196. own["GRAB_ON"] = GRAB_ON
  3197. GRAB_PLAYED = False
  3198. own["GRAB_PLAYED"] = GRAB_PLAYED
  3199. #frontside pump #backside pump
  3200. def footplant():
  3201. framenum = own['framenum']
  3202. last_ground_frame = own['lF_ground_frame']
  3203. lF_air_frame = own['lF_air_frame']
  3204. frames_since_ground = framenum - lF_air_frame
  3205. frames_since_grind = framenum - own['last_grind_frame']
  3206. if grindHit == True and aBut == True:
  3207. print("first invert check")
  3208. own.linearVelocity.x = 0
  3209. own.linearVelocity.y = 0
  3210. #own.setLinearVelocity([0,0,0],0)
  3211. own['footplant_on'] = 1
  3212. if grindHit == False:
  3213. own['footplant_on'] = 0
  3214. if own['footplant_on'] == True and rUD < turnsens and rUD > -turnsens:
  3215. #own.setLinearVelocity([0,0,0],0)
  3216. own.linearVelocity.x = 0
  3217. own.linearVelocity.y = 0
  3218. if own['footplant_on'] == 1 and own['last_footplant'] == True and own['jump_timer'] < 50:
  3219. if skater.isPlayingAction(2925) == False:
  3220. if STANCE == 0:
  3221. own['requestAction'] = 'reg_fp_rback'
  3222. #print("requesting footplant0")
  3223. if STANCE == 1:
  3224. own['requestAction'] = 'fak_fp_rback'
  3225. #print("requesting footplant1")
  3226. def invert():
  3227. if grindHit == True and own['grindpos'] == 'reg_board':
  3228. #if LAST_GRIND == False and grindHit == True and own['grindpos'] == 'reg_board':
  3229. if lBump == 1:
  3230. #print("invert")
  3231. #if coping_on ==1 and lBump == 1:
  3232. #print("invert")
  3233. own['invert_on'] = 1
  3234. #invert_on = 1
  3235. own.linearVelocity.x = 0
  3236. own.linearVelocity.y = 0
  3237. if own["coping"] == 1 and own['invert_on'] == 1:
  3238. if own['invert_on'] == 1 and own['last_invert'] == False:
  3239. #killall()
  3240. cont.activate(own.actuators['invertOn_sound'])
  3241. if STANCE == False:
  3242. own['invert_type'] = "reg_back_invert_in"
  3243. if STANCE == True:
  3244. own['invert_type'] = "fak_fr_invert"
  3245. if own['invert_on'] == 0 and own['last_invert'] == True:
  3246. #print("kill invert")
  3247. own['last_invert_frame'] = frame
  3248. cont.activate(own.actuators['invertOff_Sound'])
  3249. if own['invert_on'] == 1:
  3250. if own['invert_type'] == "reg_back_invert_in":
  3251. own['requestAction'] = 'reg_back_invert'
  3252. if own['invert_type'] == "fak_fr_invert":
  3253. own['requestAction'] = 'fak_fr_invert'
  3254. lif = own['last_invert_frame']
  3255. if frame - lif > 3 and own['invert_on'] == 0:
  3256. own['invert_type'] = None
  3257. if grindHit == False:
  3258. own['invert_on'] = False
  3259. invert()
  3260. footplant()
  3261. if own['invert_on'] == 0:
  3262. killact(900)
  3263. def reset_pos():
  3264. #reset
  3265. if ddPad == 1:
  3266. spawn_pos = own['spawn_pos']
  3267. spawn_rot = own['spawn_rot']
  3268. try:
  3269. own.worldPosition = (spawn_pos[0], spawn_pos[1], (spawn_pos[2] + .1))
  3270. 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]]
  3271. except:
  3272. own.worldPosition = (0, 0, .1)
  3273. own.worldOrientation = [[1.0, 0.0, 0.0], [ 0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]
  3274. if own["spawn_stance"] == 1:
  3275. own.setLinearVelocity([.1,0,0], 1)
  3276. #cam.worldPosition = (spawn_pos[0], spawn_pos[1], (spawn_pos[2] + .25))
  3277. #cam.applyMovement([0,-1,0], True)
  3278. #lx = cam.localPosition[1]
  3279. #lx = lx - 4
  3280. #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]]
  3281. #cam.localPosition[1] = lx
  3282. else:
  3283. own.setLinearVelocity([-.1,0,0], 1)
  3284. #cam.worldPosition = (spawn_pos[0], spawn_pos[1], (spawn_pos[2] + .25))
  3285. #cam.applyMovement([0,1,0], True)
  3286. #lx = cam.localPosition[1]
  3287. #lx = lx - 4
  3288. #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]]
  3289. #cam.localPosition[1] = lx
  3290. if udPad == 1:
  3291. own['spawn_pos'] = [own.worldPosition[0], own.worldPosition[1], own.worldPosition[2]]
  3292. 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]]
  3293. stance = own["stance"]
  3294. own["spawn_stance"] = stance
  3295. #start button
  3296. #print(own['last_stBut'])
  3297. #print(own['pause_on'])
  3298. if stBut == True:
  3299. own.actuators["sroll"].volume = .0001
  3300. cont.deactivate(own.actuators["sroll"])
  3301. own.actuators["sroll"].stopSound()
  3302. if stBut == False and own['last_stBut'] == True:
  3303. if own['pause_on'] == True:
  3304. own['pause_on'] = False
  3305. #own.restoreDynamics()
  3306. else:
  3307. own['pause_on'] = True
  3308. #own.suspendDynamics()
  3309. own['last_stBut'] = stBut
  3310. def ylimit():
  3311. lgf = own['last_grind_frame']
  3312. frame = own['framenum']
  3313. frames_since_grinding = frame - lgf
  3314. if r_ground.triggered and touched == False and grindHit == 0 and frames_since_grinding > 20:
  3315. linVelocity4 = own.getLinearVelocity(True)
  3316. newy = linVelocity4.y * .8 #.4
  3317. force = [linVelocity4.x, newy, linVelocity4.z]
  3318. own.setLinearVelocity(force, True)
  3319. def getoffboard():
  3320. lasty = own['lasty']
  3321. getoffboard = own['getoffboard']
  3322. if getoffboard == 1 and own['fall'] == False:
  3323. own['getoffboard'] = 0
  3324. if yBut == False and lasty == True:
  3325. own['getoffboard'] = 1
  3326. def switchcam():
  3327. pass
  3328. # if ltsBut == False and own['lastlts'] == True and rtsBut == False:
  3329. # if own['camera'] == 1:
  3330. # own['camera'] = 0
  3331. # else:
  3332. # own['camera'] = 1
  3333. # if rtsBut == False and own['lastrts'] == True and ltsBut == False:
  3334. # if own['camera'] == 2:
  3335. # own['camera'] = 0
  3336. # else:
  3337. # own['camera'] = 2
  3338. #followcam
  3339. def move_followcam():
  3340. if own['camera'] == 2:
  3341. #if rtsBut == False and own['lastrts'] == True:
  3342. if own['lastbkBut'] == True and bkBut == False:
  3343. #print("activate move followcam")
  3344. if own['move_followcam'] == False:
  3345. own['move_followcam'] = True
  3346. else:
  3347. own['move_followcam'] = False
  3348. if own['move_followcam'] == True:
  3349. #act = followcam.actuators[
  3350. camspeed1 = .015
  3351. camspeed2 = .055
  3352. camrot1 = .005
  3353. camrot2 = .02
  3354. #up
  3355. if lUD < -0.080:
  3356. followcam.actuators["up"].dLoc = [ 0, 0, -camspeed2]
  3357. cont.activate(followcam.actuators["up"])
  3358. #print("fastup")
  3359. else:
  3360. cont.deactivate(followcam.actuators["up"])
  3361. # #down
  3362. if lUD > .080:
  3363. followcam.actuators["down"].dLoc = [ 0, 0, camspeed2]
  3364. cont.activate(followcam.actuators["down"])
  3365. else:
  3366. cont.deactivate(followcam.actuators["down"])
  3367. # #left
  3368. if lLR < -0.080:
  3369. followcam.actuators["left"].dLoc = [-camspeed2, 0, 0]
  3370. cont.activate(followcam.actuators["left"])
  3371. else:
  3372. cont.deactivate(followcam.actuators["left"])
  3373. # #right
  3374. if lLR > 0.080:
  3375. followcam.actuators["right"].dLoc = [camspeed2, 0, 0]
  3376. cont.activate(followcam.actuators["right"])
  3377. else:
  3378. cont.deactivate(followcam.actuators["right"])
  3379. #up
  3380. if rUD < -0.080:
  3381. followcam.actuators["rotup"].dLoc = [0, 0, camrot2]
  3382. cont.activate(followcam.actuators["rotup"])
  3383. #print("uppppppppppppppppppppppppppp")
  3384. else:
  3385. cont.deactivate(followcam.actuators["rotup"])
  3386. # #down
  3387. if rUD > .080:
  3388. followcam.actuators["rotdown"].dLoc = [0, 0, -camrot2]
  3389. cont.activate(followcam.actuators["rotdown"])
  3390. else:
  3391. cont.deactivate(followcam.actuators["rotdown"])
  3392. # #left
  3393. if rLR < -0.080:
  3394. followcam.actuators["rotleft"].dRot = [0, 0, camrot2]
  3395. cont.activate(followcam.actuators["rotleft"])
  3396. else:
  3397. cont.deactivate(followcam.actuators["rotleft"])
  3398. # #right
  3399. if rLR > 0.080:
  3400. followcam.actuators["rotright"].dRot = [0, 0, -camrot2]
  3401. cont.activate(followcam.actuators["rotright"])
  3402. else:
  3403. cont.deactivate(followcam.actuators["rotright"])
  3404. #*********************************************
  3405. if lUD > -0.080 and lUD < -0.030:
  3406. followcam.actuators["up"].dLoc = [ 0, 0, -camspeed1]
  3407. cont.activate(followcam.actuators["up"])
  3408. #print(lUD)
  3409. else:
  3410. cont.deactivate(followcam.actuators["up"])
  3411. # #down
  3412. if lUD < .080 and lUD > .03:
  3413. followcam.actuators["down"].dLoc = [ 0, 0, camspeed1]
  3414. cont.activate(followcam.actuators["down"])
  3415. else:
  3416. cont.deactivate(followcam.actuators["down"])
  3417. # #left
  3418. if lLR > -0.080 and lLR < -0.030:
  3419. followcam.actuators["left"].dLoc = [-camspeed1, 0, 0]
  3420. cont.activate(followcam.actuators["left"])
  3421. else:
  3422. cont.deactivate(followcam.actuators["left"])
  3423. # #right
  3424. if lLR < .080 and lLR > .03:
  3425. followcam.actuators["right"].dLoc = [camspeed1, 0, 0]
  3426. cont.activate(followcam.actuators["right"])
  3427. else:
  3428. cont.deactivate(followcam.actuators["right"])
  3429. #up
  3430. if rUD > -0.080 and rUD < -0.030:
  3431. followcam.actuators["rotup"].dRot = [camrot1, 0, 0]
  3432. cont.activate(followcam.actuators["rotup"])
  3433. else:
  3434. cont.deactivate(followcam.actuators["rotup"])
  3435. # #down
  3436. if rUD < .080 and rUD > .03:
  3437. followcam.actuators["rotdown"].dRot = [-camrot1, 0, 0]
  3438. cont.activate(followcam.actuators["rotdown"])
  3439. else:
  3440. cont.deactivate(followcam.actuators["rotdown"])
  3441. # #left
  3442. if rLR > -0.080 and rLR < -0.030:
  3443. followcam.actuators["rotleft"].dRot = [0, 0, camrot1]
  3444. cont.activate(followcam.actuators["rotleft"])
  3445. else:
  3446. cont.deactivate(followcam.actuators["rotleft"])
  3447. # #right
  3448. if rLR < .080 and rLR > .03:
  3449. followcam.actuators["rotright"].dRot = [0, 0, -camrot1]
  3450. cont.activate(followcam.actuators["rotright"])
  3451. else:
  3452. cont.deactivate(followcam.actuators["rotright"])
  3453. def move_flycam():
  3454. if own['camera'] == 1:
  3455. #if rtsBut == False and own['lastrts'] == True:
  3456. if own['lastbkBut'] == True and bkBut == False:
  3457. if own['move_freecam'] == False:
  3458. own['move_freecam'] = True
  3459. else:
  3460. own['move_freecam'] = False
  3461. if own['move_freecam'] == True:
  3462. #act = freecam.actuators[
  3463. camspeed1 = .015
  3464. camspeed2 = .055
  3465. camrot1 = .005
  3466. camrot2 = .02
  3467. #up
  3468. if lUD < -0.080:
  3469. freecam.actuators["up"].dLoc = [ 0, 0, -camspeed2]
  3470. cont.activate(freecam.actuators["up"])
  3471. #print("fastup")
  3472. else:
  3473. cont.deactivate(freecam.actuators["up"])
  3474. # #down
  3475. if lUD > .080:
  3476. freecam.actuators["down"].dLoc = [ 0, 0, camspeed2]
  3477. cont.activate(freecam.actuators["down"])
  3478. else:
  3479. cont.deactivate(freecam.actuators["down"])
  3480. # #left
  3481. if lLR < -0.080:
  3482. freecam.actuators["left"].dLoc = [-camspeed2, 0, 0]
  3483. cont.activate(freecam.actuators["left"])
  3484. else:
  3485. cont.deactivate(freecam.actuators["left"])
  3486. # #right
  3487. if lLR > 0.080:
  3488. freecam.actuators["right"].dLoc = [camspeed2, 0, 0]
  3489. cont.activate(freecam.actuators["right"])
  3490. else:
  3491. cont.deactivate(freecam.actuators["right"])
  3492. #up
  3493. if rUD < -0.080:
  3494. freecam.actuators["rotup"].dRot = [camrot2, 0, 0]
  3495. cont.activate(freecam.actuators["rotup"])
  3496. else:
  3497. cont.deactivate(freecam.actuators["rotup"])
  3498. # #down
  3499. if rUD > .080:
  3500. freecam.actuators["rotdown"].dRot = [-camrot2, 0, 0]
  3501. cont.activate(freecam.actuators["rotdown"])
  3502. else:
  3503. cont.deactivate(freecam.actuators["rotdown"])
  3504. # #left
  3505. if rLR < -0.080:
  3506. freecam.actuators["rotleft"].dRot = [0, 0, camrot2]
  3507. cont.activate(freecam.actuators["rotleft"])
  3508. else:
  3509. cont.deactivate(freecam.actuators["rotleft"])
  3510. # #right
  3511. if rLR > 0.080:
  3512. freecam.actuators["rotright"].dRot = [0, 0, -camrot2]
  3513. cont.activate(freecam.actuators["rotright"])
  3514. else:
  3515. cont.deactivate(freecam.actuators["rotright"])
  3516. #*********************************************
  3517. if lUD > -0.080 and lUD < -0.030:
  3518. freecam.actuators["up"].dLoc = [ 0, 0, -camspeed1]
  3519. cont.activate(freecam.actuators["up"])
  3520. #print(lUD)
  3521. else:
  3522. cont.deactivate(freecam.actuators["up"])
  3523. # #down
  3524. if lUD < .080 and lUD > .03:
  3525. freecam.actuators["down"].dLoc = [ 0, 0, camspeed1]
  3526. cont.activate(freecam.actuators["down"])
  3527. else:
  3528. cont.deactivate(freecam.actuators["down"])
  3529. # #left
  3530. if lLR > -0.080 and lLR < -0.030:
  3531. freecam.actuators["left"].dLoc = [-camspeed1, 0, 0]
  3532. cont.activate(freecam.actuators["left"])
  3533. else:
  3534. cont.deactivate(freecam.actuators["left"])
  3535. # #right
  3536. if lLR < .080 and lLR > .03:
  3537. freecam.actuators["right"].dLoc = [camspeed1, 0, 0]
  3538. cont.activate(freecam.actuators["right"])
  3539. else:
  3540. cont.deactivate(freecam.actuators["right"])
  3541. #up
  3542. if rUD > -0.080 and rUD < -0.030:
  3543. freecam.actuators["rotup"].dRot = [camrot1, 0, 0]
  3544. cont.activate(freecam.actuators["rotup"])
  3545. else:
  3546. cont.deactivate(freecam.actuators["rotup"])
  3547. # #down
  3548. if rUD < .080 and rUD > .03:
  3549. freecam.actuators["rotdown"].dRot = [-camrot1, 0, 0]
  3550. cont.activate(freecam.actuators["rotdown"])
  3551. else:
  3552. cont.deactivate(freecam.actuators["rotdown"])
  3553. # #left
  3554. if rLR > -0.080 and rLR < -0.030:
  3555. freecam.actuators["rotleft"].dRot = [0, 0, camrot1]
  3556. cont.activate(freecam.actuators["rotleft"])
  3557. else:
  3558. cont.deactivate(freecam.actuators["rotleft"])
  3559. # #right
  3560. if rLR < .080 and rLR > .03:
  3561. freecam.actuators["rotright"].dRot = [0, 0, -camrot1]
  3562. cont.activate(freecam.actuators["rotright"])
  3563. else:
  3564. cont.deactivate(freecam.actuators["rotright"])
  3565. if r_ground.triggered == False:
  3566. own["lF_air_frame"] = own["framenum"]
  3567. if r_ground.triggered == True:
  3568. own["lF_ground_frame"] = own["framenum"]
  3569. if own['LAST_GRIND'] == True:
  3570. own['last_grind_frame'] = own['framenum']
  3571. if own['LAST_GRIND'] == False and r_ground.triggered and own['jump_timer'] == 0:
  3572. if own['jump_stance'] != 3:
  3573. own['jump_stance'] = 3
  3574. def control_calib():
  3575. #controller calibration test
  3576. scenes = bge.logic.getSceneList()
  3577. controller_calib = [scene for scene in scenes if scene.name=="controller_calib"][0]
  3578. cq1 = controller_calib.objects['q1']
  3579. cq2 = controller_calib.objects['q2']
  3580. cq3 = controller_calib.objects['q3']
  3581. cq4 = controller_calib.objects['q4']
  3582. cq5 = controller_calib.objects['q5']
  3583. cq6 = controller_calib.objects['q6']
  3584. cq7 = controller_calib.objects['q7']
  3585. cq8 = controller_calib.objects['q8']
  3586. if lq1on == 1:
  3587. cq1["q1"] = 1
  3588. else:
  3589. cq1["q1"] = 0
  3590. if lq2on == 1:
  3591. cq2["q2"] = 1
  3592. else:
  3593. cq2["q2"] = 0
  3594. if lq3on == 1:
  3595. cq3["q3"] = 1
  3596. else:
  3597. cq3["q3"] = 0
  3598. if lq4on == 1:
  3599. cq4["q4"] = 1
  3600. else:
  3601. cq4["q4"] = 0
  3602. if lq5on == 1:
  3603. cq5["q5"] = 1
  3604. else:
  3605. cq5["q5"] = 0
  3606. if lq6on == 1:
  3607. cq6["q6"] = 1
  3608. else:
  3609. cq6["q6"] = 0
  3610. if lq7on == 1:
  3611. cq7["q7"] = 1
  3612. else:
  3613. cq7["q7"] = 0
  3614. if lq8on == 1:
  3615. cq8["q8"] = 1
  3616. else:
  3617. cq8["q8"] = 0
  3618. def grind_turn():
  3619. jumping = None
  3620. gotcd = 25
  3621. force = [0,0,0]
  3622. grindHit = own['grindTouch']
  3623. #print("grindHit: ", grindHit)
  3624. sincegrinding = own['framenum'] - own['grindstartFrame']
  3625. STANCE = own['stance']
  3626. if rUD > turnsens or rLR > turnsens or rUD < -turnsens or rLR < -turnsens:
  3627. jumping = True
  3628. if grindHit == False:
  3629. cont.deactivate(own.actuators['grindoutRight'])
  3630. cont.deactivate(own.actuators['grindoutLeft'])
  3631. if (grindHit == True and jumping == None and sincegrinding > 20)or own['invert_on'] == True:
  3632. #if grindHit == True and jumping == None:
  3633. outloc = 0.022
  3634. bsoutloc = .07
  3635. bsoutvel = .1
  3636. outrot = .02 #0.012
  3637. outrot2 = .24
  3638. outact = own.actuators["grindoutRight"]
  3639. if own['grindpos'] == 'reg_5050':
  3640. if lq3on == 1 or lq2on:
  3641. if own['gt_cd2'] == 0:
  3642. own['gt_cd2'] = 60
  3643. if STANCE == True:
  3644. if own['grind_out_type'] == None:
  3645. own['grind_out_type'] = 'fak right'
  3646. if STANCE == False:
  3647. if own['grind_out_type'] == None:
  3648. own['grind_out_type'] = 'reg right'
  3649. own["grindoutturn"] = gotcd
  3650. if lq7on == 1 or lq8on:
  3651. if own['gt_cd2'] == 0:
  3652. own['gt_cd2'] = 60
  3653. if STANCE == True:
  3654. if own['grind_out_type'] == None:
  3655. own['grind_out_type'] = 'fak left'
  3656. if STANCE == False:
  3657. if own['grind_out_type'] == None:
  3658. own['grind_out_type'] = 'reg left'
  3659. own["grindoutturn"] = gotcd
  3660. if lq4on == 1:
  3661. if own['gt_cd2'] == 0:
  3662. own['gt_cd2'] = 60
  3663. if STANCE == True:
  3664. if own['grind_out_type'] == None:
  3665. own['grind_out_type'] = 'fak fak right'
  3666. if STANCE == False:
  3667. if own['grind_out_type'] == None:
  3668. own['grind_out_type'] = 'reg fak right'
  3669. own["grindoutturn"] = gotcd
  3670. if lq6on == 1:
  3671. if own['gt_cd2'] == 0:
  3672. own['gt_cd2'] = 60
  3673. if STANCE == True:
  3674. if own['grind_out_type'] == None:
  3675. own['grind_out_type'] = 'fak fak left'
  3676. if STANCE == False:
  3677. if own['grind_out_type'] == None:
  3678. own['grind_out_type'] = 'reg fak left'
  3679. own["grindoutturn"] = gotcd
  3680. #use stance for 5050 and grindstance for boards
  3681. if own['grindpos'] == 'reg_board':
  3682. outvel = own.getLinearVelocity(1)
  3683. outact.dLoc = [0, 0, 0]
  3684. outact.dRot = [0, 0, 0]
  3685. if lq5on == 1:
  3686. if own['gt_cd2'] == 0:
  3687. own['gt_cd2'] = 60
  3688. if STANCE == True:
  3689. if own['footplant_on'] == True:
  3690. own.setLinearVelocity([(outvel.x + -bsoutvel), outvel.y, outvel.z], 1)
  3691. cont.activate(own.actuators["grindoutRight"])
  3692. if own['grind_out_type'] == None:
  3693. own['grind_out_type'] = 'bs fak back'
  3694. if STANCE == False:
  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 reg back'
  3700. own["grindoutturn"] = gotcd
  3701. own['invert_on'] = 0
  3702. if lq1on == 1:
  3703. if own['gt_cd2'] == 0:
  3704. own['gt_cd2'] = 60
  3705. if STANCE == True:
  3706. if own['footplant_on'] == True:
  3707. own.setLinearVelocity([(outvel.x + bsoutvel), outvel.y, outvel.z], 1)
  3708. cont.activate(own.actuators["grindoutRight"])
  3709. if own['grind_out_type'] == None:
  3710. own['grind_out_type'] = 'bs fak forward'
  3711. if STANCE == False:
  3712. if own['footplant_on'] == True:
  3713. own.setLinearVelocity([(outvel.x + -bsoutvel), outvel.y, outvel.z], 1)
  3714. cont.activate(own.actuators["grindoutRight"])
  3715. if own['grind_out_type'] == None:
  3716. own['grind_out_type'] = 'bs reg forward'
  3717. own["grindoutturn"] = gotcd
  3718. own['invert_on'] = 0
  3719. if lq1on or lq2on or lq3on or lq4on or lq5on or lq6on or lq7on or lq8on:
  3720. gt_cd = own['gt_cd']
  3721. if gt_cd == 0:
  3722. gt_cd = 30
  3723. own['gt_cd'] = gt_cd
  3724. #else:
  3725. #else:
  3726. if own['grindoutturn'] == 0:
  3727. cont.deactivate(own.actuators["grindoutRight"])
  3728. own["grindoutturn"] = 0
  3729. gt_cd = own['gt_cd']
  3730. if gt_cd > 0:
  3731. own['gt_cd'] = gt_cd - 1
  3732. else:
  3733. own['gt_cd'] = 0
  3734. #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  3735. reg_move = .05
  3736. reg_rot = 0.01
  3737. reg_rot2 = .26
  3738. reg_move2 = .13
  3739. bsforce = 50
  3740. bs_dloc = .03
  3741. outvel = own.linearVelocity
  3742. if own['gt_cd2'] > 50 and own['jump_timer'] < 20:
  3743. if own['grind_out_type'] == 'reg right':
  3744. #print("do reg right")
  3745. own.applyMovement([0,reg_move,0], True)
  3746. own.applyRotation([0,0,reg_rot],True)
  3747. if own['grind_out_type'] == 'fak right':
  3748. own.applyMovement([0,-reg_move,0], True)
  3749. own.applyRotation([0,0,-reg_rot],True)
  3750. #print("do fak right")
  3751. if own['grind_out_type'] == 'reg left':
  3752. #print("do reg left")
  3753. own.applyMovement([0,-reg_move,0], True)
  3754. own.applyRotation([0,0,reg_rot],True)
  3755. if own['grind_out_type'] == 'fak left':
  3756. own.applyMovement([0,reg_move,0], True)
  3757. own.applyRotation([0,0,-reg_rot],True)
  3758. #print("do fak left")
  3759. if own['grind_out_type'] == 'reg fak right':
  3760. if own['gt_cd2'] > 55:
  3761. own.applyMovement([0,reg_move2,0], True)
  3762. own.applyRotation([0,0,reg_rot2],True)
  3763. #print("do reg fak right")
  3764. if own['grind_out_type'] == 'fak fak right':
  3765. if own['gt_cd2'] > 55:
  3766. own.applyMovement([0,-reg_move2,0], True)
  3767. own.applyRotation([0,0,reg_rot2],True)
  3768. #print("do fak fak right")
  3769. if own['grind_out_type'] == 'reg fak left':
  3770. if own['gt_cd2'] > 55:
  3771. own.applyMovement([0,-reg_move2,0], True)
  3772. own.applyRotation([0,0,-reg_rot2],True)
  3773. #print("do reg fak left")
  3774. if own['grind_out_type'] == 'fak fak left':
  3775. if own['gt_cd2'] > 55:
  3776. own.applyMovement([0,reg_move2,0], True)
  3777. own.applyRotation([0,0,-reg_rot2],True)
  3778. #print("do fak fak left")
  3779. 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':
  3780. own.setLinearVelocity([outvel.x * 1.01, outvel.y, outvel.z], True)
  3781. 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':
  3782. if own['gt_cd2'] == 51:
  3783. #print('outforce')
  3784. if STANCE == False:
  3785. own.applyForce([-200, 0, 0], True)
  3786. own['stance'] = True
  3787. STANCE = True
  3788. if STANCE == True:
  3789. own.applyForce([200, 0, 0], True)
  3790. own['stance'] = False
  3791. STANCE = False
  3792. if own['grind_out_type'] == 'bs reg back' or own['grind_out_type'] == 'bs fak forward':
  3793. if own['gt_cd2'] > 50:
  3794. if STANCE == True:
  3795. own.applyForce([bsforce, 0, 0], True)
  3796. if STANCE == False:
  3797. own.applyForce([bsforce, 0, 0], True)
  3798. own.applyMovement([bs_dloc,0,0], True)
  3799. if own['grind_out_type'] == 'bs fak back' or own['grind_out_type'] == 'bs reg forward':
  3800. if own['gt_cd2'] > 50:
  3801. if STANCE == True:
  3802. own.applyForce([-bsforce, 0, 0], True)
  3803. if STANCE == False:
  3804. own.applyForce([-bsforce, 0, 0], True)
  3805. own.applyMovement([-bs_dloc,0,0], True)
  3806. if own['gt_cd2'] > 0:
  3807. own['gt_cd2'] -= 1
  3808. if own['gt_cd2'] == 0:
  3809. own['grind_out_type'] = None
  3810. if own["grindoutturn"] > 0:
  3811. own["grindoutturn"] = own["grindoutturn"] - 1
  3812. def air_height():
  3813. height = own["air_height"]
  3814. if lf_ground == True and r_ground.triggered == False:
  3815. height = 0
  3816. #if
  3817. #wallride
  3818. def wallride():
  3819. wallride_off = own['wallride_off']
  3820. distance = own.getDistanceTo(gray.hitPosition)
  3821. upforce = 25
  3822. sideforce = 15
  3823. #distance = own["air_height"]
  3824. try:
  3825. obj = gray.hitObject
  3826. objpos = obj.worldPosition
  3827. ownpos = own.worldPosition
  3828. distance = ownpos.z - objpos.z
  3829. #print(distance)
  3830. except:
  3831. pass
  3832. if wallrideL.triggered and wallride_off == 0 and r_ground.triggered == False:
  3833. #print("wallrideL", distance)
  3834. own['jump_timer'] = 0
  3835. if r_ground.triggered == False:
  3836. own["wallride"] = "L"
  3837. #print(own["wallride"])
  3838. cont.activate(wallrideconstL)
  3839. force = [0,sideforce,upforce]
  3840. own.applyForce(force,1)
  3841. #own.alignAxisToVect(obj.worldPosition, 1, .9)
  3842. #align
  3843. if STANCE == 0:
  3844. own['requestAction'] = 'reg_wall_r'
  3845. #skater.playAction("reg_wall_r", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3846. else:
  3847. own['requestAction'] = 'fak_wall_l'
  3848. #skater.playAction("fak_wall_l", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3849. #deck.playAction("a_reg_wall_r", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3850. #trucks.playAction("a_reg_wall_r", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3851. else:
  3852. if own["wallride"] != "R":
  3853. own["wallride"] = None
  3854. cont.deactivate(wallrideconstL)
  3855. killact(3000)
  3856. killact(3001)
  3857. killact(3002)
  3858. if wallrideR.triggered and wallride_off == 0:
  3859. own['jump_timer'] = 0
  3860. #print("wallrideR", distance)
  3861. if r_ground.triggered == False:
  3862. own["wallride"] = "R"
  3863. cont.activate(wallrideconstR)
  3864. force = [0,-sideforce,upforce]
  3865. own.applyForce(force,1)
  3866. #own.alignAxisToVect(obj.worldPosition, 1, .9)
  3867. if STANCE == 0:
  3868. own['requestAction'] = 'reg_wall_l'
  3869. #skater.playAction("reg_wall_l", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3870. else:
  3871. own['requestAction'] = 'fak_wall_r'
  3872. #skater.playAction("fak_wall_r", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3873. #deck.playAction("a_reg_wall_l2", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3874. #trucks.playAction("a_reg_wall_l2", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3875. else:
  3876. if own["wallride"] != "L":
  3877. own["wallride"] = None
  3878. cont.deactivate(wallrideconstR)
  3879. killact(3003)
  3880. killact(3004)
  3881. killact(3005)
  3882. def wallride_sound():
  3883. sact = own.actuators["wallSound"]
  3884. 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'):
  3885. sact.volume = .2
  3886. cont.activate(own.actuators["wallSound"])
  3887. else:
  3888. sact.volume = .001
  3889. sact.stopSound()
  3890. if own['revert_timer'] > 0:
  3891. own['revert_timer'] = own['revert_timer'] - 1
  3892. def shutoff_timers():
  3893. #print(wallride)
  3894. if (LAST_GRIND == False and grindHit == True) or (jump_timer > 10 and own['wallride'] == None):
  3895. own["Q1oncd"] = 0
  3896. own["Q2oncd"] = 0
  3897. own["Q3oncd"] = 0
  3898. own["Q4oncd"] = 0
  3899. own["Q5oncd"] = 0
  3900. own["Q6oncd"] = 0
  3901. own["Q7oncd"] = 0
  3902. own["Q8oncd"] = 0
  3903. def grindout_cleanup():
  3904. lgf = own['last_grind_frame']
  3905. def trans_jump():
  3906. if own['jump_from_trans'] == 1:
  3907. ground_ray = cont.sensors['ground_look']
  3908. jump_obj = own['trans_jump_obj']
  3909. jump_obj = scene.objects[str(own['trans_jump_obj'])]
  3910. #print(jump_obj)
  3911. worldVect = [1, 0, 0]
  3912. vect = jump_obj.getAxisVect(worldVect)
  3913. go = jump_obj.worldOrientation
  3914. grinder_axis = [0,1,0]
  3915. player_pos = own.worldPosition
  3916. jump_obj = jump_obj.worldPosition
  3917. try:
  3918. delta = player_pos - jump_obj
  3919. except:
  3920. #print("delta broke: ", player_pos, grinder_pos)
  3921. pass
  3922. delta = delta.cross(vect)
  3923. deltamove = delta[1] * .25
  3924. move = [deltamove, 0, 0]
  3925. #print(deltamove)
  3926. if abs(deltamove) < 1 and delta[1] < 1:
  3927. own.applyMovement(move, True)
  3928. def air_mover():
  3929. if r_ground.triggered == False and jump_timer > 53 and frames_since_grinding > 50:
  3930. #print(lUD)
  3931. if lUD > 0.075:
  3932. print("air_mover", jump_timer)
  3933. if STANCE == 0:
  3934. force2 = [120, 0, 10]
  3935. if STANCE == 1:
  3936. force2 = [-120, 0, 10]
  3937. own.applyForce(force2, True)
  3938. #own.applyForce([0,0,5], False)
  3939. own['no_grind_pull'] = 1
  3940. if r_ground.triggered == False and jump_timer > 10 and lUD > 0.075 and frames_since_grinding > 50:
  3941. #print(lUD)
  3942. print("air_mover", jump_timer)
  3943. if STANCE == 0:
  3944. force2 = [7, 0, 10]
  3945. if STANCE == 1:
  3946. force2 = [-7, 0, 10]
  3947. own.applyForce(force2, True)
  3948. own.applyForce([0,0,5], False)
  3949. own['air_mover'] = True
  3950. own['no_grind_pull'] = 1
  3951. else:
  3952. own['air_mover'] = False
  3953. framenum = own['framenum']
  3954. last_ground_frame = own['lF_ground_frame']
  3955. lF_air_frame = own['lF_air_frame']
  3956. frames_since_ground = framenum - lF_air_frame
  3957. if framenum - lF_air_frame > 30:
  3958. own['no_grind_pull'] = 0
  3959. #if grindHit == 1:
  3960. # skater.applyRotation([0,0,.05], False)
  3961. # deck.applyRotation([0,0,.05], False)
  3962. # trucks.applyRotation([0,0,.05], False)
  3963. #else:
  3964. # skater.applyRotation([0,0,.0], False)
  3965. # deck.applyRotation([0,0,.0], False)
  3966. # trucks.applyRotation([0,0,.0], False)
  3967. #control_calib() #scene must be enabled in main
  3968. jump_Timer()
  3969. check_landing()
  3970. #SWAG()
  3971. #isplaying()
  3972. nextframe()
  3973. wheelroll()
  3974. rollsound()
  3975. reset_pos()
  3976. ylimit()
  3977. getoffboard()
  3978. #switchcam()
  3979. move_flycam()
  3980. move_followcam()
  3981. grind_turn()
  3982. air_height()
  3983. wallride()
  3984. wallride_sound()
  3985. shutoff_timers()
  3986. grindout_cleanup()
  3987. air_mover()
  3988. linvelx = own.getLinearVelocity(True)
  3989. own["linvelx"] = linvelx.x
  3990. LAST_STANCE = STANCE
  3991. LAST_STANCE = own["stance"]
  3992. own["last_stance"] = STANCE
  3993. own["lastGrab"] = GRAB_ON
  3994. own['ground'] = r_ground.triggered
  3995. own['last_ground'] = r_ground.triggered
  3996. own["LAST_GRIND"] = grindHit
  3997. own["rotz"] = rot.z
  3998. own['walk'] = 0
  3999. own['lasty'] = yBut
  4000. own['lastlts'] = ltsBut
  4001. own['lastrts'] = rtsBut
  4002. own["lF_ground2"] = own["lF_ground"]
  4003. own['last_invert'] = invert_on
  4004. own['lastbkBut'] = bkBut
  4005. own['grab_type'] = grab_type
  4006. own['last_last_manual'] = own['last_manual']
  4007. own['last_manual'] = own['manual']
  4008. own['last_reg_manual'] = own['reg_manual']
  4009. own['last_fak_manual'] = own['fak_manual']
  4010. own['last_fak_nmanual'] = own['fak_nmanual']
  4011. own['last_reg_nmanual'] = own['reg_nmanual']
  4012. if own['manual'] == 1:
  4013. own['last_manual_frame'] = frame
  4014. own['last_hippy'] = own['hippy']
  4015. if aBut == 1 and own["lasta"] == 0:
  4016. own["lastaf"] = frame
  4017. if xBut == 1 and own["lastx"] == 0:
  4018. own["lastxf"] = frame
  4019. own["lasta"] = aBut
  4020. own["lastx"] = xBut
  4021. own['lastaBut_ground'] = aBut_ground
  4022. own['lastxBut_ground'] = xBut_ground
  4023. own["last_sel"] = own["sel"]
  4024. own["sel"] = bkBut
  4025. if r_ground.triggered and own["jump_timer"] < 20:
  4026. force2 = [0.0, 0, -10]
  4027. own.applyForce(force2, True)
  4028. #print('grindtouch = ', own['grindTouch'])
  4029. if (grindDar == False and r_ground.triggered and own['grindTouch'] == False) or own['jump_timer'] > 40:
  4030. own['grindType'] = ''
  4031. #print(own['grindType'])